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:
179 fprintf(
m_file,
"; #@! TA.AperFunction,Plated,PTH,ComponentDrill\n" );
182 case HOLE_ATTRIBUTE::HOLE_MECHANICAL:
183 fprintf(
m_file,
"; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill\n" );
186 case HOLE_ATTRIBUTE::HOLE_UNKNOWN:
187 fprintf(
m_file,
"; #@! TD\n" );
199 int diam, holes_count;
200 int x0, y0, xf, yf, xc, yc;
215#if USE_ATTRIB_FOR_HOLES
233 int tool_reference = -2;
245 fprintf(
m_file,
"T%d\n", tool_reference );
277 fprintf(
m_file,
"T%d\n", tool_reference );
324 for(
int kk = 0; line[kk] != 0; kk++ )
336 fputs(
"M15\nG01",
m_file );
372 if( aLeftDigits <= 0 )
375 if( aRightDigits <= 0 )
404 xs.Printf( wxT(
"%.3f" ), aCoordX );
405 ys.Printf( wxT(
"%.3f" ), aCoordY );
410 xs.Printf( wxT(
"%.4f" ), aCoordX );
411 ys.Printf( wxT(
"%.4f" ), aCoordY );
415 while( xs.Last() ==
'0' )
418 if( xs.Last() ==
'.' )
421 while( ys.Last() ==
'0' )
424 if( ys.Last() ==
'.' )
427 std::snprintf( aLine, aLineSize,
"X%sY%s\n",
TO_UTF8( xs ),
TO_UTF8( ys ) );
433 aCoordX *= 10; aCoordY *= 10;
436 std::snprintf( aLine, aLineSize,
"X%dY%d\n",
KiROUND( aCoordX ),
KiROUND( aCoordY ) );
453 xs.Printf( wxT(
"%0*d" ), xpad,
KiROUND( aCoordX ) );
454 ys.Printf( wxT(
"%0*d" ), ypad,
KiROUND( aCoordY ) );
456 size_t j = xs.Len() - 1;
458 while( xs[j] ==
'0' && j )
463 while( ys[j] ==
'0' && j )
466 std::snprintf( aLine, aLineSize,
"X%sY%s\n",
TO_UTF8( xs ),
TO_UTF8( ys ) );
473 aCoordX *= 10; aCoordY *= 10;
482 xs.Printf( wxT(
"%0*d" ), xpad,
KiROUND( aCoordX ) );
483 ys.Printf( wxT(
"%0*d" ), ypad,
KiROUND( aCoordY ) );
484 std::snprintf( aLine, aLineSize,
"X%sY%s\n",
TO_UTF8( xs ),
TO_UTF8( ys ) );
501 msg = wxT(
"; FORMAT={" );
511 msg << wxT(
"/ absolute / " );
523 const wxString zero_fmt[4] =
526 wxT(
"suppress leading zeros" ),
527 wxT(
"suppress trailing zeros" ),
540 msg = wxT(
"; #@! TF.GenerationSoftware,Kicad,Pcbnew," );
549 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 & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
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.