From e7db43285fe1e25f9549f31bb9144972b2bfb774 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 26 Aug 2020 22:43:38 +0100 Subject: [PATCH] ADDED new footprint fabrication attributes. This commit also adds mapping of the new symbol properties "exclude from BOM" and "exclude from board" to be correctly handled in Update Board from Schematic. Fixes https://gitlab.com/kicad/code/kicad/issues/2399 Fixes https://gitlab.com/kicad/code/kicad/issues/4643 Fixes https://gitlab.com/kicad/code/kicad/issues/2233 --- 3d-viewer/3d_canvas/board_adapter.cpp | 17 +- common/pcb.keywords | 4 + .../netlist_exporter_generic.cpp | 72 ++- .../netlist_exporter_generic.h | 8 +- .../netlist_exporter_kicad.h | 4 +- pcbnew/class_module.cpp | 41 +- pcbnew/class_module.h | 61 ++- pcbnew/dialogs/dialog_board_statistics.cpp | 22 +- .../dialog_edit_footprint_for_BoardEditor.cpp | 62 +-- ...og_edit_footprint_for_BoardEditor_base.cpp | 41 +- ...og_edit_footprint_for_BoardEditor_base.fbp | 414 +++++++++++++++--- ...alog_edit_footprint_for_BoardEditor_base.h | 7 +- .../dialog_edit_footprint_for_fp_editor.cpp | 62 +-- ...alog_edit_footprint_for_fp_editor_base.cpp | 37 +- ...alog_edit_footprint_for_fp_editor_base.fbp | 396 ++++++++++++++--- ...dialog_edit_footprint_for_fp_editor_base.h | 9 +- pcbnew/dialogs/dialog_exchange_footprints.cpp | 18 +- .../dialog_exchange_footprints_base.cpp | 5 +- .../dialog_exchange_footprints_base.fbp | 68 ++- .../dialogs/dialog_exchange_footprints_base.h | 3 +- ...ialog_gen_footprint_position_file_base.cpp | 8 +- ...ialog_gen_footprint_position_file_base.fbp | 6 +- .../dialog_gen_footprint_position_file_base.h | 4 +- pcbnew/dialogs/dialog_netlist.cpp | 1 - pcbnew/dialogs/dialog_netlist_base.cpp | 8 +- pcbnew/dialogs/dialog_netlist_base.fbp | 10 +- pcbnew/dialogs/dialog_update_pcb.cpp | 1 - .../exporters/export_footprints_placefile.cpp | 43 +- .../exporters/export_footprints_placefile.h | 31 +- pcbnew/exporters/export_gencad.cpp | 45 +- pcbnew/exporters/gen_footprints_placefile.cpp | 45 +- pcbnew/exporters/gerber_placefile_writer.cpp | 17 +- pcbnew/kicad_plugin.cpp | 17 +- pcbnew/kicad_plugin.h | 3 +- pcbnew/legacy_plugin.cpp | 11 +- pcbnew/microwave/microwave_inductor.cpp | 2 +- .../netlist_reader/board_netlist_updater.cpp | 65 ++- pcbnew/netlist_reader/netlist.cpp | 29 +- pcbnew/netlist_reader/pcb_netlist.h | 26 +- pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp | 2 - pcbnew/pcb_edit_frame.h | 4 +- pcbnew/pcb_parser.cpp | 36 +- 42 files changed, 1225 insertions(+), 540 deletions(-) diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index 59eda07bf1..ef557f1034 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -227,17 +227,12 @@ void BOARD_ADAPTER::SetFlag( DISPLAY3D_FLG aFlag, bool aState ) bool BOARD_ADAPTER::ShouldModuleBeDisplayed( MODULE_ATTR_T aModuleAttributs ) const { - if( ( ( aModuleAttributs == MOD_DEFAULT ) && - GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) ) || - ( ( ( aModuleAttributs & MOD_CMS) == MOD_CMS ) && - GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) ) || - ( ( ( aModuleAttributs & MOD_VIRTUAL) == MOD_VIRTUAL ) && - GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) ) ) - { - return true; - } - - return false; + if( aModuleAttributs & MOD_SMD ) + return GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ); + else if( aModuleAttributs & MOD_THROUGH_HOLE ) + return GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ); + else + return GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ); } diff --git a/common/pcb.keywords b/common/pcb.keywords index b68405aac9..bd598fe394 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -44,6 +44,7 @@ aux_axis_origin bevelled blind blind_buried_vias_allowed +board_only bold bottom bottom_left @@ -90,6 +91,8 @@ edge_width effects end epsilon_r +exclude_from_pos_files +exclude_from_bom fab_layers_line_width fab_layers_text_dims feature1 @@ -239,6 +242,7 @@ thermal_width thermal_gap thermal_bridge_width thickness +through_hole through_hole_min top top_left diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.cpp b/eeschema/netlist_exporters/netlist_exporter_generic.cpp index c53e9aac99..5c83d209af 100644 --- a/eeschema/netlist_exporters/netlist_exporter_generic.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_generic.cpp @@ -37,7 +37,7 @@ static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 ); bool NETLIST_EXPORTER_GENERIC::WriteNetlist( const wxString& aOutFileName, - unsigned aNetlistOptions ) + unsigned aNetlistOptions ) { // output the XML format netlist. wxXmlDocument xdoc; @@ -87,7 +87,7 @@ struct COMP_FIELDS void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT* comp, - SCH_SHEET_PATH* aSheet ) + SCH_SHEET_PATH* aSheet ) { COMP_FIELDS fields; @@ -123,15 +123,30 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT* // field value) if( !comp2->GetField( VALUE )->IsVoid() && ( unit < minUnit || fields.value.IsEmpty() ) ) - fields.value = comp2->GetField( VALUE )->GetShownText(); + { + if( m_resolveTextVars ) + fields.value = comp2->GetField( VALUE )->GetShownText(); + else + fields.value = comp2->GetField( VALUE )->GetText(); + } if( !comp2->GetField( FOOTPRINT )->IsVoid() && ( unit < minUnit || fields.footprint.IsEmpty() ) ) - fields.footprint = comp2->GetField( FOOTPRINT )->GetShownText(); + { + if( m_resolveTextVars ) + fields.footprint = comp2->GetField( FOOTPRINT )->GetShownText(); + else + fields.footprint = comp2->GetField( FOOTPRINT )->GetText(); + } if( !comp2->GetField( DATASHEET )->IsVoid() && ( unit < minUnit || fields.datasheet.IsEmpty() ) ) - fields.datasheet = comp2->GetField( DATASHEET )->GetShownText(); + { + if( m_resolveTextVars ) + fields.datasheet = comp2->GetField( DATASHEET )->GetShownText(); + else + fields.datasheet = comp2->GetField( DATASHEET )->GetText(); + } for( int fldNdx = MANDATORY_FIELDS; fldNdx < comp2->GetFieldCount(); ++fldNdx ) { @@ -140,7 +155,10 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT* if( f->GetText().size() && ( unit < minUnit || fields.f.count( f->GetName() ) == 0 ) ) { - fields.f[ f->GetName() ] = f->GetShownText(); + if( m_resolveTextVars ) + fields.f[ f->GetName() ] = f->GetShownText(); + else + fields.f[ f->GetName() ] = f->GetText(); } } @@ -150,16 +168,32 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT* } else { - fields.value = comp->GetField( VALUE )->GetShownText(); - fields.footprint = comp->GetField( FOOTPRINT )->GetShownText(); - fields.datasheet = comp->GetField( DATASHEET )->GetShownText(); + if( m_resolveTextVars ) + fields.value = comp->GetField( VALUE )->GetShownText(); + else + fields.value = comp->GetField( VALUE )->GetText(); + + if( m_resolveTextVars ) + fields.footprint = comp->GetField( FOOTPRINT )->GetShownText(); + else + fields.footprint = comp->GetField( FOOTPRINT )->GetText(); + + if( m_resolveTextVars ) + fields.datasheet = comp->GetField( DATASHEET )->GetShownText(); + else + fields.datasheet = comp->GetField( DATASHEET )->GetText(); for( int fldNdx = MANDATORY_FIELDS; fldNdx < comp->GetFieldCount(); ++fldNdx ) { SCH_FIELD* f = comp->GetField( fldNdx ); if( f->GetText().size() ) - fields.f[ f->GetName() ] = f->GetShownText(); + { + if( m_resolveTextVars ) + fields.f[ f->GetName() ] = f->GetShownText(); + else + fields.f[ f->GetName() ] = f->GetText(); + } } } @@ -265,26 +299,36 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeComponents( unsigned aCtl ) xlibsource->AddAttribute( "description", comp->GetDescription() ); + XNODE* xproperty; + std::vector& fields = comp->GetFields(); for( size_t jj = MANDATORY_FIELDS; jj < fields.size(); ++jj ) { - XNODE* xproperty; xcomp->AddChild( xproperty = node( "property" ) ); - xproperty->AddAttribute( "name", fields[jj].GetName() ); xproperty->AddAttribute( "value", fields[jj].GetText() ); } for( const SCH_FIELD& sheetField : sheet.Last()->GetFields() ) { - XNODE* xproperty; xcomp->AddChild( xproperty = node( "property" ) ); - xproperty->AddAttribute( "name", sheetField.GetName() ); xproperty->AddAttribute( "value", sheetField.GetText() ); } + if( !comp->GetIncludeInBom() ) + { + xcomp->AddChild( xproperty = node( "property" ) ); + xproperty->AddAttribute( "name", "exclude_from_bom" ); + } + + if( !comp->GetIncludeOnBoard() ) + { + xcomp->AddChild( xproperty = node( "property" ) ); + xproperty->AddAttribute( "name", "exclude_from_board" ); + } + XNODE* xsheetpath; xcomp->AddChild( xsheetpath = node( "sheetpath" ) ); diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.h b/eeschema/netlist_exporters/netlist_exporter_generic.h index 6b24adf436..4d69f44a23 100644 --- a/eeschema/netlist_exporters/netlist_exporter_generic.h +++ b/eeschema/netlist_exporters/netlist_exporter_generic.h @@ -62,11 +62,15 @@ enum GNL_T class NETLIST_EXPORTER_GENERIC : public NETLIST_EXPORTER { private: - std::set< wxString > m_libraries; ///< Set of library nicknames. + std::set m_libraries; // Set of library nicknames. + +protected: + bool m_resolveTextVars; // Export textVar references resolved public: NETLIST_EXPORTER_GENERIC( SCHEMATIC* aSchematic ) : - NETLIST_EXPORTER( aSchematic ) + NETLIST_EXPORTER( aSchematic ), + m_resolveTextVars( true ) {} /** diff --git a/eeschema/netlist_exporters/netlist_exporter_kicad.h b/eeschema/netlist_exporters/netlist_exporter_kicad.h index 2335ef71af..c59dc93804 100644 --- a/eeschema/netlist_exporters/netlist_exporter_kicad.h +++ b/eeschema/netlist_exporters/netlist_exporter_kicad.h @@ -39,7 +39,9 @@ class NETLIST_EXPORTER_KICAD : public NETLIST_EXPORTER_GENERIC public: NETLIST_EXPORTER_KICAD( SCHEMATIC* aSchematic ) : NETLIST_EXPORTER_GENERIC( aSchematic ) - {} + { + m_resolveTextVars = false; + } /** * Write netlist to \a aOutFileName. diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 2e5567870c..79da8fff86 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -40,7 +40,7 @@ MODULE::MODULE( BOARD* parent ) : BOARD_ITEM_CONTAINER( (BOARD_ITEM*) parent, PCB_MODULE_T ), m_initial_comments( 0 ) { - m_Attributs = MOD_DEFAULT; + m_Attributs = 0; m_Layer = F_Cu; m_Orient = 0; m_ModuleStatus = MODULE_PADS_LOCKED; @@ -673,26 +673,33 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorIsEmpty() ) + *aStr += wxT( ", " ); + + *aStr += aAttr; + }; + + wxString status; + wxString attrs; if( IsLocked() ) - msg[0] = 'L'; + addToken( &status, _( "locked" ) ); if( m_ModuleStatus & MODULE_is_PLACED ) - msg[2] = 'P'; + addToken( &status, _( "autoplaced" ) ); - aList.emplace_back( _( "Status" ), msg, MAGENTA ); + if( m_Attributs & MOD_BOARD_ONLY ) + addToken( &attrs, _( "not in schematic" ) ); - // Controls on right side of the dialog - switch( m_Attributs & 255 ) - { - case 0: msg = _( "Normal" ); break; - case MOD_CMS: msg = _( "Insert" ); break; - case MOD_VIRTUAL: msg = _( "Virtual" ); break; - default: msg = wxT( "???" ); break; - } + if( m_Attributs & MOD_EXCLUDE_FROM_POS_FILES ) + addToken( &attrs, _( "exclude from pos files" ) ); + + if( m_Attributs * MOD_EXCLUDE_FROM_BOM ) + addToken( &attrs, _( "exclude from BOM" ) ); - aList.emplace_back( _( "Attributes" ), msg, BROWN ); + aList.emplace_back( _( "Status: " ) + status, _( "Attributes: " ) + attrs, BROWN ); msg.Printf( "%.2f", GetOrientationDegrees() ); aList.emplace_back( _( "Rotation" ), msg, BROWN ); @@ -1634,11 +1641,9 @@ void MODULE::SwapData( BOARD_ITEM* aImage ) } -bool MODULE::HasNonSMDPins() const +bool MODULE::HasThroughHolePads() const { - // returns true if the given module has at lesat one non smd pin, such as through hole - - for( auto pad : Pads() ) + for( D_PAD* pad : Pads() ) { if( pad->GetAttribute() != PAD_ATTRIB_SMD ) return true; diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 8c3623894a..b9f33393f7 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -64,37 +64,37 @@ enum INCLUDE_NPTH_T */ enum MODULE_ATTR_T { - MOD_DEFAULT = 0, ///< default - MOD_CMS = 1, ///< Set for modules listed in the automatic insertion list - ///< (usually SMD footprints) - MOD_VIRTUAL = 2 ///< Virtual component: when created by copper shapes on - ///< board (Like edge card connectors, mounting hole...) + MOD_THROUGH_HOLE = 0x0001, + MOD_SMD = 0x0002, + MOD_EXCLUDE_FROM_POS_FILES = 0x0004, + MOD_EXCLUDE_FROM_BOM = 0x0008, + MOD_BOARD_ONLY = 0x0010 // Footprint has no corresponding symbol }; class MODULE_3D_SETTINGS { - public: - MODULE_3D_SETTINGS() : - // Initialize with sensible values - m_Scale { 1, 1, 1 }, - m_Rotation { 0, 0, 0 }, - m_Offset { 0, 0, 0 }, - m_Opacity( 1.0 ), - m_Show( true ) - { - } - - struct VECTOR3D - { - double x, y, z; - }; - - VECTOR3D m_Scale; ///< 3D model scaling factor (dimensionless) - VECTOR3D m_Rotation; ///< 3D model rotation (degrees) - VECTOR3D m_Offset; ///< 3D model offset (mm) - double m_Opacity; - wxString m_Filename; ///< The 3D shape filename in 3D library - bool m_Show; ///< Include module in rendering +public: + MODULE_3D_SETTINGS() : + // Initialize with sensible values + m_Scale { 1, 1, 1 }, + m_Rotation { 0, 0, 0 }, + m_Offset { 0, 0, 0 }, + m_Opacity( 1.0 ), + m_Show( true ) + { + } + + struct VECTOR3D + { + double x, y, z; + }; + + VECTOR3D m_Scale; ///< 3D model scaling factor (dimensionless) + VECTOR3D m_Rotation; ///< 3D model rotation (degrees) + VECTOR3D m_Offset; ///< 3D model offset (mm) + double m_Opacity; + wxString m_Filename; ///< The 3D shape filename in 3D library + bool m_Show; ///< Include module in rendering }; DECL_DEQ_FOR_SWIG( PADS, D_PAD* ) @@ -201,12 +201,7 @@ public: return m_fp_zones; } - /** - * @return true if the given module has any non smd pins, such as through hole - * and therefore cannot be placed automatically. - * Used in Pick and Place files writers - */ - bool HasNonSMDPins() const; + bool HasThroughHolePads() const; std::list& Models() { return m_3D_Drawings; } const std::list& Models() const { return m_3D_Drawings; } diff --git a/pcbnew/dialogs/dialog_board_statistics.cpp b/pcbnew/dialogs/dialog_board_statistics.cpp index 67435e8c05..982cf05aec 100644 --- a/pcbnew/dialogs/dialog_board_statistics.cpp +++ b/pcbnew/dialogs/dialog_board_statistics.cpp @@ -132,9 +132,8 @@ void DIALOG_BOARD_STATISTICS::refreshItemsTypes() // If you need some more types to be shown, simply add them to the // corresponding list - m_componentsTypes.push_back( componentsType_t( MOD_DEFAULT, _( "THT:" ) ) ); - m_componentsTypes.push_back( componentsType_t( MOD_CMS, _( "SMD:" ) ) ); - m_componentsTypes.push_back( componentsType_t( MOD_VIRTUAL, _( "Virtual:" ) ) ); + m_componentsTypes.push_back( componentsType_t( MOD_THROUGH_HOLE, _( "THT:" ) ) ); + m_componentsTypes.push_back( componentsType_t( MOD_SMD, _( "SMD:" ) ) ); m_padsTypes.clear(); m_padsTypes.push_back( padsType_t( PAD_ATTRIB_STANDARD, _( "Through hole:" ) ) ); @@ -177,21 +176,19 @@ bool DIALOG_BOARD_STATISTICS::TransferDataToWindow() void DIALOG_BOARD_STATISTICS::getDataFromPCB() { - auto board = m_parentFrame->GetBoard(); + BOARD* board = m_parentFrame->GetBoard(); // Get modules and pads count for( MODULE* module : board->Modules() ) { - auto& pads = module->Pads(); - // Do not proceed modules with no pads if checkbox checked - if( m_checkBoxExcludeComponentsNoPins->GetValue() && !pads.size() ) + if( m_checkBoxExcludeComponentsNoPins->GetValue() && ! module->Pads().size() ) continue; // Go through components types list for( auto& type : m_componentsTypes ) { - if( module->GetAttributes() == type.attribute ) + if( ( module->GetAttributes() & type.attribute ) > 0 ) { if( module->IsFlipped() ) type.backSideQty++; @@ -201,7 +198,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB() } } - for( auto& pad : pads ) + for( D_PAD* pad : module->Pads() ) { // Go through pads types list for( auto& type : m_padsTypes ) @@ -254,9 +251,9 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB() } // Get via counts - for( auto& track : board->Tracks() ) + for( TRACK* track : board->Tracks() ) { - if( auto via = dyn_cast( track ) ) + if( VIA* via = dyn_cast( track ) ) { for( auto& type : m_viasTypes ) { @@ -300,7 +297,8 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB() // If board has no Edge Cuts lines, board->GetBoardPolygonOutlines will // return small rectangle, so we double check that bool edgeCutsExists = false; - for( auto& drawing : board->Drawings() ) + + for( BOARD_ITEM* drawing : board->Drawings() ) { if( drawing->GetLayer() == Edge_Cuts ) { diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp index bc5090766e..b1618680a1 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp @@ -299,20 +299,16 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow() m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() ); m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() ); - m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD footprints\n" - "Footprints with this option are not put in the footprint position list file" ) ); - m_AttributsCtrl->SetItemToolTip( 1, _( "Use this attribute for SMD footprints.\n" - "Only footprints with this option are put in the footprint position list file" ) ); - m_AttributsCtrl->SetItemToolTip( 2, _( "Use this attribute for \"virtual\" footprints drawn " - "on board\nsuch as an edge connector (old ISA PC bus for instance)" ) ); - - switch( m_footprint->GetAttributes() & 255 ) - { - case MOD_CMS: m_AttributsCtrl->SetSelection( 1 ); break; - case MOD_VIRTUAL: m_AttributsCtrl->SetSelection( 2 ); break; - case 0: - default: m_AttributsCtrl->SetSelection( 0 ); break; - } + if( m_footprint->GetAttributes() & MOD_THROUGH_HOLE ) + m_componentType->SetSelection( 0 ); + else if( m_footprint->GetAttributes() & MOD_SMD ) + m_componentType->SetSelection( 1 ); + else + m_componentType->SetSelection( 2 ); + + m_boardOnly->SetValue( m_footprint->GetAttributes() & MOD_BOARD_ONLY ); + m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES ); + m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_BOM ); // Local Clearances @@ -677,18 +673,10 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow() switch( m_ZoneConnectionChoice->GetSelection() ) { default: - case 0: - m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED ); - break; - case 1: - m_footprint->SetZoneConnection( ZONE_CONNECTION::FULL ); - break; - case 2: - m_footprint->SetZoneConnection( ZONE_CONNECTION::THERMAL ); - break; - case 3: - m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); - break; + case 0: m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED ); break; + case 1: m_footprint->SetZoneConnection( ZONE_CONNECTION::FULL ); break; + case 2: m_footprint->SetZoneConnection( ZONE_CONNECTION::THERMAL ); break; + case 3: m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); break; } // Set Module Position @@ -697,14 +685,26 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow() m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 2 ); m_footprint->SetPadsLocked( m_AutoPlaceCtrl->GetSelection() == 1 ); - switch( m_AttributsCtrl->GetSelection() ) + int attributes = 0; + + switch( m_componentType->GetSelection() ) { - case 0: m_footprint->SetAttributes( 0 ); break; - case 1: m_footprint->SetAttributes( MOD_CMS ); break; - case 2: m_footprint->SetAttributes( MOD_VIRTUAL ); break; - default: wxFAIL; + case 0: attributes |= MOD_THROUGH_HOLE; break; + case 1: attributes |= MOD_SMD; break; + default: break; } + if( m_boardOnly->GetValue() ) + attributes |= MOD_BOARD_ONLY; + + if( m_excludeFromPosFiles->GetValue() ) + attributes |= MOD_EXCLUDE_FROM_POS_FILES; + + if( m_excludeFromBOM->GetValue() ) + attributes |= MOD_EXCLUDE_FROM_BOM; + + m_footprint->SetAttributes( attributes ); + m_footprint->SetPlacementCost90( m_CostRot90Ctrl->GetValue() ); m_footprint->SetPlacementCost180( m_CostRot180Ctrl->GetValue() ); diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.cpp index 51c30a8956..22ddec69ff 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.cpp @@ -247,7 +247,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow bButtonsSizer = new wxBoxSizer( wxVERTICAL ); m_buttonUpdate = new wxButton( m_PanelGeneral, wxID_ANY, _("Update Footprint from Library..."), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_buttonUpdate, 0, wxALL|wxEXPAND, 5 ); + bButtonsSizer->Add( m_buttonUpdate, 0, wxEXPAND|wxALL, 5 ); m_buttonExchange = new wxButton( m_PanelGeneral, wxID_ANY, _("Change Footprint..."), wxDefaultPosition, wxDefaultSize, 0 ); bButtonsSizer->Add( m_buttonExchange, 0, wxEXPAND|wxALL, 5 ); @@ -256,10 +256,10 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow bButtonsSizer->Add( m_buttonModuleEditor, 0, wxEXPAND|wxALL, 5 ); - bButtonsSizer->Add( 0, 15, 1, wxEXPAND, 5 ); + bButtonsSizer->Add( 0, 10, 0, wxEXPAND, 5 ); m_button5 = new wxButton( m_PanelGeneral, wxID_ANY, _("Edit Library Footprint..."), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_button5, 0, wxALL|wxEXPAND, 5 ); + bButtonsSizer->Add( m_button5, 0, wxEXPAND|wxALL, 5 ); bSizerRight->Add( bButtonsSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -267,11 +267,36 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow bSizerRight->Add( 0, 0, 1, wxEXPAND, 5 ); - wxString m_AttributsCtrlChoices[] = { _("Through hole"), _("Surface mount"), _("Virtual") }; - int m_AttributsCtrlNChoices = sizeof( m_AttributsCtrlChoices ) / sizeof( wxString ); - m_AttributsCtrl = new wxRadioBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes"), wxDefaultPosition, wxDefaultSize, m_AttributsCtrlNChoices, m_AttributsCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_AttributsCtrl->SetSelection( 0 ); - bSizerRight->Add( m_AttributsCtrl, 0, wxALL|wxEXPAND, 5 ); + wxStaticBoxSizer* sbFabSizer; + sbFabSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes") ), wxVERTICAL ); + + wxBoxSizer* bPartTypeSizer; + bPartTypeSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_componentTypeLabel = new wxStaticText( sbFabSizer->GetStaticBox(), wxID_ANY, _("Component:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_componentTypeLabel->Wrap( -1 ); + bPartTypeSizer->Add( m_componentTypeLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_componentTypeChoices[] = { _("Through hole"), _("SMD"), _("Other") }; + int m_componentTypeNChoices = sizeof( m_componentTypeChoices ) / sizeof( wxString ); + m_componentType = new wxChoice( sbFabSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_componentTypeNChoices, m_componentTypeChoices, 0 ); + m_componentType->SetSelection( 0 ); + bPartTypeSizer->Add( m_componentType, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + sbFabSizer->Add( bPartTypeSizer, 1, wxEXPAND, 5 ); + + m_boardOnly = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Not in schematic"), wxDefaultPosition, wxDefaultSize, 0 ); + sbFabSizer->Add( m_boardOnly, 0, wxALL, 5 ); + + m_excludeFromPosFiles = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from position files"), wxDefaultPosition, wxDefaultSize, 0 ); + sbFabSizer->Add( m_excludeFromPosFiles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_excludeFromBOM = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from BOM"), wxDefaultPosition, wxDefaultSize, 0 ); + sbFabSizer->Add( m_excludeFromBOM, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerRight->Add( sbFabSizer, 0, wxEXPAND|wxALL, 5 ); bSizerProperties->Add( bSizerRight, 1, wxEXPAND|wxTOP, 5 ); diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.fbp b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.fbp index e90a3b507b..db5ec6d5fa 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.fbp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.fbp @@ -1831,27 +1831,27 @@ - + 5 wxEXPAND|wxTOP 1 - + bSizerRight wxVERTICAL none - + 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - + bButtonsSizer wxVERTICAL none 5 - wxALL|wxEXPAND + wxEXPAND|wxALL 0 1 @@ -2068,19 +2068,19 @@ EditFootprint - + 5 wxEXPAND - 1 - - 15 + 0 + + 10 protected 0 5 - wxALL|wxEXPAND + wxEXPAND|wxALL 0 1 @@ -2163,70 +2163,346 @@ 0 - + 5 - wxALL|wxEXPAND + wxEXPAND|wxALL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Through hole" "Surface mount" "Virtual" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxID_ANY Fabrication Attributes - 1 - - 0 - - - 0 - 1 - m_AttributsCtrl - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - + sbFabSizer + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 1 + + + bPartTypeSizer + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Component: + 0 + + 0 + + + 0 + + 1 + m_componentTypeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Through hole" "SMD" "Other" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_componentType + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Not in schematic + + 0 + + + 0 + + 1 + m_boardOnly + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from position files + + 0 + + + 0 + + 1 + m_excludeFromPosFiles + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from BOM + + 0 + + + 0 + + 1 + m_excludeFromBOM + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.h b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.h index 5e8e7e04f6..8e60ffd8af 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.h +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor_base.h @@ -34,6 +34,7 @@ class WX_GRID; #include #include #include +#include #include #include #include @@ -83,7 +84,11 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM wxButton* m_buttonExchange; wxButton* m_buttonModuleEditor; wxButton* m_button5; - wxRadioBox* m_AttributsCtrl; + wxStaticText* m_componentTypeLabel; + wxChoice* m_componentType; + wxCheckBox* m_boardOnly; + wxCheckBox* m_excludeFromPosFiles; + wxCheckBox* m_excludeFromBOM; wxPanel* m_PanelClearances; wxStaticText* m_staticTextInfo; wxStaticText* m_staticTextInfoValPos; diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp index 924dbe13a6..75c48cf57b 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp @@ -225,20 +225,16 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow() m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() ); m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() ); - m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD footprints\n" - "Footprints with this option are not put in the footprint position list file" ) ); - m_AttributsCtrl->SetItemToolTip( 1, _( "Use this attribute for SMD footprints.\n" - "Only footprints with this option are put in the footprint position list file" ) ); - m_AttributsCtrl->SetItemToolTip( 2, _( "Use this attribute for \"virtual\" footprints drawn on board\n" - "such as an edge connector (old ISA PC bus for instance)" ) ); - - switch( m_footprint->GetAttributes() & 255 ) - { - case MOD_CMS: m_AttributsCtrl->SetSelection( 1 ); break; - case MOD_VIRTUAL: m_AttributsCtrl->SetSelection( 2 ); break; - case 0: - default: m_AttributsCtrl->SetSelection( 0 ); break; - } + if( m_footprint->GetAttributes() & MOD_THROUGH_HOLE ) + m_componentType->SetSelection( 0 ); + else if( m_footprint->GetAttributes() & MOD_SMD ) + m_componentType->SetSelection( 1 ); + else + m_componentType->SetSelection( 2 ); + + m_boardOnly->SetValue( m_footprint->GetAttributes() & MOD_BOARD_ONLY ); + m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES ); + m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_BOM ); // Local Clearances @@ -640,14 +636,26 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow() m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 ); - switch( m_AttributsCtrl->GetSelection() ) + int attributes = 0; + + switch( m_componentType->GetSelection() ) { - case 0: m_footprint->SetAttributes( 0 ); break; - case 1: m_footprint->SetAttributes( MOD_CMS ); break; - case 2: m_footprint->SetAttributes( MOD_VIRTUAL ); break; - default: wxFAIL; + case 0: attributes |= MOD_THROUGH_HOLE; break; + case 1: attributes |= MOD_SMD; break; + default: break; } + if( m_boardOnly->GetValue() ) + attributes |= MOD_BOARD_ONLY; + + if( m_excludeFromPosFiles->GetValue() ) + attributes |= MOD_EXCLUDE_FROM_POS_FILES; + + if( m_excludeFromBOM->GetValue() ) + attributes |= MOD_EXCLUDE_FROM_BOM; + + m_footprint->SetAttributes( attributes ); + m_footprint->SetPlacementCost90( m_CostRot90Ctrl->GetValue() ); m_footprint->SetPlacementCost180( m_CostRot180Ctrl->GetValue() ); @@ -673,18 +681,10 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow() switch( m_ZoneConnectionChoice->GetSelection() ) { default: - case 0: - m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED ); - break; - case 1: - m_footprint->SetZoneConnection( ZONE_CONNECTION::FULL ); - break; - case 2: - m_footprint->SetZoneConnection( ZONE_CONNECTION::THERMAL ); - break; - case 3: - m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); - break; + case 0: m_footprint->SetZoneConnection( ZONE_CONNECTION::INHERITED ); break; + case 1: m_footprint->SetZoneConnection( ZONE_CONNECTION::FULL ); break; + case 2: m_footprint->SetZoneConnection( ZONE_CONNECTION::THERMAL ); break; + case 3: m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); break; } std::list* draw3D = &m_footprint->Models(); diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp index 996b5e50dd..4c302ec9f5 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.cpp @@ -172,13 +172,38 @@ DIALOG_FOOTPRINT_FP_EDITOR_BASE::DIALOG_FOOTPRINT_FP_EDITOR_BASE( wxWindow* pare m_sizerAP->Add( m_sizerAllow180, 0, wxEXPAND, 5 ); - bSizerProperties->Add( m_sizerAP, 1, wxEXPAND|wxTOP, 5 ); + bSizerProperties->Add( m_sizerAP, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - wxString m_AttributsCtrlChoices[] = { _("Through hole"), _("Surface mount"), _("Virtual") }; - int m_AttributsCtrlNChoices = sizeof( m_AttributsCtrlChoices ) / sizeof( wxString ); - m_AttributsCtrl = new wxRadioBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes"), wxDefaultPosition, wxDefaultSize, m_AttributsCtrlNChoices, m_AttributsCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_AttributsCtrl->SetSelection( 1 ); - bSizerProperties->Add( m_AttributsCtrl, 1, wxTOP|wxRIGHT|wxLEFT, 5 ); + wxStaticBoxSizer* sbFabSizer; + sbFabSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes") ), wxVERTICAL ); + + wxBoxSizer* bPartTypeSizer; + bPartTypeSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_componentTypeLabel = new wxStaticText( sbFabSizer->GetStaticBox(), wxID_ANY, _("Component:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_componentTypeLabel->Wrap( -1 ); + bPartTypeSizer->Add( m_componentTypeLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_componentTypeChoices[] = { _("Through hole"), _("SMD"), _("Other") }; + int m_componentTypeNChoices = sizeof( m_componentTypeChoices ) / sizeof( wxString ); + m_componentType = new wxChoice( sbFabSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_componentTypeNChoices, m_componentTypeChoices, 0 ); + m_componentType->SetSelection( 0 ); + bPartTypeSizer->Add( m_componentType, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + sbFabSizer->Add( bPartTypeSizer, 0, wxEXPAND, 5 ); + + m_boardOnly = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Not in schematic"), wxDefaultPosition, wxDefaultSize, 0 ); + sbFabSizer->Add( m_boardOnly, 0, wxALL, 5 ); + + m_excludeFromPosFiles = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from position files"), wxDefaultPosition, wxDefaultSize, 0 ); + sbFabSizer->Add( m_excludeFromPosFiles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_excludeFromBOM = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from BOM"), wxDefaultPosition, wxDefaultSize, 0 ); + sbFabSizer->Add( m_excludeFromBOM, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerProperties->Add( sbFabSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_PanelPropertiesBoxSizer->Add( bSizerProperties, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp index a36ea0de5f..2b0b7af27b 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.fbp @@ -918,7 +918,7 @@ 5 - wxEXPAND|wxTOP + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 wxID_ANY @@ -1214,70 +1214,346 @@ - + 5 - wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Through hole" "Surface mount" "Virtual" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxID_ANY Fabrication Attributes - 1 - - 0 - - - 0 - 1 - m_AttributsCtrl - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - + sbFabSizer + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 0 + + + bPartTypeSizer + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Component: + 0 + + 0 + + + 0 + + 1 + m_componentTypeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Through hole" "SMD" "Other" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_componentType + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Not in schematic + + 0 + + + 0 + + 1 + m_boardOnly + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from position files + + 0 + + + 0 + + 1 + m_excludeFromPosFiles + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from BOM + + 0 + + + 0 + + 1 + m_excludeFromBOM + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h index 47dcfad6f1..0ecdaa0d1c 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor_base.h @@ -31,8 +31,9 @@ class WX_GRID; #include #include #include -#include #include +#include +#include #include #include @@ -66,7 +67,11 @@ class DIALOG_FOOTPRINT_FP_EDITOR_BASE : public DIALOG_SHIM wxBoxSizer* m_sizerAllow180; wxStaticText* m_allow180Label; wxSlider* m_CostRot180Ctrl; - wxRadioBox* m_AttributsCtrl; + wxStaticText* m_componentTypeLabel; + wxChoice* m_componentType; + wxCheckBox* m_boardOnly; + wxCheckBox* m_excludeFromPosFiles; + wxCheckBox* m_excludeFromBOM; wxPanel* m_PanelClearances; wxStaticText* m_staticTextInfo; wxStaticText* m_staticTextInfoValPos; diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 7f7346df21..ebf70cc402 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -51,10 +51,11 @@ int g_matchModeForUpdateSelected = ID_MATCH_FP_SELECTED; int g_matchModeForExchange = ID_MATCH_FP_REF; int g_matchModeForExchangeSelected = ID_MATCH_FP_SELECTED; -bool g_removeExtraTextItems = false; -bool g_resetTextItemLayers = false; -bool g_resetTextItemEffects = false; -bool g_reset3DModels = false; +bool g_removeExtraTextItems = false; +bool g_resetTextItemLayers = false; +bool g_resetTextItemEffects = false; +bool g_resetFabricationAttrs = false; +bool g_reset3DModels = false; DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aModule, @@ -139,6 +140,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, m_removeExtraBox->SetValue( g_removeExtraTextItems ); m_resetTextItemLayers->SetValue( g_resetTextItemLayers ); m_resetTextItemEffects->SetValue( g_resetTextItemEffects ); + m_resetFabricationAttrs->SetValue( g_resetFabricationAttrs ); m_reset3DModels->SetValue( g_reset3DModels ); m_MessageWindow->SetLazyUpdate( true ); @@ -163,6 +165,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::~DIALOG_EXCHANGE_FOOTPRINTS() g_removeExtraTextItems = m_removeExtraBox->GetValue(); g_resetTextItemLayers = m_resetTextItemLayers->GetValue(); g_resetTextItemEffects = m_resetTextItemEffects->GetValue(); + g_resetFabricationAttrs = m_resetFabricationAttrs->GetValue(); g_reset3DModels = m_reset3DModels->GetValue(); } @@ -374,6 +377,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processModule( MODULE* aModule, const LIB_ID& a m_removeExtraBox->GetValue(), m_resetTextItemLayers->GetValue(), m_resetTextItemEffects->GetValue(), + m_resetFabricationAttrs->GetValue(), m_reset3DModels->GetValue() ); if( aModule == m_currentModule ) @@ -458,7 +462,8 @@ TEXTE_MODULE* getMatchingTextItem( TEXTE_MODULE* aRefItem, MODULE* aModule ) void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& aCommit, bool deleteExtraTexts, bool resetTextLayers, - bool resetTextEffects, bool reset3DModels ) + bool resetTextEffects, bool resetFabricationAttrs, + bool reset3DModels ) { aDest->SetParent( GetBoard() ); @@ -517,6 +522,9 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& } } + if( !resetFabricationAttrs ) + aDest->SetAttributes( aSrc->GetAttributes() ); + // Copy 3D model settings in accordance with the reset* flag if( !reset3DModels ) aDest->Models() = aSrc->Models(); // Linked list of 3D models. diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp index 7e880ab5d4..4eaa71f3fe 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -104,6 +104,9 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare m_resetTextItemEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset text sizes, styles and positions"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_resetTextItemEffects, 0, wxBOTTOM|wxRIGHT, 5 ); + m_resetFabricationAttrs = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset fabrication attributes"), wxDefaultPosition, wxDefaultSize, 0 ); + m_updateOptionsSizer->Add( m_resetFabricationAttrs, 0, wxBOTTOM|wxRIGHT, 5 ); + m_reset3DModels = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset 3D models"), wxDefaultPosition, wxDefaultSize, 0 ); m_updateOptionsSizer->Add( m_reset3DModels, 0, wxBOTTOM|wxRIGHT, 5 ); diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp index 21d2dae68f..ea930c18b4 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp @@ -14,7 +14,6 @@ dialog_exchange_footprints_base 4200 none - 1 dialog_exchange_footprints_base @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -644,7 +642,6 @@ - 0 @@ -921,7 +918,6 @@ - 0 @@ -1190,6 +1186,70 @@ + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Reset fabrication attributes + + 0 + + + 0 + + 1 + m_resetFabricationAttrs + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxBOTTOM|wxRIGHT diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.h b/pcbnew/dialogs/dialog_exchange_footprints_base.h index 87d74b24dc..b469ced655 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints_base.h +++ b/pcbnew/dialogs/dialog_exchange_footprints_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -63,6 +63,7 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM wxCheckBox* m_removeExtraBox; wxCheckBox* m_resetTextItemLayers; wxCheckBox* m_resetTextItemEffects; + wxCheckBox* m_resetFabricationAttrs; wxCheckBox* m_reset3DModels; WX_HTML_REPORT_PANEL* m_MessageWindow; wxStdDialogButtonSizer* m_sdbSizer; diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp index d462e529fb..1ad15aade8 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.cpp @@ -73,8 +73,8 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow wxBoxSizer* bSizerLower; bSizerLower = new wxBoxSizer( wxVERTICAL ); - m_forceSMDOpt = new wxCheckBox( this, wxID_ANY, _("Include footprints with SMD pads even if not marked Surface Mount"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerLower->Add( m_forceSMDOpt, 0, wxALL, 5 ); + m_excludeTH = new wxCheckBox( this, wxID_ANY, _("Exclude all footprints with through hole pads"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerLower->Add( m_excludeTH, 0, wxALL, 5 ); m_cbIncludeBoardEdge = new wxCheckBox( this, wxID_ANY, _("Include board edge layer"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerLower->Add( m_cbIncludeBoardEdge, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -110,7 +110,7 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow m_rbFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onSelectFormat ), NULL, this ); m_radioBoxUnits->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIUnits ), NULL, this ); m_radioBoxFilesCount->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIFileOpt ), NULL, this ); - m_forceSMDOpt->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIforceSMDOpt ), NULL, this ); + m_excludeTH->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIExcludeTH ), NULL, this ); m_cbIncludeBoardEdge->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIincludeBoardEdge ), NULL, this ); m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::OnGenerate ), NULL, this ); } @@ -122,7 +122,7 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::~DIALOG_GEN_FOOTPRINT_POSITION_BASE() m_rbFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onSelectFormat ), NULL, this ); m_radioBoxUnits->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIUnits ), NULL, this ); m_radioBoxFilesCount->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIFileOpt ), NULL, this ); - m_forceSMDOpt->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIforceSMDOpt ), NULL, this ); + m_excludeTH->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIExcludeTH ), NULL, this ); m_cbIncludeBoardEdge->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIincludeBoardEdge ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::OnGenerate ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp index cab15b4137..41db1bc567 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.fbp @@ -532,7 +532,7 @@ 0 0 wxID_ANY - Include footprints with SMD pads even if not marked Surface Mount + Exclude all footprints with through hole pads 0 @@ -540,7 +540,7 @@ 0 1 - m_forceSMDOpt + m_excludeTH 1 @@ -561,7 +561,7 @@ - onUpdateUIforceSMDOpt + onUpdateUIExcludeTH diff --git a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h index a3145763bc..d23238913c 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h +++ b/pcbnew/dialogs/dialog_gen_footprint_position_file_base.h @@ -49,7 +49,7 @@ class DIALOG_GEN_FOOTPRINT_POSITION_BASE : public DIALOG_SHIM wxRadioBox* m_rbFormat; wxRadioBox* m_radioBoxUnits; wxRadioBox* m_radioBoxFilesCount; - wxCheckBox* m_forceSMDOpt; + wxCheckBox* m_excludeTH; wxCheckBox* m_cbIncludeBoardEdge; WX_HTML_REPORT_PANEL* m_messagesPanel; wxStaticLine* m_staticline; @@ -62,7 +62,7 @@ class DIALOG_GEN_FOOTPRINT_POSITION_BASE : public DIALOG_SHIM virtual void onSelectFormat( wxCommandEvent& event ) { event.Skip(); } virtual void onUpdateUIUnits( wxUpdateUIEvent& event ) { event.Skip(); } virtual void onUpdateUIFileOpt( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void onUpdateUIforceSMDOpt( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void onUpdateUIExcludeTH( wxUpdateUIEvent& event ) { event.Skip(); } virtual void onUpdateUIincludeBoardEdge( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnGenerate( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index c59857ac7f..acfa5f110b 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -289,7 +289,6 @@ void DIALOG_NETLIST::loadNetlist( bool aDryRun ) NETLIST netlist; - netlist.SetDeleteExtraFootprints( m_cbDeleteExtraFootprints->GetValue() ); netlist.SetFindByTimeStamp( m_matchByUUID ); netlist.SetReplaceFootprints( m_cbUpdateFootprints->GetValue() ); diff --git a/pcbnew/dialogs/dialog_netlist_base.cpp b/pcbnew/dialogs/dialog_netlist_base.cpp index 7ff1eb6a61..c4395e0451 100644 --- a/pcbnew/dialogs/dialog_netlist_base.cpp +++ b/pcbnew/dialogs/dialog_netlist_base.cpp @@ -35,7 +35,7 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const bSizerNetlistFilename->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2 ); - bMainSizer->Add( bSizerNetlistFilename, 0, wxALL|wxEXPAND, 5 ); + bMainSizer->Add( bSizerNetlistFilename, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -72,7 +72,7 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const bUpperSizer->Add( sbSizer1, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - bMainSizer->Add( bUpperSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bMainSizer->Add( bUpperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bLowerSizer; bLowerSizer = new wxBoxSizer( wxVERTICAL ); @@ -89,7 +89,7 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const m_buttonFPTest = new wxButton( this, ID_TEST_NETLIST, _("Test Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonFPTest->SetToolTip( _("Read the current netlist file and list missing and extra footprints") ); - m_buttonsSizer->Add( m_buttonFPTest, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); + m_buttonsSizer->Add( m_buttonFPTest, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 ); m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); @@ -103,7 +103,7 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const m_buttonsSizer->Add( m_sdbSizer1, 1, wxEXPAND, 5 ); - bMainSizer->Add( m_buttonsSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); + bMainSizer->Add( m_buttonsSizer, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bMainSizer ); diff --git a/pcbnew/dialogs/dialog_netlist_base.fbp b/pcbnew/dialogs/dialog_netlist_base.fbp index d867f68aa1..70a9dd8640 100644 --- a/pcbnew/dialogs/dialog_netlist_base.fbp +++ b/pcbnew/dialogs/dialog_netlist_base.fbp @@ -59,8 +59,8 @@ wxVERTICAL none - 5 - wxALL|wxEXPAND + 10 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 @@ -270,7 +270,7 @@ 5 - wxEXPAND|wxRIGHT|wxLEFT + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 @@ -755,7 +755,7 @@ 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxTOP + wxEXPAND|wxALL 0 @@ -763,7 +763,7 @@ wxHORIZONTAL protected - 5 + 10 wxEXPAND|wxLEFT|wxRIGHT 0 diff --git a/pcbnew/dialogs/dialog_update_pcb.cpp b/pcbnew/dialogs/dialog_update_pcb.cpp index 808732832f..9db8bd9341 100644 --- a/pcbnew/dialogs/dialog_update_pcb.cpp +++ b/pcbnew/dialogs/dialog_update_pcb.cpp @@ -111,7 +111,6 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun ) m_runDragCommand = false; - m_netlist->SetDeleteExtraFootprints( m_cbDeleteExtraFootprints->GetValue() ); m_netlist->SetFindByTimeStamp( !m_cbRelinkFootprints->GetValue() ); m_netlist->SetReplaceFootprints( m_cbUpdateFootprints->GetValue() ); diff --git a/pcbnew/exporters/export_footprints_placefile.cpp b/pcbnew/exporters/export_footprints_placefile.cpp index d971145220..9b16488d24 100644 --- a/pcbnew/exporters/export_footprints_placefile.cpp +++ b/pcbnew/exporters/export_footprints_placefile.cpp @@ -70,14 +70,13 @@ enum SELECT_SIDE PCB_BOTH_SIDES }; -PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, - bool aForceSmdItems, bool aTopSide, - bool aBottomSide, bool aFormatCSV ) +PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, bool aExcludeAllTH, + bool aTopSide, bool aBottomSide, bool aFormatCSV ) { - m_board = aBoard; - m_unitsMM = aUnitsMM; - m_forceSmdItems = aForceSmdItems; - m_fpCount = 0; + m_board = aBoard; + m_unitsMM = aUnitsMM; + m_excludeAllTH = aExcludeAllTH; + m_fpCount = 0; if( aTopSide && aBottomSide ) m_side = PCB_BOTH_SIDES; @@ -114,7 +113,6 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() // Build and sort the list of footprints alphabetically std::vector list; - m_smdFootprintsNotLabeledSMD.clear(); for( MODULE* footprint : m_board->Modules() ) { @@ -126,26 +124,11 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() continue; } - if( footprint->GetAttributes() & MOD_VIRTUAL ) - continue; + if( footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES ) + continue; - if( ( footprint->GetAttributes() & MOD_CMS ) == 0 ) - { - if( m_forceSmdItems ) // true to fix a bunch of mis-labeled footprints: - { - if( !footprint->HasNonSMDPins() ) - { - // all footprint's pins are SMD, mark the part for pick and place - // Note: they are not necessary to pick and place, - // but the probability is high - m_smdFootprintsNotLabeledSMD.push_back( footprint ); - } - else - continue; - } - else - continue; - } + if( m_excludeAllTH && footprint->HasThroughHolePads() ) + continue; m_fpCount++; @@ -346,13 +329,13 @@ std::string PLACE_FILE_EXPORTER::GenReportData() buffer += "attribut"; - if( module->GetAttributes() & MOD_VIRTUAL ) + if( ( module->GetAttributes() & ( MOD_THROUGH_HOLE | MOD_SMD ) ) == 0 ) buffer += " virtual"; - if( module->GetAttributes() & MOD_CMS ) + if( module->GetAttributes() & MOD_SMD ) buffer += " smd"; - if(( module->GetAttributes() & ( MOD_VIRTUAL | MOD_CMS) ) == 0 ) + if( module->GetAttributes() & MOD_THROUGH_HOLE ) buffer += " none"; buffer += "\n"; diff --git a/pcbnew/exporters/export_footprints_placefile.h b/pcbnew/exporters/export_footprints_placefile.h index cefc1497b5..8a8203b5f1 100644 --- a/pcbnew/exporters/export_footprints_placefile.h +++ b/pcbnew/exporters/export_footprints_placefile.h @@ -82,36 +82,19 @@ public: */ int GetFootprintCount() { return m_fpCount; } - /** - * @return the list of not virtual footprints with MOD_CMS flag not set - * but having only smd pads. - * This list can be used to force this flag. - * it is filled only if forceSmdItems is true - */ - std::vector& GetSmdFootprintsNotLabeledSMD() - { - return m_smdFootprintsNotLabeledSMD; - } - // Use standard board side name. do not translate them, // they are keywords in place file static std::string GetFrontSideName() { return std::string( "top" ); } static std::string GetBackSideName() { return std::string( "bottom" ); } private: - BOARD* m_board; - bool m_unitsMM; // true for mm, false for inches - bool m_forceSmdItems; // If true, non virtual fp with the flag MOD_CMD not set but - // having only smd pads will be in list - // and will be added in m_smdFootprintsNotLabeledSMD - int m_side; // PCB_BACK_SIDE, PCB_FRONT_SIDE, PCB_BOTH_SIDES - bool m_formatCSV; // true for csv format, false for ascii (utf8) format - int m_fpCount; // Number of footprints in list, for info - wxPoint m_place_Offset; // Offset for coordinates in generated data. - - // A list of footprints with MOD_CMS flag not set but having only smd pads. - // This list can be used to force this flag. - std::vector m_smdFootprintsNotLabeledSMD; + BOARD* m_board; + bool m_unitsMM; // true for mm, false for inches + bool m_excludeAllTH; // Exclude any footprints with through-hole pads + int m_side; // PCB_BACK_SIDE, PCB_FRONT_SIDE, PCB_BOTH_SIDES + bool m_formatCSV; // true for csv format, false for ascii (utf8) format + int m_fpCount; // Number of footprints in list, for info + wxPoint m_place_Offset; // Offset for coordinates in generated data. }; #endif // #ifndef EXPORT_FOOTPRINTS_PLACEFILE_H diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 1246f15773..2049f60ca6 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -1085,17 +1085,6 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb ) fprintf( aFile, "\nDEVICE \"DEV_%s\"\n", TO_UTF8( escapeString( shapeName ) ) ); fprintf( aFile, "PART \"%s\"\n", TO_UTF8( escapeString( module->GetValue() ) ) ); fprintf( aFile, "PACKAGE \"%s\"\n", TO_UTF8( escapeString( module->GetFPID().Format() ) ) ); - - // The TYPE attribute is almost freeform - const char* ty = "TH"; - - if( module->GetAttributes() & MOD_CMS ) - ty = "SMD"; - - if( module->GetAttributes() & MOD_VIRTUAL ) - ty = "VIRTUAL"; - - fprintf( aFile, "TYPE %s\n", ty ); } fputs( "$ENDDEVICES\n\n", aFile ); @@ -1170,38 +1159,10 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aS /* creates header: */ fprintf( aFile, "\nSHAPE \"%s\"\n", TO_UTF8( escapeString( aShapeName ) ) ); - if( module->GetAttributes() & MOD_VIRTUAL ) - { - fprintf( aFile, "INSERT SMD\n" ); - } + if( module->GetAttributes() & MOD_THROUGH_HOLE ) + fprintf( aFile, "INSERT TH\n" ); else - { - if( module->GetAttributes() & MOD_CMS ) - { - fprintf( aFile, "INSERT SMD\n" ); - } - else - { - fprintf( aFile, "INSERT TH\n" ); - } - } - -#if 0 /* ATTRIBUTE name and value is unspecified and the original exporter - * got the syntax wrong, so CAM350 rejected the whole shape! */ - - if( module->m_Attributs != MOD_DEFAULT ) - { - fprintf( aFile, "ATTRIBUTE" ); - - if( module->m_Attributs & MOD_CMS ) - fprintf( aFile, " PAD_SMD" ); - - if( module->m_Attributs & MOD_VIRTUAL ) - fprintf( aFile, " VIRTUAL" ); - - fprintf( aFile, "\n" ); - } -#endif + fprintf( aFile, "INSERT SMD\n" ); // Silk outline; wildly interpreted by various importers: // CAM350 read it right but only closed shapes diff --git a/pcbnew/exporters/gen_footprints_placefile.cpp b/pcbnew/exporters/gen_footprints_placefile.cpp index e889073538..01108ae568 100644 --- a/pcbnew/exporters/gen_footprints_placefile.cpp +++ b/pcbnew/exporters/gen_footprints_placefile.cpp @@ -98,9 +98,17 @@ private: m_radioBoxFilesCount->Enable( m_rbFormat->GetSelection() != 2 ); } - void onUpdateUIforceSMDOpt( wxUpdateUIEvent& event ) override + void onUpdateUIExcludeTH( wxUpdateUIEvent& event ) override { - m_forceSMDOpt->Enable( m_rbFormat->GetSelection() != 2 ); + if( m_rbFormat->GetSelection() == 2 ) + { + m_excludeTH->SetValue( false ); + m_excludeTH->Enable( false ); + } + else + { + m_excludeTH->Enable( true ); + } } void onUpdateUIincludeBoardEdge( wxUpdateUIEvent& event ) override @@ -127,9 +135,9 @@ private: return m_radioBoxFilesCount->GetSelection() == 1; } - bool ForceAllSmd() + bool ExcludeAllTH() { - return m_forceSMDOpt->GetValue(); + return m_excludeTH->GetValue(); } }; @@ -317,30 +325,17 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() int top_side = true; int bottom_side = true; - // Test for any footprint candidate in list, and display the list of forced footprints - // if ForceAllSmd() is true + // Test for any footprint candidate in list. { - PLACE_FILE_EXPORTER exporter( brd, UnitsMM(), ForceAllSmd(), top_side, bottom_side, + PLACE_FILE_EXPORTER exporter( brd, UnitsMM(), ExcludeAllTH(), top_side, bottom_side, useCSVfmt ); exporter.GenPositionData(); - if( exporter.GetFootprintCount() == 0) + if( exporter.GetFootprintCount() == 0 ) { wxMessageBox( _( "No footprint for automated placement." ) ); return false; } - - if( ForceAllSmd() ) - { - std::vector& fp_no_smd_list = exporter.GetSmdFootprintsNotLabeledSMD(); - - for( MODULE* item : fp_no_smd_list ) - { - msg.Printf( _( "footprint %s (not set as SMD) forced in list" ), - item->GetReference() ); - m_reporter->Report( msg, RPT_SEVERITY_INFO ); - } - } } // Create output directory if it does not exist. @@ -384,8 +379,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() fn.SetExt( FootprintPlaceFileExtension ); int fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), - ForceAllSmd(), - top_side, bottom_side, useCSVfmt ); + ExcludeAllTH(), top_side, bottom_side, + useCSVfmt ); if( fpcount < 0 ) { msg.Printf( _( "Unable to create \"%s\"." ), fn.GetFullPath() ); @@ -426,8 +421,8 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles() else fn.SetExt( FootprintPlaceFileExtension ); - fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), - ForceAllSmd(), top_side, bottom_side, useCSVfmt ); + fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), ExcludeAllTH(), + top_side, bottom_side, useCSVfmt ); if( fpcount < 0 ) { @@ -547,7 +542,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool return false; std::string data; - PLACE_FILE_EXPORTER exporter ( GetBoard(), aUnitsMM, false, true, true, false ); + PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM, false, true, true, false ); data = exporter.GenReportData(); fputs( data.c_str(), rptfile ); diff --git a/pcbnew/exporters/gerber_placefile_writer.cpp b/pcbnew/exporters/gerber_placefile_writer.cpp index c46d236379..16ee73f34a 100644 --- a/pcbnew/exporters/gerber_placefile_writer.cpp +++ b/pcbnew/exporters/gerber_placefile_writer.cpp @@ -70,7 +70,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER for( MODULE* footprint : m_pcb->Modules() ) { - if( footprint->GetAttributes() & MOD_VIRTUAL ) + if( footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES ) continue; if( footprint->GetLayer() == aLayer ) @@ -145,17 +145,12 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER // Add rotation info (rotation is CCW, in degrees): pnpAttrib.m_Orientation = mapRotationAngle( footprint->GetOrientationDegrees() ); - // Add component type info (SMD or Through Hole): - bool is_smd_mount = footprint->GetAttributes() & MOD_CMS; + pnpAttrib.m_MountType = GBR_CMP_PNP_METADATA::MOUNT_TYPE_UNSPECIFIED; - // Smd footprints can have through holes (thermal vias). - // but if a footprint is not set as SMD, it will be set as SMD - // if it does not have through hole pads - if( !is_smd_mount && !footprint->HasNonSMDPins() ) - is_smd_mount = true; - - pnpAttrib.m_MountType = is_smd_mount ? GBR_CMP_PNP_METADATA::MOUNT_TYPE_SMD - : GBR_CMP_PNP_METADATA::MOUNT_TYPE_TH; + if( footprint->GetAttributes() & MOD_THROUGH_HOLE ) + pnpAttrib.m_MountType = GBR_CMP_PNP_METADATA::MOUNT_TYPE_TH; + else if( footprint->GetAttributes() & MOD_SMD ) + pnpAttrib.m_MountType = GBR_CMP_PNP_METADATA::MOUNT_TYPE_SMD; // Add component value info: pnpAttrib.m_Value = ConvertNotAllowedCharsInGerber( footprint->Value().GetShownText(), diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 4a55846c79..1b1957b939 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1011,15 +1011,24 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const FormatInternalUnits( aModule->GetThermalGap() ).c_str() ); // Attributes - if( aModule->GetAttributes() != MOD_DEFAULT ) + if( aModule->GetAttributes() ) { m_out->Print( aNestLevel+1, "(attr" ); - if( aModule->GetAttributes() & MOD_CMS ) + if( aModule->GetAttributes() & MOD_SMD ) m_out->Print( 0, " smd" ); - if( aModule->GetAttributes() & MOD_VIRTUAL ) - m_out->Print( 0, " virtual" ); + if( aModule->GetAttributes() & MOD_THROUGH_HOLE ) + m_out->Print( 0, " through_hole" ); + + if( aModule->GetAttributes() & MOD_BOARD_ONLY ) + m_out->Print( 0, " board_only" ); + + if( aModule->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES ) + m_out->Print( 0, " excude_from_pos_files" ); + + if( aModule->GetAttributes() & MOD_EXCLUDE_FROM_BOM ) + m_out->Print( 9, " exclude_from_bom" ); m_out->Print( 0, ")\n" ); } diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h index b643f80ea9..ed85bc0942 100644 --- a/pcbnew/kicad_plugin.h +++ b/pcbnew/kicad_plugin.h @@ -80,7 +80,8 @@ class TEXTE_PCB; //#define SEXPR_BOARD_FILE_VERSION 20200811 // Add groups //#define SEXPR_BOARD_FILE_VERSION 20200818 // Remove Status flag bitmap and setup counts //#define SEXPR_BOARD_FILE_VERSION 20200819 // Add board-level properties -#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information +//#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information +#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index bcff9f26dc..a7e022b488 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1295,15 +1295,16 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) else if( TESTLINE( "At" ) ) // (At)tributes of module { - int attrs = MOD_DEFAULT; + int attrs = 0; data = line + SZ( "At" ); if( strstr( data, "SMD" ) ) - attrs |= MOD_CMS; - - if( strstr( data, "VIRTUAL" ) ) - attrs |= MOD_VIRTUAL; + attrs |= MOD_SMD; + else if( strstr( data, "VIRTUAL" ) ) + attrs |= MOD_EXCLUDE_FROM_POS_FILES | MOD_EXCLUDE_FROM_BOM; + else + attrs |= MOD_THROUGH_HOLE | MOD_EXCLUDE_FROM_POS_FILES; aModule->SetAttributes( attrs ); } diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index 4fcaf0e132..e94af080cf 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -417,7 +417,7 @@ MODULE* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aIn MODULE* module = editFrame.CreateNewModule( msg ); module->SetFPID( LIB_ID( wxEmptyString, wxT( "mw_inductor" ) ) ); - module->SetAttributes( MOD_VIRTUAL | MOD_CMS ); + module->SetAttributes( MOD_EXCLUDE_FROM_POS_FILES | MOD_EXCLUDE_FROM_BOM ); module->ClearFlags(); module->SetPosition( aInductorPattern.m_End ); diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index 15104454a4..6e27754097 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -307,6 +307,33 @@ bool BOARD_NETLIST_UPDATER::updateComponentParameters( MODULE* aPcbComponent, } } + if( ( aNewComponent->GetProperties().count( "exclude_from_bom" ) > 0 ) + != ( ( aPcbComponent->GetAttributes() & MOD_EXCLUDE_FROM_BOM ) > 0 ) ) + { + int attributes = aPcbComponent->GetAttributes(); + + if( aNewComponent->GetProperties().count( "exclude_from_bom" ) ) + { + attributes |= MOD_EXCLUDE_FROM_BOM; + msg.Printf( _( "Setting %s 'exclude from BOM' fabrication attribute." ), + aPcbComponent->GetReference() ); + } + else + { + attributes &= ~MOD_EXCLUDE_FROM_BOM; + msg.Printf( _( "Removing %s 'exclude from BOM' fabrication attribute." ), + aPcbComponent->GetReference() ); + } + + m_reporter->Report( msg, RPT_SEVERITY_ACTION ); + + if( !m_isDryRun ) + { + changed = true; + aPcbComponent->SetAttributes( attributes ); + } + } + if( changed && copy ) m_commit.Modified( aPcbComponent, copy ); else @@ -326,7 +353,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent bool changed = false; // At this point, the component footprint is updated. Now update the nets. - for( auto pad : aPcbComponent->Pads() ) + for( D_PAD* pad : aPcbComponent->Pads() ) { const COMPONENT_NET& net = aNewComponent->GetNet( pad->GetName() ); @@ -418,17 +445,17 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent m_oldToNewNets[ pad->GetNetname() ] = netName; msg.Printf( _( "Reconnect %s pin %s from %s to %s."), - aPcbComponent->GetReference(), - pad->GetName(), - UnescapeString( pad->GetNetname() ), - UnescapeString( netName ) ); + aPcbComponent->GetReference(), + pad->GetName(), + UnescapeString( pad->GetNetname() ), + UnescapeString( netName ) ); } else { msg.Printf( _( "Connect %s pin %s to %s."), - aPcbComponent->GetReference(), - pad->GetName(), - UnescapeString( netName ) ); + aPcbComponent->GetReference(), + pad->GetName(), + UnescapeString( netName ) ); } m_reporter->Report( msg, RPT_SEVERITY_ACTION ); @@ -481,7 +508,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist ) } } - for( auto via : m_board->Tracks() ) + for( TRACK* via : m_board->Tracks() ) { if( via->Type() != PCB_VIA_T ) continue; @@ -500,7 +527,8 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist ) if( !updatedNetname.IsEmpty() ) { msg.Printf( _( "Reconnect via from %s to %s." ), - UnescapeString( via->GetNetname() ), UnescapeString( updatedNetname ) ); + UnescapeString( via->GetNetname() ), + UnescapeString( updatedNetname ) ); m_reporter->Report( msg, RPT_SEVERITY_ACTION ); if( !m_isDryRun ) @@ -520,7 +548,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist ) else { msg.Printf( _( "Via connected to unknown net (%s)." ), - UnescapeString( via->GetNetname() ) ); + UnescapeString( via->GetNetname() ) ); m_reporter->Report( msg, RPT_SEVERITY_WARNING ); ++m_warningCount; } @@ -598,15 +626,17 @@ bool BOARD_NETLIST_UPDATER::deleteUnusedComponents( NETLIST& aNetlist ) wxString msg; const COMPONENT* component; - for( auto module : m_board->Modules() ) + for( MODULE* module : m_board->Modules() ) { + if( ( module->GetAttributes() & MOD_BOARD_ONLY ) > 0 ) + continue; if( m_lookupByTimestamp ) component = aNetlist.GetComponentByPath( module->GetPath() ); else component = aNetlist.GetComponentByReference( module->GetReference() ); - if( component == NULL ) + if( component == NULL || component->GetProperties().count( "exclude_from_board" ) ) { if( module->IsLocked() ) { @@ -641,8 +671,10 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets() std::vector padlist = m_board->GetPads(); // Sort pads by netlist name - std::sort( padlist.begin(), padlist.end(), - [ this ]( D_PAD* a, D_PAD* b ) -> bool { return getNetname( a ) < getNetname( b ); } ); + std::sort( padlist.begin(), padlist.end(), [ this ]( D_PAD* a, D_PAD* b ) -> bool + { + return getNetname( a ) < getNetname( b ); + } ); for( D_PAD* pad : padlist ) { @@ -775,6 +807,9 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) int matchCount = 0; MODULE* tmp; + if( component->GetProperties().count( "exclude_from_board" ) ) + continue; + msg.Printf( _( "Processing component \"%s:%s\"." ), component->GetReference(), component->GetFPID().Format().wx_str() ); diff --git a/pcbnew/netlist_reader/netlist.cpp b/pcbnew/netlist_reader/netlist.cpp index f83c16cb86..569ce11946 100644 --- a/pcbnew/netlist_reader/netlist.cpp +++ b/pcbnew/netlist_reader/netlist.cpp @@ -31,33 +31,28 @@ using namespace std::placeholders; #include -//#include #include -//#include #include -#include "pcb_netlist.h" -#include "netlist_reader.h" +#include +#include #include #include #include #include #include #include -//#include #include #include "board_netlist_updater.h" #include #include #include #include // LAST_PATH_TYPE -#include +//#include -extern void SpreadFootprints( std::vector* aFootprints, - wxPoint aSpreadAreaPosition ); +extern void SpreadFootprints( std::vector* aFootprints, wxPoint aSpreadAreaPosition ); -bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, - NETLIST& aNetlist, +bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist, REPORTER& aReporter ) { wxString msg; @@ -135,8 +130,6 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR } -#define ALLOW_PARTIAL_FPID 1 - void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter ) { wxString msg; @@ -154,12 +147,8 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter ) { component = aNetlist.GetComponent( ii ); -#if ALLOW_PARTIAL_FPID // The FPID is ok as long as there is a footprint portion coming from eeschema. if( !component->GetFPID().GetLibItemName().size() ) -#else - if( component->GetFPID().empty() ) -#endif { msg.Printf( _( "No footprint defined for symbol \"%s\".\n" ), component->GetReference() ); @@ -198,13 +187,9 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter ) { module = NULL; -#if ALLOW_PARTIAL_FPID - // The LIB_ID is ok as long as there is a footprint portion coming - // the library if it's needed. Nickname can be blank. + // The LIB_ID is ok as long as there is a footprint portion coming the library if + // it's needed. Nickname can be blank. if( !component->GetFPID().GetLibItemName().size() ) -#else - if( !component->GetFPID().IsValid() ) -#endif { msg.Printf( _( "%s footprint ID \"%s\" is not valid." ), component->GetReference(), diff --git a/pcbnew/netlist_reader/pcb_netlist.h b/pcbnew/netlist_reader/pcb_netlist.h index 28d10d1f0a..afbae534a5 100644 --- a/pcbnew/netlist_reader/pcb_netlist.h +++ b/pcbnew/netlist_reader/pcb_netlist.h @@ -193,20 +193,13 @@ typedef boost::ptr_vector< COMPONENT > COMPONENTS; */ class NETLIST { - COMPONENTS m_components; ///< Components found in the netlist. + COMPONENTS m_components; // Components found in the netlist. - /// Remove footprints from #BOARD not found in netlist when true. - bool m_deleteExtraFootprints; - - /// Find component by time stamp if true or reference designator if false. - bool m_findByTimeStamp; - - /// Replace component footprints when they differ from the netlist if true. - bool m_replaceFootprints; + bool m_findByTimeStamp; // Associate components by KIID (or refdes if false) + bool m_replaceFootprints; // Update footprints to match footprints defined in netlist public: NETLIST() : - m_deleteExtraFootprints( false ), m_findByTimeStamp( false ), m_replaceFootprints( false ) { @@ -269,23 +262,12 @@ public: COMPONENT* GetComponentByPath( const KIID_PATH& aPath ); void SortByFPID(); - void SortByReference(); - void SetDeleteExtraFootprints( bool aDeleteExtraFootprints ) - { - m_deleteExtraFootprints = aDeleteExtraFootprints; - } - void SetFindByTimeStamp( bool aFindByTimeStamp ) { m_findByTimeStamp = aFindByTimeStamp; } - bool IsFindByTimeStamp() const { return m_findByTimeStamp; } - void SetReplaceFootprints( bool aReplaceFootprints ) - { - m_replaceFootprints = aReplaceFootprints; - } - + void SetReplaceFootprints( bool aReplace ) { m_replaceFootprints = aReplace; } bool GetReplaceFootprints() const { return m_replaceFootprints; } /** diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp index 4f0ff42e2c..94bb16fe17 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp @@ -520,8 +520,6 @@ void PCB_MODULE::AddToBoard() fpID.Parse( m_compRef, LIB_ID::ID_PCB, true ); module->SetFPID( fpID ); - module->SetAttributes( MOD_DEFAULT | MOD_CMS ); - // reference text TEXTE_MODULE* ref_text = &module->Reference(); diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index e08cde8fe5..6d74828aa4 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -783,8 +783,8 @@ public: * @param aCommit = commit that should store the changes */ void Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& aCommit, - bool deleteExtraTexts = true, - bool resetTextLayers = true, bool resetTextEffects = true, + bool deleteExtraTexts = true, bool resetTextLayers = true, + bool resetTextEffects = true, bool resetFabricationAttrs = true, bool reset3DModels = true ); // loading modules: see PCB_BASE_FRAME diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 815a74ce7f..15140a1d02 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2526,6 +2526,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) wxPoint pt; T token; LIB_ID fpid; + int attributes = 0; std::unique_ptr module( new MODULE( m_board ) ); @@ -2689,16 +2690,33 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) { switch( token ) { + case T_virtual: // legacy token prior to version 20200826 + attributes |= MOD_EXCLUDE_FROM_POS_FILES | MOD_EXCLUDE_FROM_BOM; + break; + + case T_through_hole: + attributes |= MOD_THROUGH_HOLE; + break; + case T_smd: - module->SetAttributes( module->GetAttributes() | MOD_CMS ); + attributes |= MOD_SMD; + break; + + case T_board_only: + attributes |= MOD_BOARD_ONLY; + break; + + case T_exclude_from_pos_files: + attributes |= MOD_EXCLUDE_FROM_POS_FILES; break; - case T_virtual: - module->SetAttributes( module->GetAttributes() | MOD_VIRTUAL ); + case T_exclude_from_bom: + attributes |= MOD_EXCLUDE_FROM_BOM; break; default: - Expecting( "smd and/or virtual" ); + Expecting( "through_hole, smd, virtual, board_only, exclude_from_pos_files " + "or exclude_from_bom" ); } } break; @@ -2797,6 +2815,16 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) } } + // In legacy files the lack of attributes indicated a through-hole component which was by + // default excluded from pos files. However there was a hack to look for SMD pads and + // consider those "mislabelled through-hole components" and therefore include them in place + // files. We probably don't want to get into that game so we'll just include them by + // default and let the user change it if required. + if( m_requiredVersion < 20200826 && attributes == 0 ) + attributes |= MOD_THROUGH_HOLE; + + module->SetAttributes( attributes ); + module->SetFPID( fpid ); module->SetProperties( properties ); module->CalculateBoundingBox();