Gerber plotter: rename UseX2Attributes() to UseX2format, and fix incorrect/outdated comments.

This commit is contained in:
jean-pierre charras 2018-12-09 10:23:07 +01:00
parent a18c7496bb
commit f6aed7c99a
4 changed files with 13 additions and 12 deletions

View File

@ -59,7 +59,7 @@ GERBER_PLOTTER::GERBER_PLOTTER()
// happen easily.
m_gerberUnitInch = false;
m_gerberUnitFmt = 6;
m_useX2Attributes = true;
m_useX2format = true;
m_useNetAttributes = true;
}
@ -113,7 +113,7 @@ void GERBER_PLOTTER::clearNetAttribute()
return;
// Remove all net attributes from object attributes dictionnary
if( m_useX2Attributes )
if( m_useX2format )
fputs( "%TD*%\n", outputFile );
else
fputs( "G04 #@! TD*\n", outputFile );
@ -147,7 +147,7 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData )
if( !m_useNetAttributes )
return;
bool useX1StructuredComment = !m_useX2Attributes;
bool useX1StructuredComment = !m_useX2format;
bool clearDict;
std::string short_attribute_string;
@ -344,7 +344,7 @@ void GERBER_PLOTTER::writeApertureList()
bool useX1StructuredComment = false;
if( !m_useX2Attributes )
if( !m_useX2format )
useX1StructuredComment = true;
// Init
@ -407,7 +407,7 @@ void GERBER_PLOTTER::writeApertureList()
// is to store the last attribute
if( attribute )
{
if( m_useX2Attributes )
if( m_useX2format )
fputs( "%TD*%\n", outputFile );
else
fputs( "G04 #@! TD*\n", outputFile );

View File

@ -1134,7 +1134,7 @@ public:
*/
virtual void SetGerberCoordinatesFormat( int aResolution, bool aUseInches = false ) override;
void UseX2Attributes( bool aEnable ) { m_useX2Attributes = aEnable; }
void UseX2format( bool aEnable ) { m_useX2format = aEnable; }
void UseX2NetAttributes( bool aEnable ) { m_useNetAttributes = aEnable; }
/**
@ -1221,11 +1221,11 @@ protected:
bool m_gerberUnitInch; // true if the gerber units are inches, false for mm
int m_gerberUnitFmt; // number of digits in mantissa.
// usually 6 in Inches and 5 or 6 in mm
bool m_useX2Attributes; // In recent gerber files, attributes can be added.
// It will be added if this parm is true
bool m_useX2format; // In recent gerber files, attributes are added.
// Attributes in file header will be added using X2 format if true
// If false (X1 format), these attributes will be added as comments.
bool m_useNetAttributes; // In recent gerber files, netlist info can be added.
// It will be added if this parm is true
// (imply m_useX2Attributes == true)
// It will be added if this param is true, using X2 or X1 format
};

View File

@ -136,7 +136,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
GERBER_PLOTTER plotter;
// Gerber drill file imply X2 format:
plotter.UseX2Attributes( true );
plotter.UseX2format( true );
plotter.UseX2NetAttributes( true );
// Add the standard X2 header, without FileFunction

View File

@ -1110,9 +1110,10 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
bool useX2mode = plotOpts.GetUseGerberX2format();
GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
gbrplotter->UseX2Attributes( useX2mode );
gbrplotter->UseX2format( useX2mode );
gbrplotter->UseX2NetAttributes( plotOpts.GetIncludeGerberNetlistInfo() );
// Attributes can be added using X2 format or as comment (X1 format)
AddGerberX2Attribute( plotter, aBoard, aLayer, not useX2mode );
}