87 hole_sets.emplace_back(
F_Cu,
B_Cu );
89 for( std::vector<DRILL_LAYER_PAIR>::const_iterator it = hole_sets.begin();
90 it != hole_sets.end(); ++it )
106 fn.SetPath( aPlotDirectory );
110 wxString fullFilename = fn.GetFullPath();
112 FILE* file = wxFopen( fullFilename, wxT(
"w" ) );
114 if( file ==
nullptr )
118 msg.Printf(
_(
"Failed to create file '%s'." ), fullFilename );
129 msg.Printf(
_(
"Created file '%s'" ), fullFilename );
142 else if( doing_npth )
170 case HOLE_ATTRIBUTE::HOLE_VIA_THROUGH:
171 fprintf(
m_file,
"; #@! TA.AperFunction,Plated,PTH,ViaDrill\n" );
174 case HOLE_ATTRIBUTE::HOLE_VIA_BURIED:
175 fprintf(
m_file,
"; #@! TA.AperFunction,Plated,Buried,ViaDrill\n" );
178 case HOLE_ATTRIBUTE::HOLE_PAD:
180 fprintf(
m_file,
"; #@! TA.AperFunction,Plated,PTH,ComponentDrill\n" );
183 case HOLE_ATTRIBUTE::HOLE_PAD_CASTELLATED:
184 fprintf(
m_file,
"; #@! TA.AperFunction,Plated,PTH,CastelletedDrill\n" );
187 case HOLE_ATTRIBUTE::HOLE_PAD_PRESSFIT:
188 fprintf(
m_file,
"; #@! TA.AperFunction,Plated,PTH,ComponentDrill,PressFit\n" );
191 case HOLE_ATTRIBUTE::HOLE_MECHANICAL:
192 fprintf(
m_file,
"; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill\n" );
195 case HOLE_ATTRIBUTE::HOLE_UNKNOWN:
196 fprintf(
m_file,
"; #@! TD\n" );
208 int diam, holes_count;
209 int x0, y0, xf, yf, xc, yc;
224#if USE_ATTRIB_FOR_HOLES
242 int tool_reference = -2;
254 fprintf(
m_file,
"T%d\n", tool_reference );
286 fprintf(
m_file,
"T%d\n", tool_reference );
333 for(
int kk = 0; line[kk] != 0; kk++ )
345 fputs(
"M15\nG01",
m_file );
381 if( aLeftDigits <= 0 )
384 if( aRightDigits <= 0 )
413 xs.Printf( wxT(
"%.3f" ), aCoordX );
414 ys.Printf( wxT(
"%.3f" ), aCoordY );
419 xs.Printf( wxT(
"%.4f" ), aCoordX );
420 ys.Printf( wxT(
"%.4f" ), aCoordY );
424 while( xs.Last() ==
'0' )
427 if( xs.Last() ==
'.' )
430 while( ys.Last() ==
'0' )
433 if( ys.Last() ==
'.' )
436 std::snprintf( aLine, aLineSize,
"X%sY%s\n",
TO_UTF8( xs ),
TO_UTF8( ys ) );
442 aCoordX *= 10; aCoordY *= 10;
445 std::snprintf( aLine, aLineSize,
"X%dY%d\n",
KiROUND( aCoordX ),
KiROUND( aCoordY ) );
462 xs.Printf( wxT(
"%0*d" ), xpad,
KiROUND( aCoordX ) );
463 ys.Printf( wxT(
"%0*d" ), ypad,
KiROUND( aCoordY ) );
465 size_t j = xs.Len() - 1;
467 while( xs[j] ==
'0' && j )
472 while( ys[j] ==
'0' && j )
475 std::snprintf( aLine, aLineSize,
"X%sY%s\n",
TO_UTF8( xs ),
TO_UTF8( ys ) );
482 aCoordX *= 10; aCoordY *= 10;
491 xs.Printf( wxT(
"%0*d" ), xpad,
KiROUND( aCoordX ) );
492 ys.Printf( wxT(
"%0*d" ), ypad,
KiROUND( aCoordY ) );
493 std::snprintf( aLine, aLineSize,
"X%sY%s\n",
TO_UTF8( xs ),
TO_UTF8( ys ) );
510 msg = wxT(
"; FORMAT={" );
520 msg << wxT(
"/ absolute / " );
532 const wxString zero_fmt[4] =
535 wxT(
"suppress leading zeros" ),
536 wxT(
"suppress trailing zeros" ),
549 msg = wxT(
"; #@! TF.GenerationSoftware,Kicad,Pcbnew," );
558 fputs(
"FMAT,2\n",
m_file );
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
wxString GetBuildVersion()
Get the full KiCad version string.
Information pertinent to a Pcbnew printed circuit board.
wxString GetPrecisionString()
void SetFormat(bool aMetric, ZEROS_FMT aZerosFmt=DECIMAL_FORMAT, int aLeftDigits=0, int aRightDigits=0)
Initialize internal parameters to match the given format.
bool m_useRouteModeForOval
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.
EXCELLON_WRITER(BOARD *aPcb)
int createDrillFile(FILE *aFile, DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType)
Create an Excellon drill file.
void writeEXCELLONEndOfFile()
Create drill maps and drill reports and drill files.
std::vector< DRILL_LAYER_PAIR > getUniqueLayerPairs() const
Get unique layer pairs by examining the micro and blind_buried vias.
virtual const wxString getDrillFileName(DRILL_LAYER_PAIR aPair, bool aNPTH, bool aMerge_PTH_NPTH) const
void buildHolesList(DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list)
Create the list of holes and tools for a given board.
const wxString BuildFileFunctionAttributeString(DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHoleType, bool aCompatNCdrill=false) const
wxString m_drillFileExtension
std::vector< HOLE_INFO > m_holeListBuffer
DRILL_PRECISION m_precision
std::vector< DRILL_TOOL > m_toolListBuffer
bool CreateMapFilesSet(const wxString &aPlotDirectory, REPORTER *aReporter=nullptr)
Create the full set of map files for the board, in PS, PDF ... format (use SetMapFileFormat() to sele...
int getHolesCount() const
Handle hole which must be drilled (diameter, position and layers).
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
Classes used in drill files, map files and report files generation.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
static const std::string DrillFileExtension
This file contains miscellaneous commonly used macros and functions.
std::vector< FAB_LAYER_COLOR > dummy
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition of file extensions used in Kicad.