EXCELLON_WRITER: update info in comments.
This commit is contained in:
parent
953279ce70
commit
2528e1fc98
|
@ -126,7 +126,19 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
|
|||
}
|
||||
}
|
||||
|
||||
createDrillFile( file, pair, doing_npth );
|
||||
TYPE_FILE file_type = TYPE_FILE::PTH_FILE;
|
||||
|
||||
// Only external layer pair can have non plated hole
|
||||
// internal layers have only plated via holes
|
||||
if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
|
||||
{
|
||||
if( m_merge_PTH_NPTH )
|
||||
file_type = TYPE_FILE::MIXED_FILE;
|
||||
else if( doing_npth )
|
||||
file_type = TYPE_FILE::NPTH_FILE;
|
||||
}
|
||||
|
||||
createDrillFile( file, pair, file_type );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,16 +166,16 @@ void EXCELLON_WRITER::writeHoleAttribute( HOLE_ATTRIBUTE aAttribute, bool aToolA
|
|||
|
||||
case HOLE_ATTRIBUTE::HOLE_PAD:
|
||||
if( aToolAttr )
|
||||
fprintf( m_file, "; #@! TA.AperFunction,ComponentDrill\n" );
|
||||
fprintf( m_file, "; #@! TA.AperFunction,ComponentDrill,Plated,PTH\n" );
|
||||
else
|
||||
fprintf( m_file, "; pad hole\n" );
|
||||
fprintf( m_file, "; plated pad hole\n" );
|
||||
break;
|
||||
|
||||
case HOLE_ATTRIBUTE::HOLE_MECHANICAL:
|
||||
if( aToolAttr )
|
||||
fprintf( m_file, "; #@! TA.AperFunction,MechanicalDrill\n" );
|
||||
fprintf( m_file, "; #@! TA.AperFunction,ComponentDrill,NonPlated,NPTH\n" );
|
||||
else
|
||||
fprintf( m_file, "; mechanical\n" );
|
||||
fprintf( m_file, "; not plated pad hole\n" );
|
||||
break;
|
||||
|
||||
case HOLE_ATTRIBUTE::HOLE_UNKNOWN:
|
||||
|
@ -178,7 +190,7 @@ void EXCELLON_WRITER::writeHoleAttribute( HOLE_ATTRIBUTE aAttribute, bool aToolA
|
|||
|
||||
|
||||
int EXCELLON_WRITER::createDrillFile( FILE* aFile, DRILL_LAYER_PAIR aLayerPair,
|
||||
bool aGenerateNPTH_list )
|
||||
TYPE_FILE aHolesType )
|
||||
{
|
||||
m_file = aFile;
|
||||
|
||||
|
@ -189,7 +201,7 @@ int EXCELLON_WRITER::createDrillFile( FILE* aFile, DRILL_LAYER_PAIR aLayerPair,
|
|||
|
||||
LOCALE_IO dummy; // Use the standard notation for double numbers
|
||||
|
||||
writeEXCELLONHeader( aLayerPair, aGenerateNPTH_list );
|
||||
writeEXCELLONHeader( aLayerPair, aHolesType );
|
||||
|
||||
holes_count = 0;
|
||||
|
||||
|
@ -491,7 +503,7 @@ void EXCELLON_WRITER::writeCoordinates( char* aLine, double aCoordX, double aCoo
|
|||
|
||||
|
||||
void EXCELLON_WRITER::writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair,
|
||||
bool aGenerateNPTH_list)
|
||||
TYPE_FILE aHolesType )
|
||||
{
|
||||
fputs( "M48\n", m_file ); // The beginning of a header
|
||||
|
||||
|
@ -545,14 +557,11 @@ void EXCELLON_WRITER::writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair,
|
|||
msg << GetBuildVersion() << "\n";
|
||||
fputs( TO_UTF8( msg ), m_file );
|
||||
|
||||
if( !m_merge_PTH_NPTH )
|
||||
{
|
||||
// Add the standard X2 FileFunction for drill files
|
||||
// TF.FileFunction,Plated[NonPlated],layer1num,layer2num,PTH[NPTH]
|
||||
msg = BuildFileFunctionAttributeString( aLayerPair, aGenerateNPTH_list, true )
|
||||
+ "\n";
|
||||
fputs( TO_UTF8( msg ), m_file );
|
||||
}
|
||||
// Add the standard X2 FileFunction for drill files
|
||||
// TF.FileFunction,Plated[NonPlated],layer1num,layer2num,PTH[NPTH]
|
||||
msg = BuildFileFunctionAttributeString( aLayerPair, aHolesType , true )
|
||||
+ "\n";
|
||||
fputs( TO_UTF8( msg ), m_file );
|
||||
|
||||
fputs( "FMAT,2\n", m_file ); // Use Format 2 commands (version used since 1979)
|
||||
}
|
||||
|
|
|
@ -114,7 +114,8 @@ public:
|
|||
* @param aGenMap = true to generate a drill map file
|
||||
* @param aReporter = a REPORTER to return activity or any message (can be NULL)
|
||||
*/
|
||||
void CreateDrillandMapFilesSet( const wxString& aPlotDirectory, bool aGenDrill, bool aGenMap,
|
||||
void CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
|
||||
bool aGenDrill, bool aGenMap,
|
||||
REPORTER * aReporter = NULL );
|
||||
|
||||
|
||||
|
@ -123,9 +124,12 @@ private:
|
|||
* Function CreateDrillFile
|
||||
* Creates an Excellon drill file
|
||||
* @param aFile = an opened file to write to will be closed by CreateDrillFile
|
||||
* @param aLayerPair = the layer pair for the current holes
|
||||
* @param aHolesType = the holes type (PTH, NPTH, mixed)
|
||||
* @return hole count
|
||||
*/
|
||||
int createDrillFile( FILE * aFile, DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list );
|
||||
int createDrillFile( FILE * aFile, DRILL_LAYER_PAIR aLayerPair,
|
||||
TYPE_FILE aHolesType );
|
||||
|
||||
|
||||
/** Print the DRILL file header. The full header is somethink like:
|
||||
|
@ -137,8 +141,10 @@ private:
|
|||
* ; #@! TF.GenerationSoftware,Kicad,Pcbnew,2017.04
|
||||
* FMAT,2
|
||||
* INCH,TZ
|
||||
* @param aLayerPair = the layer pair for the current holes
|
||||
* @param aHolesType = the holes type in file (PTH, NPTH, mixed)
|
||||
*/
|
||||
void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list);
|
||||
void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType );
|
||||
|
||||
void writeEXCELLONEndOfFile();
|
||||
|
||||
|
@ -152,7 +158,7 @@ private:
|
|||
* write a comment string giving the hole attribute like
|
||||
* "; #@! TO.P,viatype\n"
|
||||
* @param aAttribute is the hole attribute
|
||||
* @param aToolAttr = true if the comment is for a tool,
|
||||
* @param aToolAttr = true if the comment is for a tool (like T1C0.5),
|
||||
* false for a hole in coord list
|
||||
*/
|
||||
void writeHoleAttribute( HOLE_ATTRIBUTE aAttribute, bool aToolAttr );
|
||||
|
|
|
@ -355,7 +355,8 @@ void GENDRILL_WRITER_BASE::CreateMapFilesSet( const wxString& aPlotDirectory,
|
|||
|
||||
|
||||
const wxString GENDRILL_WRITER_BASE::BuildFileFunctionAttributeString(
|
||||
DRILL_LAYER_PAIR aLayerPair, bool aIsNpth, bool aCompatNCdrill ) const
|
||||
DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHoleType,
|
||||
bool aCompatNCdrill ) const
|
||||
{
|
||||
// Build a wxString containing the .FileFunction attribute for drill files.
|
||||
// %TF.FileFunction,Plated[NonPlated],layer1num,layer2num,PTH[NPTH][Blind][Buried],Drill[Route][Mixed]*%
|
||||
|
@ -368,8 +369,10 @@ const wxString GENDRILL_WRITER_BASE::BuildFileFunctionAttributeString(
|
|||
|
||||
text << "TF.FileFunction,";
|
||||
|
||||
if( aIsNpth )
|
||||
if( aHoleType == NPTH_FILE )
|
||||
text << "NonPlated,";
|
||||
else if( aHoleType == MIXED_FILE ) // only for Excellon format
|
||||
text << "MixedPlating,";
|
||||
else
|
||||
text << "Plated,";
|
||||
|
||||
|
@ -385,21 +388,24 @@ const wxString GENDRILL_WRITER_BASE::BuildFileFunctionAttributeString(
|
|||
else
|
||||
layer2 += 1;
|
||||
|
||||
text << layer1 << ",";
|
||||
text << layer2 << ",";
|
||||
text << layer1 << "," << layer2;
|
||||
|
||||
// Now add PTH or NPTH or Blind or Buried attribute
|
||||
int toplayer = 1;
|
||||
int bottomlayer = m_pcb->GetCopperLayerCount();
|
||||
|
||||
if( aIsNpth )
|
||||
text << "NPTH";
|
||||
if( aHoleType == NPTH_FILE )
|
||||
text << ",NPTH";
|
||||
else if( aHoleType == MIXED_FILE ) // only for Excellon format
|
||||
{
|
||||
// write nothing
|
||||
}
|
||||
else if( layer1 == toplayer && layer2 == bottomlayer )
|
||||
text << "PTH";
|
||||
text << ",PTH";
|
||||
else if( layer1 == toplayer || layer2 == bottomlayer )
|
||||
text << "Blind";
|
||||
text << ",Blind";
|
||||
else
|
||||
text << "Buried";
|
||||
text << ",Buried";
|
||||
|
||||
// In NC drill file, these previous parameters should be enough:
|
||||
if( aCompatNCdrill )
|
||||
|
|
|
@ -44,9 +44,9 @@ class BOARD_ITEM;
|
|||
enum class HOLE_ATTRIBUTE
|
||||
{
|
||||
HOLE_UNKNOWN, // uninitialized type
|
||||
HOLE_VIA, // a via hole
|
||||
HOLE_PAD, // a plated pad hole
|
||||
HOLE_MECHANICAL // a mechanical (not plated) pad hole
|
||||
HOLE_VIA, // a via hole (always plated)
|
||||
HOLE_PAD, // a plated or not plated pad hole
|
||||
HOLE_MECHANICAL // a mechanical pad (provided, not used)
|
||||
};
|
||||
|
||||
|
||||
|
@ -156,6 +156,12 @@ public:
|
|||
KEEP_ZEROS // keep zeros
|
||||
};
|
||||
|
||||
enum TYPE_FILE { // type of holes in file: PTH, NPTH, mixed
|
||||
PTH_FILE, // PTH only, this is the default also for blind/buried holes
|
||||
NPTH_FILE, // NPTH only
|
||||
MIXED_FILE // PHT+NPTH (mixed)
|
||||
};
|
||||
|
||||
protected:
|
||||
BOARD* m_pcb;
|
||||
wxString m_drillFileExtension; // .drl or .gbr, depending on format
|
||||
|
@ -374,11 +380,12 @@ protected:
|
|||
* There is no X1 version, as the Gerber drill files uses only X2 format
|
||||
* There is a compatible NC drill version.
|
||||
* @param aLayerPair is the layer pair (Drill from rom first layer to second layer)
|
||||
* @param aIsNpth is true when generating NPTH drill file
|
||||
* @param aHoleType is type of drill file (PTH, NPTH, mixed)
|
||||
* @param aCompatNCdrill is true when generating NC (Excellon) compatible drill file
|
||||
*/
|
||||
const wxString BuildFileFunctionAttributeString( DRILL_LAYER_PAIR aLayerPair,
|
||||
bool aIsNpth, bool aCompatNCdrill = false ) const;
|
||||
TYPE_FILE aHoleType,
|
||||
bool aCompatNCdrill = false ) const;
|
||||
};
|
||||
|
||||
#endif // #define GENDRILL_FILE_WRITER_BASE_H
|
||||
|
|
|
@ -150,7 +150,10 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
|
|||
|
||||
// Add the standard X2 FileFunction for drill files
|
||||
// %TF.FileFunction,Plated[NonPlated],layer1num,layer2num,PTH[NPTH][Blind][Buried],Drill[Route][Mixed]*%
|
||||
wxString text = BuildFileFunctionAttributeString( aLayerPair, aIsNpth );
|
||||
wxString text = BuildFileFunctionAttributeString( aLayerPair,
|
||||
aIsNpth
|
||||
? TYPE_FILE::NPTH_FILE
|
||||
: TYPE_FILE::PTH_FILE );
|
||||
plotter.AddLineToHeader( text );
|
||||
|
||||
// Add file polarity (positive)
|
||||
|
|
Loading…
Reference in New Issue