From 33b2b5b09d5d0628a1a445fd541c8b8fe17cbb3a Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Thu, 13 Apr 2023 10:30:31 -0400 Subject: [PATCH] STEP Export: Update options to reflect DNP and Unspecified filtering Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14125 --- common/jobs/job_export_pcb_step.h | 8 +- kicad/cli/command_export_pcb_step.cpp | 15 +++- pcbnew/dialogs/dialog_export_step.cpp | 30 +++++--- pcbnew/dialogs/dialog_export_step_base.cpp | 13 +++- pcbnew/dialogs/dialog_export_step_base.fbp | 89 ++++++++++++++++------ pcbnew/dialogs/dialog_export_step_base.h | 5 +- pcbnew/exporters/step/exporter_step.cpp | 7 +- pcbnew/exporters/step/exporter_step.h | 8 +- pcbnew/pcbnew_jobs_handler.cpp | 3 +- pcbnew/pcbnew_settings.cpp | 7 +- pcbnew/pcbnew_settings.h | 3 +- 11 files changed, 136 insertions(+), 52 deletions(-) diff --git a/common/jobs/job_export_pcb_step.h b/common/jobs/job_export_pcb_step.h index b70c83e05f..b1c025dbef 100644 --- a/common/jobs/job_export_pcb_step.h +++ b/common/jobs/job_export_pcb_step.h @@ -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; @@ -59,4 +61,4 @@ public: bool m_exportTracks; }; -#endif \ No newline at end of file +#endif diff --git a/kicad/cli/command_export_pcb_step.cpp b/kicad/cli/command_export_pcb_step.cpp index 4e3111009e..3848218398 100644 --- a/kicad/cli/command_export_pcb_step.cpp +++ b/kicad/cli/command_export_pcb_step.cpp @@ -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( ARG_DRILL_ORIGIN ); step->m_useGridOrigin = m_argParser.get( ARG_GRID_ORIGIN ); - step->m_includeExcludedBom = !m_argParser.get( ARG_NO_VIRTUAL ); + step->m_includeUnspecified = !m_argParser.get( ARG_NO_UNSPECIFIED ); + step->m_includeDNP = !m_argParser.get( ARG_NO_DNP ); step->m_substModels = m_argParser.get( ARG_SUBST_MODELS ); step->m_overwrite = m_argParser.get( ARG_FORCE ); step->m_filename = FROM_UTF8( m_argParser.get( ARG_INPUT ).c_str() ); diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index 892fd62672..df18be4f29 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -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" ) ); @@ -471,4 +483,4 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) DIALOG_EXPORT_STEP_LOG* log = new DIALOG_EXPORT_STEP_LOG( this, cmdK2S ); log->ShowModal(); Close(); -} \ No newline at end of file +} diff --git a/pcbnew/dialogs/dialog_export_step_base.cpp b/pcbnew/dialogs/dialog_export_step_base.cpp index bfede9a5c7..f92ef93f1e 100644 --- a/pcbnew/dialogs/dialog_export_step_base.cpp +++ b/pcbnew/dialogs/dialog_export_step_base.cpp @@ -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") ); diff --git a/pcbnew/dialogs/dialog_export_step_base.fbp b/pcbnew/dialogs/dialog_export_step_base.fbp index 0c601d3d3c..e480e5daa7 100644 --- a/pcbnew/dialogs/dialog_export_step_base.fbp +++ b/pcbnew/dialogs/dialog_export_step_base.fbp @@ -36,7 +36,6 @@ wxBOTH 1 - 0 1 impl_virtual @@ -96,7 +95,6 @@ Dock 0 Left - 0 1 1 @@ -158,7 +156,6 @@ Dock 0 Left - 0 1 1 @@ -247,7 +244,6 @@ Dock 0 Left - 0 1 1 @@ -312,7 +308,6 @@ Dock 0 Left - 0 1 1 @@ -377,7 +372,6 @@ Dock 0 Left - 0 1 1 @@ -442,7 +436,6 @@ Dock 0 Left - 0 1 1 @@ -537,7 +530,6 @@ Dock 0 Left - 0 1 1 @@ -600,7 +592,6 @@ Dock 0 Left - 0 1 1 @@ -665,7 +656,6 @@ Dock 0 Left - 0 1 1 @@ -727,7 +717,6 @@ Dock 0 Left - 0 1 1 @@ -793,7 +782,6 @@ Dock 0 Left - 0 1 1 @@ -855,7 +843,6 @@ Dock 0 Left - 0 1 1 @@ -938,7 +925,6 @@ Dock 0 Left - 0 1 1 @@ -946,7 +932,7 @@ 0 0 wxID_ANY - Ignore not mounted components + Ignore 'Do not populate' components 0 @@ -954,7 +940,7 @@ 0 1 - m_cbRemoveVirtual + m_cbRemoveDNP 1 @@ -967,7 +953,71 @@ 0 - Do not show components not in BOM and not in place file + Do not show components marked 'Do not populate' + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ignore 'Unspecified' components + + 0 + + + 0 + + 1 + m_cbRemoveUnspecified + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Do not show components with Footprint Type 'Unspecified' wxFILTER_NONE wxDefaultValidator @@ -1003,7 +1053,6 @@ Dock 0 Left - 0 1 1 @@ -1068,7 +1117,6 @@ Dock 0 Left - 0 1 1 @@ -1133,7 +1181,6 @@ Dock 0 Left - 0 1 1 @@ -1197,7 +1244,6 @@ Dock 0 Left - 0 1 1 @@ -1260,7 +1306,6 @@ Dock 0 Left - 0 1 1 diff --git a/pcbnew/dialogs/dialog_export_step_base.h b/pcbnew/dialogs/dialog_export_step_base.h index db93047e53..37ce7f890a 100644 --- a/pcbnew/dialogs/dialog_export_step_base.h +++ b/pcbnew/dialogs/dialog_export_step_base.h @@ -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; diff --git a/pcbnew/exporters/step/exporter_step.cpp b/pcbnew/exporters/step/exporter_step.cpp index 742faadc04..4c18d7c180 100644 --- a/pcbnew/exporters/step/exporter_step.cpp +++ b/pcbnew/exporters/step/exporter_step.cpp @@ -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; } diff --git a/pcbnew/exporters/step/exporter_step.h b/pcbnew/exporters/step/exporter_step.h index 11eefa0402..b0ce49a9ec 100644 --- a/pcbnew/exporters/step/exporter_step.h +++ b/pcbnew/exporters/step/exporter_step.h @@ -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; @@ -119,4 +121,4 @@ private: KIGFX::COLOR4D m_copperColor; }; -#endif \ No newline at end of file +#endif diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index ad378c6187..4a27f27d60 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -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; diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 42215b19d6..51261fa7d1 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -334,8 +334,11 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_params.emplace_back( new PARAM( "export_step.origin_y", &m_ExportStep.origin_y, 0 ) ); - m_params.emplace_back( new PARAM( "export_step.no_virtual", - &m_ExportStep.no_virtual, false ) ); + m_params.emplace_back( new PARAM( "export_step.no_unspecified", + &m_ExportStep.no_unspecified, false ) ); + + m_params.emplace_back( new PARAM( "export_step.no_dnp", + &m_ExportStep.no_dnp, false ) ); m_params.emplace_back( new PARAM( "export_step.replace_models", &m_ExportStep.replace_models, true ) ); diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h index 2d490574ff..0629fdfd15 100644 --- a/pcbnew/pcbnew_settings.h +++ b/pcbnew/pcbnew_settings.h @@ -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; };