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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
25
26
27#ifndef _GENDRILL_EXCELLON_WRITER_
28#define _GENDRILL_EXCELLON_WRITER_
29
31
32#include <wx/filename.h>
33
34class BOARD;
35class PLOTTER;
36class OUTPUTFORMATTER;
37
38
43{
44public:
45 EXCELLON_WRITER( BOARD* aPcb );
46
48 {
49 }
50
55
59 void SetRouteModeForOvalHoles( bool aUseRouteModeForOvalHoles )
60 {
61 m_useRouteModeForOval = aUseRouteModeForOvalHoles;
62 }
63
75 void SetFormat( bool aMetric, ZEROS_FMT aZerosFmt = DECIMAL_FORMAT,
76 int aLeftDigits = 0, int aRightDigits = 0 );
77
87 void SetOptions( bool aMirror, bool aMinimalHeader, const VECTOR2I& aOffset,
88 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
106 bool CreateDrillandMapFilesSet( const wxString& aPlotDirectory, bool aGenDrill, bool aGenMap,
107 REPORTER* aReporter = nullptr );
108
109private:
118 int createDrillFile( FILE* aFile, const DRILL_SPAN& aSpan, TYPE_FILE aHolesType,
119 bool aTagBackdrillHit = false );
120
121
138 void writeEXCELLONHeader( const DRILL_SPAN& aSpan, TYPE_FILE aHolesType );
139
141
145 void writeCoordinates( char* aLine, size_t aLineSize, double aCoordX, double aCoordY );
146
152 void writeHoleAttribute( HOLE_ATTRIBUTE aAttribute );
153
154 wxFileName getBackdrillLayerPairFileName( const DRILL_SPAN& aSpan ) const;
155 bool writeBackdrillLayerPairFile( const wxString& aPlotDirectory,
156 REPORTER* aReporter, const DRILL_SPAN& aSpan );
157 void writeHoleComments( const HOLE_INFO& aHole, bool aTagBackdrillHit );
159 int aDepthIU, int aAngleDeciDegree,
160 const wxString& aSideLabel );
161 wxString formatLinearValue( int aValueIU ) const;
162
163 FILE* m_file; // The output file
164 bool m_minimalHeader; // True to use minimal header
166 bool m_useRouteModeForOval; // True to use a route command for oval holes
167 // False to use a G85 canned mode for oval holes
168 int m_mantissaLenght; // Max number of digits printed in float numbers
169};
170
171#endif // #ifndef _GENDRILL_EXCELLON_WRITER_
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
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.
int createDrillFile(FILE *aFile, const DRILL_SPAN &aSpan, TYPE_FILE aHolesType, bool aTagBackdrillHit=false)
Create an Excellon drill file.
void writePostMachiningComment(PAD_DRILL_POST_MACHINING_MODE aMode, int aSizeIU, int aDepthIU, int aAngleDeciDegree, const wxString &aSideLabel)
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.
wxFileName getBackdrillLayerPairFileName(const DRILL_SPAN &aSpan) const
VECTOR2I GetOffset()
Return the plot offset (usually the position of the auxiliary axis.
wxString formatLinearValue(int aValueIU) const
void SetOptions(bool aMirror, bool aMinimalHeader, const VECTOR2I &aOffset, bool aMerge_PTH_NPTH)
Initialize internal parameters to match drill options.
void writeHoleComments(const HOLE_INFO &aHole, bool aTagBackdrillHit)
void SetRouteModeForOvalHoles(bool aUseRouteModeForOvalHoles)
bool writeBackdrillLayerPairFile(const wxString &aPlotDirectory, REPORTER *aReporter, const DRILL_SPAN &aSpan)
void writeEXCELLONHeader(const DRILL_SPAN &aSpan, TYPE_FILE aHolesType)
Print the DRILL file header.
Handle hole which must be drilled (diameter, position and layers).
An interface used to output 8 bit text in a convenient way.
Definition richio.h:291
Base plotter engine class.
Definition plotter.h:133
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:71
helper classes to handle hole info for drill files generators.
PAD_DRILL_POST_MACHINING_MODE
Definition padstack.h:76
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683