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, 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
29
30
31#ifndef _GENDRILL_EXCELLON_WRITER_
32#define _GENDRILL_EXCELLON_WRITER_
33
35
36#include <wx/filename.h>
37
38class BOARD;
39class PLOTTER;
40class OUTPUTFORMATTER;
41
42
47{
48public:
49 EXCELLON_WRITER( BOARD* aPcb );
50
52 {
53 }
54
59
63 void SetRouteModeForOvalHoles( bool aUseRouteModeForOvalHoles )
64 {
65 m_useRouteModeForOval = aUseRouteModeForOvalHoles;
66 }
67
79 void SetFormat( bool aMetric, ZEROS_FMT aZerosFmt = DECIMAL_FORMAT,
80 int aLeftDigits = 0, int aRightDigits = 0 );
81
91 void SetOptions( bool aMirror, bool aMinimalHeader, const VECTOR2I& aOffset,
92 bool aMerge_PTH_NPTH )
93 {
94 m_mirror = aMirror;
95 m_offset = aOffset;
96 m_minimalHeader = aMinimalHeader;
97 m_merge_PTH_NPTH = aMerge_PTH_NPTH;
98 }
99
110 bool CreateDrillandMapFilesSet( const wxString& aPlotDirectory, bool aGenDrill, bool aGenMap,
111 REPORTER* aReporter = nullptr );
112
113private:
122 int createDrillFile( FILE* aFile, const DRILL_SPAN& aSpan, TYPE_FILE aHolesType,
123 bool aTagBackdrillHit = false );
124
125
142 void writeEXCELLONHeader( const DRILL_SPAN& aSpan, TYPE_FILE aHolesType );
143
145
149 void writeCoordinates( char* aLine, size_t aLineSize, double aCoordX, double aCoordY );
150
156 void writeHoleAttribute( HOLE_ATTRIBUTE aAttribute );
157
158 wxFileName getBackdrillLayerPairFileName( const DRILL_SPAN& aSpan ) const;
159 bool writeBackdrillLayerPairFile( const wxString& aPlotDirectory,
160 REPORTER* aReporter, const DRILL_SPAN& aSpan );
161 void writeHoleComments( const HOLE_INFO& aHole, bool aTagBackdrillHit );
163 int aDepthIU, int aAngleDeciDegree,
164 const wxString& aSideLabel );
165 wxString formatLinearValue( int aValueIU ) const;
166
167 FILE* m_file; // The output file
168 bool m_minimalHeader; // True to use minimal header
170 bool m_useRouteModeForOval; // True to use a route command for oval holes
171 // False to use a G85 canned mode for oval holes
172 int m_mantissaLenght; // Max number of digits printed in float numbers
173};
174
175#endif // #ifndef _GENDRILL_EXCELLON_WRITER_
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
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:295
Base plotter engine class.
Definition plotter.h:136
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
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:695