KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gendrill_Excellon_writer.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2017 Jean_Pierre Charras <jp.charras at wanadoo.fr>
5 * Copyright (C) 1992-2021 KiCad Developers, see AUTHOR.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
31#ifndef _GENDRILL_EXCELLON_WRITER_
32#define _GENDRILL_EXCELLON_WRITER_
33
35
36class BOARD;
37class PLOTTER;
38class OUTPUTFORMATTER;
39
40
45{
46public:
47 EXCELLON_WRITER( BOARD* aPcb );
48
50 {
51 }
52
57
61 void SetRouteModeForOvalHoles( bool aUseRouteModeForOvalHoles )
62 {
63 m_useRouteModeForOval = aUseRouteModeForOvalHoles;
64 }
65
77 void SetFormat( bool aMetric, ZEROS_FMT aZerosFmt = DECIMAL_FORMAT,
78 int aLeftDigits = 0, int aRightDigits = 0 );
79
89 void SetOptions( bool aMirror, bool aMinimalHeader, const VECTOR2I& aOffset,
90 bool aMerge_PTH_NPTH )
91 {
92 m_mirror = aMirror;
93 m_offset = aOffset;
94 m_minimalHeader = aMinimalHeader;
95 m_merge_PTH_NPTH = aMerge_PTH_NPTH;
96 }
97
108 bool CreateDrillandMapFilesSet( const wxString& aPlotDirectory, bool aGenDrill, bool aGenMap,
109 REPORTER* aReporter = nullptr );
110
111private:
120 int createDrillFile( FILE* aFile, DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType );
121
122
139 void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType );
140
142
146 void writeCoordinates( char* aLine, size_t aLineSize, double aCoordX, double aCoordY );
147
153 void writeHoleAttribute( HOLE_ATTRIBUTE aAttribute );
154
155 FILE* m_file; // The output file
156 bool m_minimalHeader; // True to use minimal header
158 bool m_useRouteModeForOval; // True to use a route command for oval holes
159 // False to use a G85 canned mode for oval holes
160};
161
162#endif // #ifndef _GENDRILL_EXCELLON_WRITER_
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:281
Create Excellon drill, drill map, and drill report files.
void SetFormat(bool aMetric, ZEROS_FMT aZerosFmt=DECIMAL_FORMAT, int aLeftDigits=0, int aRightDigits=0)
Initialize internal parameters to match the given format.
void writeCoordinates(char *aLine, size_t aLineSize, double aCoordX, double aCoordY)
Create a line like according to the selected format.
void writeEXCELLONHeader(DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType)
Print the DRILL file header.
void writeHoleAttribute(HOLE_ATTRIBUTE aAttribute)
Write a comment string giving the hole attribute.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board.
VECTOR2I GetOffset()
Return the plot offset (usually the position of the auxiliary axis.
int createDrillFile(FILE *aFile, DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType)
Create an Excellon drill file.
void SetOptions(bool aMirror, bool aMinimalHeader, const VECTOR2I &aOffset, bool aMerge_PTH_NPTH)
Initialize internal parameters to match drill options.
void SetRouteModeForOvalHoles(bool aUseRouteModeForOvalHoles)
Create drill maps and drill reports and drill files.
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:322
Base plotter engine class.
Definition: plotter.h:104
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
helper classes to handle hole info for drill files generators.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR