STEP Export: Update options to reflect DNP and Unspecified filtering

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14125
This commit is contained in:
Mike Williams 2023-04-13 10:30:31 -04:00
parent 3c24017aa4
commit 33b2b5b09d
11 changed files with 136 additions and 52 deletions

View File

@ -33,7 +33,8 @@ public:
m_useGridOrigin( false ),
m_useDrillOrigin( false ),
m_boardOnly( false ),
m_includeExcludedBom( false ),
m_includeUnspecified( false ),
m_includeDNP( false ),
m_substModels( false ),
m_filename(),
m_outputFile(),
@ -49,7 +50,8 @@ public:
bool m_useGridOrigin;
bool m_useDrillOrigin;
bool m_boardOnly;
bool m_includeExcludedBom;
bool m_includeUnspecified;
bool m_includeDNP;
bool m_substModels;
wxString m_filename;
wxString m_outputFile;

View File

@ -29,7 +29,8 @@
#define ARG_DRILL_ORIGIN "--drill-origin"
#define ARG_GRID_ORIGIN "--grid-origin"
#define ARG_NO_VIRTUAL "--no-virtual"
#define ARG_NO_UNSPECIFIED "--no-unspecified"
#define ARG_NO_DNP "--no-dnp"
#define ARG_SUBST_MODELS "--subst-models"
#define ARG_FORCE "--force"
#define ARG_OUTPUT "--output"
@ -55,8 +56,13 @@ CLI::EXPORT_PCB_STEP_COMMAND::EXPORT_PCB_STEP_COMMAND() : COMMAND( "step" )
.implicit_value( true )
.default_value( false );
m_argParser.add_argument( ARG_NO_VIRTUAL )
.help( UTF8STDSTR( _( "Exclude 3D models for components with 'virtual' attribute" ) ) )
m_argParser.add_argument( ARG_NO_UNSPECIFIED )
.help( UTF8STDSTR( _( "Exclude 3D models for components with 'Unspecified' footprint type" ) ) )
.implicit_value( true )
.default_value( false );
m_argParser.add_argument( ARG_NO_DNP )
.help( UTF8STDSTR( _( "Exclude 3D models for components with 'Do not populate' attribute" ) ) )
.implicit_value( true )
.default_value( false );
@ -101,7 +107,8 @@ int CLI::EXPORT_PCB_STEP_COMMAND::doPerform( KIWAY& aKiway )
step->m_useDrillOrigin = m_argParser.get<bool>( ARG_DRILL_ORIGIN );
step->m_useGridOrigin = m_argParser.get<bool>( ARG_GRID_ORIGIN );
step->m_includeExcludedBom = !m_argParser.get<bool>( ARG_NO_VIRTUAL );
step->m_includeUnspecified = !m_argParser.get<bool>( ARG_NO_UNSPECIFIED );
step->m_includeDNP = !m_argParser.get<bool>( ARG_NO_DNP );
step->m_substModels = m_argParser.get<bool>( ARG_SUBST_MODELS );
step->m_overwrite = m_argParser.get<bool>( ARG_FORCE );
step->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );

View File

@ -85,9 +85,14 @@ protected:
STEP_ORIGIN_OPTION GetOriginOption();
bool GetNoVirtOption()
bool GetNoUnspecifiedOption()
{
return m_cbRemoveVirtual->GetValue();
return m_cbRemoveUnspecified->GetValue();
}
bool GetNoDNPOption()
{
return m_cbRemoveDNP->GetValue();
}
bool GetSubstOption()
@ -106,7 +111,8 @@ private:
double m_userOriginX; // remember last User Origin X value
double m_userOriginY; // remember last User Origin Y value
int m_originUnits; // remember last units for User Origin
bool m_noVirtual; // remember last preference for No Virtual Component
bool m_noUnspecified; // remember last preference for No Unspecified Component
bool m_noDNP; // remember last preference for No DNP Component
static bool m_exportTracks; // remember last preference to export tracks
// (stored only for the session)
wxString m_boardPath; // path to the exported board file
@ -172,10 +178,12 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
m_originUnits = cfg->m_ExportStep.origin_units;
m_userOriginX = cfg->m_ExportStep.origin_x;
m_userOriginY = cfg->m_ExportStep.origin_y;
m_noVirtual = cfg->m_ExportStep.no_virtual;
m_noUnspecified = cfg->m_ExportStep.no_unspecified;
m_noDNP = cfg->m_ExportStep.no_dnp;
m_cbExportTracks->SetValue( m_exportTracks );
m_cbRemoveVirtual->SetValue( m_noVirtual );
m_cbRemoveUnspecified->SetValue( m_noUnspecified );
m_cbRemoveDNP->SetValue( m_noDNP );
m_cbSubstModels->SetValue( cfg->m_ExportStep.replace_models );
m_cbOverwriteFile->SetValue( cfg->m_ExportStep.overwrite_file );
@ -253,7 +261,8 @@ DIALOG_EXPORT_STEP::~DIALOG_EXPORT_STEP()
m_STEP_Yorg->GetValue().ToDouble( &val );
cfg->m_ExportStep.origin_y = val;
cfg->m_ExportStep.no_virtual = m_cbRemoveVirtual->GetValue();
cfg->m_ExportStep.no_unspecified = m_cbRemoveUnspecified->GetValue();
cfg->m_ExportStep.no_dnp = m_cbRemoveDNP->GetValue();
m_toleranceLastChoice = m_choiceTolerance->GetSelection();
m_exportTracks = m_cbExportTracks->GetValue();
@ -393,8 +402,11 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
cmdK2S.Append( wxT( " export" ) );
cmdK2S.Append( wxT( " step" ) );
if( GetNoVirtOption() )
cmdK2S.Append( wxT( " --no-virtual" ) );
if( GetNoUnspecifiedOption() )
cmdK2S.Append( wxT( " --no-unspecified" ) );
if( GetNoDNPOption() )
cmdK2S.Append( wxT( " --no-dnp" ) );
if( GetSubstOption() )
cmdK2S.Append( wxT( " --subst-models" ) );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -107,10 +107,15 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
wxStaticBoxSizer* sbOtherOptions;
sbOtherOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Other Options") ), wxVERTICAL );
m_cbRemoveVirtual = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Ignore not mounted components"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRemoveVirtual->SetToolTip( _("Do not show components not in BOM and not in place file") );
m_cbRemoveDNP = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Ignore 'Do not populate' components"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRemoveDNP->SetToolTip( _("Do not show components marked 'Do not populate'") );
sbOtherOptions->Add( m_cbRemoveVirtual, 0, wxBOTTOM|wxRIGHT, 5 );
sbOtherOptions->Add( m_cbRemoveDNP, 0, wxBOTTOM|wxRIGHT, 5 );
m_cbRemoveUnspecified = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Ignore 'Unspecified' components"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRemoveUnspecified->SetToolTip( _("Do not show components with Footprint Type 'Unspecified'") );
sbOtherOptions->Add( m_cbRemoveUnspecified, 0, wxBOTTOM|wxRIGHT, 5 );
m_cbSubstModels = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Substitute similarly named models"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbSubstModels->SetToolTip( _("Replace VRML models with STEP models of the same name") );

View File

@ -36,7 +36,6 @@
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
@ -96,7 +95,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -158,7 +156,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -247,7 +244,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -312,7 +308,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -377,7 +372,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -442,7 +436,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -537,7 +530,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -600,7 +592,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -665,7 +656,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -727,7 +717,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -793,7 +782,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -855,7 +843,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -938,7 +925,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -946,7 +932,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Ignore not mounted components</property>
<property name="label">Ignore &apos;Do not populate&apos; components</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -954,7 +940,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbRemoveVirtual</property>
<property name="name">m_cbRemoveDNP</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -967,7 +953,71 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Do not show components not in BOM and not in place file</property>
<property name="tooltip">Do not show components marked &apos;Do not populate&apos;</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Ignore &apos;Unspecified&apos; components</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbRemoveUnspecified</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Do not show components with Footprint Type &apos;Unspecified&apos;</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@ -1003,7 +1053,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -1068,7 +1117,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -1133,7 +1181,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -1197,7 +1244,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -1260,7 +1306,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -54,7 +54,8 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM
TEXT_CTRL_EVAL* m_STEP_Xorg;
wxStaticText* m_staticTextYpos;
TEXT_CTRL_EVAL* m_STEP_Yorg;
wxCheckBox* m_cbRemoveVirtual;
wxCheckBox* m_cbRemoveDNP;
wxCheckBox* m_cbRemoveUnspecified;
wxCheckBox* m_cbSubstModels;
wxCheckBox* m_cbOverwriteFile;
wxCheckBox* m_cbExportTracks;

View File

@ -173,7 +173,12 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
false /* include private items */ );
}
if( ( aFootprint->GetAttributes() & FP_EXCLUDE_FROM_BOM ) && !m_params.m_includeExcludedBom )
if( ( !(aFootprint->GetAttributes() & (FP_THROUGH_HOLE|FP_SMD)) ) && !m_params.m_includeUnspecified )
{
return hasdata;
}
if( ( aFootprint->GetAttributes() & FP_DNP ) && !m_params.m_includeDNP )
{
return hasdata;
}

View File

@ -49,7 +49,8 @@ public:
m_overwrite( false ),
m_useGridOrigin( false ),
m_useDrillOrigin( false ),
m_includeExcludedBom( true ),
m_includeUnspecified( true ),
m_includeDNP( true ),
m_substModels( true ),
m_BoardOutlinesChainingEpsilon( BOARD_DEFAULT_CHAINING_EPSILON ),
m_boardOnly( false ),
@ -63,7 +64,8 @@ public:
bool m_overwrite;
bool m_useGridOrigin;
bool m_useDrillOrigin;
bool m_includeExcludedBom;
bool m_includeUnspecified;
bool m_includeDNP;
bool m_substModels;
double m_BoardOutlinesChainingEpsilon;
bool m_boardOnly;

View File

@ -97,7 +97,8 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob )
EXPORTER_STEP_PARAMS params;
params.m_exportTracks = aStepJob->m_exportTracks;
params.m_includeExcludedBom = aStepJob->m_includeExcludedBom;
params.m_includeUnspecified = aStepJob->m_includeUnspecified;
params.m_includeDNP = aStepJob->m_includeDNP;
params.m_BoardOutlinesChainingEpsilon = aStepJob->m_BoardOutlinesChainingEpsilon;
params.m_overwrite = aStepJob->m_overwrite;
params.m_substModels = aStepJob->m_substModels;

View File

@ -334,8 +334,11 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<double>( "export_step.origin_y",
&m_ExportStep.origin_y, 0 ) );
m_params.emplace_back( new PARAM<bool>( "export_step.no_virtual",
&m_ExportStep.no_virtual, false ) );
m_params.emplace_back( new PARAM<bool>( "export_step.no_unspecified",
&m_ExportStep.no_unspecified, false ) );
m_params.emplace_back( new PARAM<bool>( "export_step.no_dnp",
&m_ExportStep.no_dnp, false ) );
m_params.emplace_back( new PARAM<bool>( "export_step.replace_models",
&m_ExportStep.replace_models, true ) );

View File

@ -178,7 +178,8 @@ public:
int origin_units;
double origin_x;
double origin_y;
bool no_virtual;
bool no_unspecified;
bool no_dnp;
bool replace_models;
bool overwrite_file;
};