Pcbnew, Plot dialog, Gerber format: Enable or disable adding net metadata both in X1 and X2 format. Previously, this option was existing only in X2 format. Should be existing in both formats.

A bit of cleaning code related to this option.
This commit is contained in:
jean-pierre charras 2018-12-08 17:46:41 +01:00
parent dd9a001077
commit 7f20c55ed6
8 changed files with 195 additions and 1767 deletions

View File

@ -59,7 +59,7 @@ GERBER_PLOTTER::GERBER_PLOTTER()
// happen easily.
m_gerberUnitInch = false;
m_gerberUnitFmt = 6;
m_useX2Attributes = false;
m_useX2Attributes = true;
m_useNetAttributes = true;
}
@ -144,13 +144,11 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData )
if( aData == NULL )
return;
bool useX1StructuredComment = false;
if( !m_useX2Attributes )
useX1StructuredComment = true;
else if( !m_useNetAttributes )
if( !m_useNetAttributes )
return;
bool useX1StructuredComment = !m_useX2Attributes;
bool clearDict;
std::string short_attribute_string;
@ -325,7 +323,7 @@ void GERBER_PLOTTER::selectAperture( const wxSize& aSize,
( currentAperture->m_Type != aType ) ||
( currentAperture->m_Size != aSize );
if( m_useX2Attributes && !m_useNetAttributes )
if( !m_useNetAttributes )
aApertureAttribute = 0;
else
change = change || ( currentAperture->m_ApertureAttribute != aApertureAttribute );

View File

@ -133,18 +133,17 @@ void DIALOG_PLOT::init_Dialog()
m_layerCheckListBox->Check( checkIndex );
}
// Option for using proper Gerber extensions
// Option for using proper Gerber extensions. Note also Protel extensions are
// a broken feature. However, for now, we need to handle it.
m_useGerberExtensions->SetValue( m_plotOpts.GetUseGerberProtelExtensions() );
// Option for including Gerber attributes (from Gerber X2 format) in the output
m_useGerberX2Attributes->SetValue( m_plotOpts.GetUseGerberAttributes() );
// Option for including Gerber attributes, from Gerber X2 format, in the output
// In X1 format, they will be added as comments
m_useGerberX2Format->SetValue( m_plotOpts.GetUseGerberX2format() );
// Option for including Gerber netlist info (from Gerber X2 format) in the output
m_useGerberNetAttributes->SetValue( m_plotOpts.GetIncludeGerberNetlistInfo() );
// Grey out if m_useGerberX2Attributes is not checked
m_useGerberNetAttributes->Enable( m_useGerberX2Attributes->GetValue() );
// Option to generate a Gerber job file
m_generateGerberJobFile->SetValue( m_plotOpts.GetCreateGerberJobFile() );
@ -658,7 +657,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetFormat( getPlotFormat() );
tempOptions.SetUseGerberProtelExtensions( m_useGerberExtensions->GetValue() );
tempOptions.SetUseGerberAttributes( m_useGerberX2Attributes->GetValue() );
tempOptions.SetUseGerberX2format( m_useGerberX2Format->GetValue() );
tempOptions.SetIncludeGerberNetlistInfo( m_useGerberNetAttributes->GetValue() );
tempOptions.SetCreateGerberJobFile( m_generateGerberJobFile->GetValue() );
@ -701,18 +700,7 @@ void DIALOG_PLOT::applyPlotSettings()
void DIALOG_PLOT::OnGerberX2Checked( wxCommandEvent& event )
{
// m_useGerberNetAttributes is useless if m_useGerberX2Attributes
// is not checked. So disabled (greyed out) when Gerber X2 gets unchecked
// to make it clear to the user.
if( m_useGerberX2Attributes->GetValue() )
{
m_useGerberNetAttributes->Enable( true );
}
else
{
m_useGerberNetAttributes->Enable( false );
m_useGerberNetAttributes->SetValue( false );
}
// Currently: do nothing
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -42,7 +42,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bupperSizer->Add( m_outputDirectoryName, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_browseButton->SetMinSize( wxSize( 29,29 ) );
bupperSizer->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
@ -209,13 +209,13 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_coordFormatCtrl->SetSelection( 0 );
gbSizer2->Add( m_coordFormatCtrl, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_useGerberX2Attributes = new wxCheckBox( m_GerberOptionsSizer->GetStaticBox(), wxID_ANY, _("Include extended (X2) attributes"), wxDefaultPosition, wxDefaultSize, 0 );
m_useGerberX2Attributes->SetToolTip( _("Include extended attributes (X2 Gerber files format) in the Gerber file.\nMainly File Format attributes.") );
m_useGerberX2Format = new wxCheckBox( m_GerberOptionsSizer->GetStaticBox(), wxID_ANY, _("Use extended X2 format"), wxDefaultPosition, wxDefaultSize, 0 );
m_useGerberX2Format->SetToolTip( _("Use X2 Gerber file format.\nInclude mainly X2 attributes in Gerber headers.\nIf not checked, use X1 format.\nIn X1 format, these attributes are included as comments in files.") );
gbSizer2->Add( m_useGerberX2Attributes, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
gbSizer2->Add( m_useGerberX2Format, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
m_useGerberNetAttributes = new wxCheckBox( m_GerberOptionsSizer->GetStaticBox(), wxID_ANY, _("Include advanced X2 features"), wxDefaultPosition, wxDefaultSize, 0 );
m_useGerberNetAttributes->SetToolTip( _("Only available in X2 Gerber files format.\nInclude netlist metadata and aperture attributes.") );
m_useGerberNetAttributes = new wxCheckBox( m_GerberOptionsSizer->GetStaticBox(), wxID_ANY, _("Include netlist attributes"), wxDefaultPosition, wxDefaultSize, 0 );
m_useGerberNetAttributes->SetToolTip( _("Include netlist metadata and aperture attributes in Gerber files.\nIn X1 format, they are comments.\nUsed to check connectivity in CAM tools and Gerber viewers.") );
gbSizer2->Add( m_useGerberNetAttributes, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 30 );
@ -391,7 +391,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this );
m_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_useGerberX2Attributes->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnGerberX2Checked ), NULL, this );
m_useGerberX2Format->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnGerberX2Checked ), NULL, this );
m_DXF_plotModeOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnChangeDXFPlotMode ), NULL, this );
m_buttonDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this );
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
@ -412,7 +412,7 @@ DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_layerCheckListBox->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this );
m_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_useGerberX2Attributes->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnGerberX2Checked ), NULL, this );
m_useGerberX2Format->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnGerberX2Checked ), NULL, this );
m_DXF_plotModeOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnChangeDXFPlotMode ), NULL, this );
m_buttonDRC->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this );
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PLOT_BASE_H__
#define __DIALOG_PLOT_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -93,7 +92,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxCheckBox* m_subtractMaskFromSilk;
wxStaticText* coordFormatLabel;
wxChoice* m_coordFormatCtrl;
wxCheckBox* m_useGerberX2Attributes;
wxCheckBox* m_useGerberX2Format;
wxCheckBox* m_useGerberNetAttributes;
wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_hpglPenLabel;
@ -146,4 +145,3 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
};
#endif //__DIALOG_PLOT_BASE_H__

