From f6aed7c99abc918bbe7ab66b8af26adb61b96513 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 9 Dec 2018 10:23:07 +0100 Subject: [PATCH] Gerber plotter: rename UseX2Attributes() to UseX2format, and fix incorrect/outdated comments. --- common/plotters/GERBER_plotter.cpp | 10 +++++----- include/plotter.h | 10 +++++----- pcbnew/exporters/gendrill_gerber_writer.cpp | 2 +- pcbnew/plot_board_layers.cpp | 3 ++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 4b4aebca76..dfd5d2a90a 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -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 ); diff --git a/include/plotter.h b/include/plotter.h index 0fa0c6d20f..89008a923a 100644 --- a/include/plotter.h +++ b/include/plotter.h @@ -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 }; diff --git a/pcbnew/exporters/gendrill_gerber_writer.cpp b/pcbnew/exporters/gendrill_gerber_writer.cpp index 688d64378a..421afc6b02 100644 --- a/pcbnew/exporters/gendrill_gerber_writer.cpp +++ b/pcbnew/exporters/gendrill_gerber_writer.cpp @@ -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 diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 8d4eb6c4f0..6526dd4dae 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -1110,9 +1110,10 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, bool useX2mode = plotOpts.GetUseGerberX2format(); GERBER_PLOTTER* gbrplotter = static_cast ( 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 ); }