diff --git a/pcbnew/dialogs/dialog_export_idf.cpp b/pcbnew/dialogs/dialog_export_idf.cpp
index 5e6de084e3..039673d183 100644
--- a/pcbnew/dialogs/dialog_export_idf.cpp
+++ b/pcbnew/dialogs/dialog_export_idf.cpp
@@ -57,6 +57,9 @@ public:
m_XRef = cfg->m_ExportIdf.ref_x;
m_YRef = cfg->m_ExportIdf.ref_y;
+ m_cbRemoveUnspecified->SetValue( cfg->m_ExportIdf.no_unspecified );
+ m_cbRemoveDNP->SetValue( cfg->m_ExportIdf.no_dnp );
+
m_cbAutoAdjustOffset->SetValue( m_AutoAdjust );
m_cbAutoAdjustOffset->Bind( wxEVT_CHECKBOX, &DIALOG_EXPORT_IDF3::OnAutoAdjustOffset, this );
@@ -109,6 +112,9 @@ public:
cfg->m_ExportIdf.ref_units = m_RefUnits;
cfg->m_ExportIdf.ref_x = m_XRef;
cfg->m_ExportIdf.ref_y = m_YRef;
+
+ cfg->m_ExportIdf.no_unspecified = m_cbRemoveUnspecified->GetValue();
+ cfg->m_ExportIdf.no_dnp = m_cbRemoveDNP->GetValue();
}
}
@@ -137,6 +143,16 @@ public:
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_IDF_Yref->GetValue() );
}
+ bool GetNoUnspecifiedOption()
+ {
+ return m_cbRemoveUnspecified->GetValue();
+ }
+
+ bool GetNoDNPOption()
+ {
+ return m_cbRemoveDNP->GetValue();
+ }
+
bool GetAutoAdjustOffset()
{
return m_cbAutoAdjustOffset->GetValue();
@@ -230,7 +246,8 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event )
wxString fullFilename = dlg.FilePicker()->GetPath();
SetLastPath( LAST_PATH_IDF, fullFilename );
- if( !Export_IDF3( GetBoard(), fullFilename, thou, aXRef, aYRef ) )
+ if( !Export_IDF3( GetBoard(), fullFilename, thou, aXRef, aYRef, !dlg.GetNoUnspecifiedOption(),
+ !dlg.GetNoDNPOption() ) )
{
wxString msg = wxString::Format( _( "Failed to create file '%s'." ), fullFilename );
wxMessageBox( msg );
diff --git a/pcbnew/dialogs/dialog_export_idf_base.cpp b/pcbnew/dialogs/dialog_export_idf_base.cpp
index b7f8d952f1..8cea211cb3 100644
--- a/pcbnew/dialogs/dialog_export_idf_base.cpp
+++ b/pcbnew/dialogs/dialog_export_idf_base.cpp
@@ -105,8 +105,17 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
m_rbUnitSelection->SetSelection( 0 );
bSizer2->Add( m_rbUnitSelection, 0, wxALL, 5 );
+ wxStaticBoxSizer* sbOtherOptions;
+ sbOtherOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Other Options") ), wxVERTICAL );
- bSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
+ m_cbRemoveDNP = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Ignore 'Do not populate' components"), wxDefaultPosition, wxDefaultSize, 0 );
+ sbOtherOptions->Add( m_cbRemoveDNP, 0, wxALL, 5 );
+
+ m_cbRemoveUnspecified = new wxCheckBox( sbOtherOptions->GetStaticBox(), wxID_ANY, _("Ignore 'Unspecified' components"), wxDefaultPosition, wxDefaultSize, 0 );
+ sbOtherOptions->Add( m_cbRemoveUnspecified, 0, wxALL, 5 );
+
+
+ bSizer2->Add( sbOtherOptions, 1, wxEXPAND|wxLEFT|wxRIGHT, 10 );
bSizerIDFFile->Add( bSizer2, 1, wxEXPAND, 5 );
diff --git a/pcbnew/dialogs/dialog_export_idf_base.fbp b/pcbnew/dialogs/dialog_export_idf_base.fbp
index a584165e97..20eb9563fc 100644
--- a/pcbnew/dialogs/dialog_export_idf_base.fbp
+++ b/pcbnew/dialogs/dialog_export_idf_base.fbp
@@ -1,71 +1,354 @@
-
+
-
-
diff --git a/pcbnew/dialogs/dialog_export_idf_base.h b/pcbnew/dialogs/dialog_export_idf_base.h
index 1b63131979..6192c29d4c 100644
--- a/pcbnew/dialogs/dialog_export_idf_base.h
+++ b/pcbnew/dialogs/dialog_export_idf_base.h
@@ -26,6 +26,7 @@ class TEXT_CTRL_EVAL;
#include
#include
#include
+#include
#include
#include
@@ -50,6 +51,8 @@ class DIALOG_EXPORT_IDF3_BASE : public DIALOG_SHIM
wxStaticText* m_staticText4;
TEXT_CTRL_EVAL* m_IDF_Yref;
wxRadioBox* m_rbUnitSelection;
+ wxCheckBox* m_cbRemoveDNP;
+ wxCheckBox* m_cbRemoveUnspecified;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp
index e983b645c0..a6cb6fc29c 100644
--- a/pcbnew/exporters/export_idf.cpp
+++ b/pcbnew/exporters/export_idf.cpp
@@ -269,7 +269,8 @@ UseBoundingBox:
* BOARD_OUTLINE section as appropriate, Compiles data for the PLACEMENT section and compiles
* data for the library ELECTRICAL section.
*/
-static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD& aIDFBoard )
+static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD& aIDFBoard,
+ bool aIncludeUnspecified, bool aIncludeDNP )
{
// Reference Designator
std::string crefdes = TO_UTF8( aFootprint->Reference().GetShownText( false ) );
@@ -412,6 +413,12 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
}
}
+ if( ( !(aFootprint->GetAttributes() & (FP_THROUGH_HOLE|FP_SMD)) ) && !aIncludeUnspecified )
+ return;
+
+ if( aFootprint->IsDNP() && !aIncludeDNP )
+ return;
+
// add any valid models to the library item list
std::string refdes;
@@ -599,7 +606,8 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
* PCB design.
*/
bool PCB_EDIT_FRAME::Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
- bool aUseThou, double aXRef, double aYRef )
+ bool aUseThou, double aXRef, double aYRef,
+ bool aIncludeUnspecified, bool aIncludeDNP )
{
IDF3_BOARD idfBoard( IDF3::CAD_ELEC );
@@ -645,7 +653,7 @@ bool PCB_EDIT_FRAME::Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
// Output the drill holes and footprint (library) data.
for( FOOTPRINT* footprint : aPcb->Footprints() )
- idf_export_footprint( aPcb, footprint, idfBoard );
+ idf_export_footprint( aPcb, footprint, idfBoard, aIncludeUnspecified, aIncludeDNP );
if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) )
{
diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h
index 8c11767328..1364f0e957 100644
--- a/pcbnew/pcb_edit_frame.h
+++ b/pcbnew/pcb_edit_frame.h
@@ -525,10 +525,13 @@ public:
* @param aUseThou set to true if the desired IDF unit is thou (mil).
* @param aXRef the board Reference Point in mm, X value.
* @param aYRef the board Reference Point in mm, Y value.
+ * @param aIncludeUnspecified true to include unspecified-type footprint models
+ * @param aIncludeDNP true to include DNP footprint models
* @return true if OK.
*/
bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
- bool aUseThou, double aXRef, double aYRef );
+ bool aUseThou, double aXRef, double aYRef,
+ bool aIncludeUnspecified, bool aIncludeDNP );
/**
* Export the current BOARD to a STEP assembly.
diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h
index 03e6d5cb91..ff5b858877 100644
--- a/pcbnew/pcbnew_settings.h
+++ b/pcbnew/pcbnew_settings.h
@@ -176,6 +176,8 @@ public:
double ref_x;
double ref_y;
bool units_mils;
+ bool no_unspecified;
+ bool no_dnp;
};
struct DIALOG_EXPORT_STEP