KiCad PCB EDA Suite
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-2017 KiCad Developers, see change_log.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 
36 class BOARD;
37 class PLOTTER;
38 class OUTPUTFORMATTER;
39 
45 {
46 private:
47  FILE* m_file; // The output file
48  bool m_minimalHeader; // True to use minimal header
49  bool m_mirror;
50 
51 public:
52  EXCELLON_WRITER( BOARD* aPcb );
53 
54  virtual ~EXCELLON_WRITER()
55  {
56  }
57 
62  const wxPoint GetOffset() { return m_offset; }
63 
74  void SetFormat( bool aMetric, ZEROS_FMT aZerosFmt = DECIMAL_FORMAT,
75  int aLeftDigits = 0, int aRightDigits = 0 );
76 
77 
78 
88  void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMerge_PTH_NPTH )
89  {
90  m_mirror = aMirror;
91  m_offset = aOffset;
92  m_minimalHeader = aMinimalHeader;
93  m_merge_PTH_NPTH = aMerge_PTH_NPTH;
94  }
95 
105  void CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
106  bool aGenDrill, bool aGenMap,
107  REPORTER * aReporter = NULL );
108 
109 
110 private:
117  int createDrillFile( FILE * aFile, DRILL_LAYER_PAIR aLayerPair,
118  bool aGenerateNPTH_list );
119 
120 
121  /* Print the DRILL file header. The full header is somethink like:
122  * M48
123  * ;DRILL file {PCBNEW (2007-11-29-b)} date 17/1/2008-21:02:35
124  * ;FORMAT={ <precision> / absolute / <units> / <numbers format>}
125  * ; #@! TF.FileFunction,Plated,1,4,PTH
126  * ; #@! TF.CreationDate,2018-11-23T15:59:51+01:00
127  * ; #@! TF.GenerationSoftware,Kicad,Pcbnew,2017.04
128  * FMAT,2
129  * INCH,TZ
130  */
131  void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair,
132  bool aGenerateNPTH_list);
133 
134  void writeEXCELLONEndOfFile();
135 
136  /* Created a line like:
137  * X48000Y19500
138  * According to the selected format
139  */
140  void writeCoordinates( char* aLine, double aCoordX, double aCoordY );
141 };
142 
143 #endif // #ifndef _GENDRILL_EXCELLON_WRITER_
EXCELLON_WRITER is a class mainly used to create Excellon drill files However, this class is also use...
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
int createDrillFile(FILE *aFile, DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list)
Function CreateDrillFile Creates an Excellon drill file.
void writeEXCELLONHeader(DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list)
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void SetFormat(bool aMetric, ZEROS_FMT aZerosFmt=DECIMAL_FORMAT, int aLeftDigits=0, int aRightDigits=0)
Function SetFormat Initialize internal parameters to match the given format.
void writeCoordinates(char *aLine, double aCoordX, double aCoordY)
helper classes to handle hole info for drill files generators.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
void CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, REPORTER *aReporter=NULL)
Function CreateDrillandMapFilesSet Creates the full set of Excellon drill file for the board filename...
Base plotter engine class.
Definition: plotter.h:97
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
const wxPoint GetOffset()
Return the plot offset (usually the position of the auxiliary axis.
void SetOptions(bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMerge_PTH_NPTH)
Function SetOptions Initialize internal parameters to match drill options.
GENDRILL_WRITER_BASE is a class to create drill maps and drill report, and a helper class to created ...