View File

@ -93,7 +93,7 @@ static bool setDouble( double* aTarget, double aValue, double aMin, double aMax
PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
{
m_useGerberProtelExtensions = false;
m_useGerberAttributes = false;
m_useGerberX2format = false;
m_includeGerberNetlistInfo = false;
m_createGerberJobFile = false;
m_gerberPrecision = gbrDefaultPrecision;
@ -162,7 +162,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
m_useGerberProtelExtensions ? trueStr : falseStr );
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberattributes ),
GetUseGerberAttributes() ? trueStr : falseStr );
GetUseGerberX2format() ? trueStr : falseStr );
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberadvancedattributes ),
GetIncludeGerberNetlistInfo() ? trueStr : falseStr );
@ -239,9 +239,9 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCom
return false;
if( m_useGerberProtelExtensions != aPcbPlotParams.m_useGerberProtelExtensions )
return false;
if( m_useGerberAttributes != aPcbPlotParams.m_useGerberAttributes )
if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
return false;
if( m_useGerberAttributes && m_includeGerberNetlistInfo != aPcbPlotParams.m_includeGerberNetlistInfo )
if( m_includeGerberNetlistInfo != aPcbPlotParams.m_includeGerberNetlistInfo )
return false;
if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
return false;
@ -402,7 +402,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
break;
case T_usegerberattributes:
aPcbPlotParams->m_useGerberAttributes = parseBool();
aPcbPlotParams->m_useGerberX2format = parseBool();
break;
case T_usegerberadvancedattributes:

View File

@ -103,7 +103,7 @@ private:
bool m_useGerberProtelExtensions;
/// Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool m_useGerberAttributes;
bool m_useGerberX2format;
/// Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
bool m_includeGerberNetlistInfo;
@ -243,8 +243,8 @@ public:
void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
wxString GetOutputDirectory() const { return m_outputDirectory; }
void SetUseGerberAttributes( bool aUse ) { m_useGerberAttributes = aUse; }
bool GetUseGerberAttributes() const { return m_useGerberAttributes; }
void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
bool GetUseGerberX2format() const { return m_useGerberX2format; }
void SetIncludeGerberNetlistInfo( bool aUse ) { m_includeGerberNetlistInfo = aUse; }
bool GetIncludeGerberNetlistInfo() const { return m_includeGerberNetlistInfo; }

View File

@ -1107,19 +1107,13 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
// For the Gerber "file function" attribute, set the layer number
if( plotter->GetPlotterType() == PLOT_FORMAT_GERBER )
{
bool useX2mode = plotOpts.GetUseGerberAttributes();
bool useX2mode = plotOpts.GetUseGerberX2format();
if( useX2mode )
{
AddGerberX2Attribute( plotter, aBoard, aLayer, false );
GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
gbrplotter->UseX2Attributes( true );
gbrplotter->UseX2NetAttributes( plotOpts.GetIncludeGerberNetlistInfo() );
}
else
{
AddGerberX2Attribute( plotter, aBoard, aLayer, true );
}
GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
gbrplotter->UseX2Attributes( useX2mode );
gbrplotter->UseX2NetAttributes( plotOpts.GetIncludeGerberNetlistInfo() );
AddGerberX2Attribute( plotter, aBoard, aLayer, not useX2mode );
}
plotter->StartPlot();