ADDED: DNP, etc. attributes to SCH rule areas.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14037
This commit is contained in:
Jeff Young 2025-06-10 18:26:00 +01:00
parent ae1c1c6f26
commit 4678000a0e
21 changed files with 595 additions and 56 deletions

View File

@ -26,6 +26,7 @@
#include <sch_edit_frame.h>
#include <symbol_edit_frame.h>
#include <sch_shape.h>
#include <sch_rule_area.h>
#include <dialog_shape_properties.h>
#include <settings/color_settings.h>
#include <symbol_editor_settings.h>
@ -34,10 +35,10 @@
DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_SHAPE* aShape ) :
DIALOG_SHAPE_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_shape( aShape ),
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true )
DIALOG_SHAPE_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_shape( aShape ),
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true )
{
SetTitle( wxString::Format( GetTitle(), aShape->GetFriendlyName() ) );
@ -68,6 +69,8 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_S
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
m_ruleAreaSizer->Show( dynamic_cast<SCH_RULE_AREA*>( aShape ) != nullptr );
SetInitialFocus( m_borderWidthCtrl );
// Required under wxGTK if we want to dismiss the dialog with the ESC key
@ -92,10 +95,8 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_S
m_symbolEditorSizer->Show( false );
}
m_borderColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch,
this );
m_customColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch,
this );
m_borderColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch, this );
m_customColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch, this );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
@ -104,11 +105,8 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_S
DIALOG_SHAPE_PROPERTIES::~DIALOG_SHAPE_PROPERTIES()
{
m_borderColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch,
this );
m_customColorSwatch->Unbind( COLOR_SWATCH_CHANGED,
&DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch,
this );
m_borderColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch, this );
m_customColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch, this );
}
@ -117,6 +115,14 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow()
if( !wxDialog::TransferDataToWindow() )
return false;
if( SCH_RULE_AREA* ruleArea = dynamic_cast<SCH_RULE_AREA*>( m_shape ) )
{
m_cbExcludeFromSim->SetValue( ruleArea->GetExcludedFromSim() );
m_cbExcludeFromBom->SetValue( ruleArea->GetExcludedFromBOM() );
m_cbExcludeFromBoard->SetValue( ruleArea->GetExcludedFromBoard() );
m_cbDNP->SetValue( ruleArea->GetDNP() );
}
if( m_shape->GetWidth() >= 0 )
{
m_borderCheckbox->SetValue( true );
@ -309,6 +315,14 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
if( !m_shape->IsNew() )
commit.Modify( m_shape, m_frame->GetScreen() );
if( SCH_RULE_AREA* ruleArea = dynamic_cast<SCH_RULE_AREA*>( m_shape ) )
{
ruleArea->SetExcludedFromSim( m_cbExcludeFromSim->GetValue() );
ruleArea->SetExcludedFromBOM( m_cbExcludeFromBom->GetValue() );
ruleArea->SetExcludedFromBoard( m_cbExcludeFromBoard->GetValue() );
ruleArea->SetDNP( m_cbDNP->GetValue() );
}
STROKE_PARAMS stroke = m_shape->GetStroke();
if( m_borderCheckbox->GetValue() )

View File

@ -13,6 +13,9 @@
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_SHAPE_PROPERTIES_BASE, DIALOG_SHIM )
EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_OnCheckBox )
EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_OnCheckBox )
EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_OnCheckBox )
EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onBorderChecked )
EVT_CHOICE( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillChoice )
EVT_RADIOBUTTON( NO_FILL, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillRadioButton )
@ -35,6 +38,33 @@ DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wx
mainSizer->Add( m_infoBar, 0, wxBOTTOM|wxEXPAND, 5 );
m_ruleAreaSizer = new wxBoxSizer( wxVERTICAL );
m_cbExcludeFromSim = new wxCheckBox( this, wxID_ANY, _("Exclude from simulation"), wxDefaultPosition, wxDefaultSize, 0 );
m_ruleAreaSizer->Add( m_cbExcludeFromSim, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ruleAreaSizer->Add( 0, 10, 0, wxEXPAND, 5 );
m_cbExcludeFromBom = new wxCheckBox( this, wxID_ANY, _("Exclude from bill of materials"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbExcludeFromBom->SetToolTip( _("This is useful for adding symbols for board footprints such as fiducials\nand logos that you do not want to appear in the bill of materials export") );
m_ruleAreaSizer->Add( m_cbExcludeFromBom, 0, wxALL, 5 );
m_cbExcludeFromBoard = new wxCheckBox( this, wxID_ANY, _("Exclude from board"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbExcludeFromBoard->SetToolTip( _("This is useful for adding symbols that only get exported to the bill of materials but\nnot required to layout the board such as mechanical fasteners and enclosures") );
m_ruleAreaSizer->Add( m_cbExcludeFromBoard, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbDNP = new wxCheckBox( this, wxID_ANY, _("Do not populate"), wxDefaultPosition, wxDefaultSize, 0 );
m_ruleAreaSizer->Add( m_cbDNP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_ruleAreaSizer->Add( 0, 5, 1, wxEXPAND, 5 );
mainSizer->Add( m_ruleAreaSizer, 1, wxEXPAND|wxALL, 5 );
wxBoxSizer* bColumns;
bColumns = new wxBoxSizer( wxHORIZONTAL );

View File

@ -14,7 +14,7 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="file">dialog_shape_properties_base</property>
<property name="first_id">1000</property>
<property name="first_id">11300</property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
@ -125,6 +125,300 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_ruleAreaSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Exclude from simulation</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbExcludeFromSim</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnCheckBox</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="true">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Exclude from bill of materials</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbExcludeFromBom</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">This is useful for adding symbols for board footprints such as fiducials&#x0A;and logos that you do not want to appear in the bill of materials export</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnCheckBox</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Exclude from board</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbExcludeFromBoard</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">This is useful for adding symbols that only get exported to the bill of materials but&#x0A;not required to layout the board such as mechanical fasteners and enclosures</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnCheckBox</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Do not populate</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbDNP</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">5</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>

View File

@ -21,9 +21,9 @@ class WX_INFOBAR;
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bmpcbox.h>
#include <wx/gbsizer.h>
@ -45,6 +45,7 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
private:
// Private event handlers
void _wxFB_OnCheckBox( wxCommandEvent& event ){ OnCheckBox( event ); }
void _wxFB_onBorderChecked( wxCommandEvent& event ){ onBorderChecked( event ); }
void _wxFB_onFillChoice( wxCommandEvent& event ){ onFillChoice( event ); }
void _wxFB_onFillRadioButton( wxCommandEvent& event ){ onFillRadioButton( event ); }
@ -53,13 +54,18 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
protected:
enum
{
NO_FILL = 1000,
NO_FILL = 11300,
FILLED_SHAPE,
FILLED_WITH_BG_BODYCOLOR,
FILLED_WITH_COLOR,
};
WX_INFOBAR* m_infoBar;
wxBoxSizer* m_ruleAreaSizer;
wxCheckBox* m_cbExcludeFromSim;
wxCheckBox* m_cbExcludeFromBom;
wxCheckBox* m_cbExcludeFromBoard;
wxCheckBox* m_cbDNP;
wxGridBagSizer* m_borderSizer;
wxCheckBox* m_borderCheckbox;
wxStaticText* m_borderWidthLabel;
@ -95,6 +101,7 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerCancel;
// Virtual event handlers, override them in your derived class
virtual void OnCheckBox( wxCommandEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillRadioButton( wxCommandEvent& event ) { event.Skip(); }

View File

@ -1780,7 +1780,7 @@ int ERC_TESTER::TestSimModelIssues()
// Power symbols and other symbols which have the reference starting with "#" are
// not included in simulation
if( symbol->GetRef( &sheet ).StartsWith( '#' ) || symbol->GetExcludedFromSim() )
if( symbol->GetRef( &sheet ).StartsWith( '#' ) || symbol->ResolveExcludedFromSim() )
continue;
// Reset for each symbol

View File

@ -177,7 +177,7 @@ bool NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries( unsigned aNetlistOptions
{
SCH_SYMBOL* symbol = findNextSymbol( item, sheet );
if( !symbol || symbol->GetExcludedFromSim() )
if( !symbol || symbol->ResolveExcludedFromSim() )
continue;
try
@ -306,7 +306,7 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions )
{
for( SCH_ITEM* item : sheet.LastScreen()->Items() )
{
if( item->GetExcludedFromSim() )
if( item->ResolveExcludedFromSim() )
continue;
if( item->Type() == SCH_TEXT_T )

View File

@ -305,10 +305,10 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
if( !symbol )
continue;
if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->GetExcludedFromBOM() ) )
if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->ResolveExcludedFromBOM() ) )
continue;
if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->GetExcludedFromBoard() ) )
if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->ResolveExcludedFromBoard() ) )
continue;
// Output the symbol's elements in order of expected access frequency. This may
@ -379,19 +379,19 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
xproperty->AddAttribute( wxT( "value" ), sheetField.GetText() );
}
if( symbol->GetExcludedFromBOM() || sheet.GetExcludedFromBOM() )
if( symbol->ResolveExcludedFromBOM() || sheet.GetExcludedFromBOM() )
{
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( wxT( "name" ), wxT( "exclude_from_bom" ) );
}
if( symbol->GetExcludedFromBoard() || sheet.GetExcludedFromBoard() )
if( symbol->ResolveExcludedFromBoard() || sheet.GetExcludedFromBoard() )
{
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( wxT( "name" ), wxT( "exclude_from_board" ) );
}
if( symbol->GetDNP() || sheet.GetDNP() )
if( symbol->ResolveDNP() || sheet.GetDNP() )
{
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( wxT( "name" ), wxT( "dnp" ) );
@ -889,10 +889,10 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
if( !symbol )
continue;
if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->GetExcludedFromBOM() ) )
if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->ResolveExcludedFromBOM() ) )
continue;
if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->GetExcludedFromBoard() ) )
if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->ResolveExcludedFromBoard() ) )
continue;
net_record->m_Nodes.emplace_back( pin, sheet );

View File

@ -1602,7 +1602,7 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
// Power symbols and other symbols which have the reference starting with "#" are
// not included in simulation
if( ref.StartsWith( '#' ) || symbol->GetExcludedFromSim() )
if( ref.StartsWith( '#' ) || symbol->ResolveExcludedFromSim() )
continue;
for( SCH_PIN* pin : pins )

View File

@ -122,4 +122,5 @@
//#define SEXPR_SCHEMATIC_FILE_VERSION 20250227 // Support for local power symbols
//#define SEXPR_SCHEMATIC_FILE_VERSION 20250318 // ~ no longer means empty text
//#define SEXPR_SCHEMATIC_FILE_VERSION 20250425 // uuids for tables
#define SEXPR_SCHEMATIC_FILE_VERSION 20250513 // Groups can have design block lib_id
//#define SEXPR_SCHEMATIC_FILE_VERSION 20250513 // Groups can have design block lib_id
#define SEXPR_SCHEMATIC_FILE_VERSION 20250610 // DNP, etc. flags for rule areas

View File

@ -1215,7 +1215,14 @@ void SCH_IO_KICAD_SEXPR::saveRuleArea( SCH_RULE_AREA* aRuleArea )
wxCHECK_RET( aRuleArea != nullptr && m_out != nullptr, "" );
m_out->Print( "(rule_area " );
KICAD_FORMAT::FormatBool( m_out, "exclude_from_sim", aRuleArea->GetExcludedFromSim() );
KICAD_FORMAT::FormatBool( m_out, "in_bom", !aRuleArea->GetExcludedFromBOM() );
KICAD_FORMAT::FormatBool( m_out, "on_board", !aRuleArea->GetExcludedFromBoard() );
KICAD_FORMAT::FormatBool( m_out, "dnp", aRuleArea->GetDNP() );
saveShape( aRuleArea );
m_out->Print( ")" );
}

View File

@ -3413,7 +3413,7 @@ SCH_SYMBOL* SCH_IO_KICAD_SEXPR_PARSER::parseSchematicSymbol()
}
default:
Expecting( "lib_id, lib_name, at, mirror, uuid, on_board, in_bom, dnp, "
Expecting( "lib_id, lib_name, at, mirror, uuid, exclude_from_sim, on_board, in_bom, dnp, "
"default_instance, property, pin, or instances" );
}
}
@ -4224,8 +4224,29 @@ SCH_RULE_AREA* SCH_IO_KICAD_SEXPR_PARSER::parseSchRuleArea()
const_cast<KIID&>( ruleArea->m_Uuid ) = poly->m_Uuid;
break;
}
case T_exclude_from_sim:
ruleArea->SetExcludedFromSim( parseBool() );
NeedRIGHT();
break;
case T_in_bom:
ruleArea->SetExcludedFromBOM( !parseBool() );
NeedRIGHT();
break;
case T_on_board:
ruleArea->SetExcludedFromBoard( !parseBool() );
NeedRIGHT();
break;
case T_dnp:
ruleArea->SetDNP( parseBool() );
NeedRIGHT();
break;
default:
Expecting( "polyline" );
Expecting( "exclude_from_sim, on_board, in_bom, dnp, or polyline" );
}
}

View File

@ -28,6 +28,7 @@
#include <eda_item.h>
#include <sch_connection.h>
#include <sch_group.h>
#include <sch_rule_area.h>
#include <sch_item.h>
#include <sch_screen.h>
#include <sch_sheet_path.h>
@ -244,6 +245,66 @@ SYMBOL* SCH_ITEM::GetParentSymbol()
}
bool SCH_ITEM::ResolveExcludedFromSim() const
{
if( GetExcludedFromSim() )
return true;
for( SCH_RULE_AREA* area : m_rule_areas_cache )
{
if( area->GetExcludedFromSim() )
return true;
}
return false;
}
bool SCH_ITEM::ResolveExcludedFromBOM() const
{
if( GetExcludedFromBOM() )
return true;
for( SCH_RULE_AREA* area : m_rule_areas_cache )
{
if( area->GetExcludedFromBOM() )
return true;
}
return false;
}
bool SCH_ITEM::ResolveExcludedFromBoard() const
{
if( GetExcludedFromBoard() )
return true;
for( SCH_RULE_AREA* area : m_rule_areas_cache )
{
if( area->GetExcludedFromBoard() )
return true;
}
return false;
}
bool SCH_ITEM::ResolveDNP() const
{
if( GetDNP() )
return true;
for( SCH_RULE_AREA* area : m_rule_areas_cache )
{
if( area->GetDNP() )
return true;
}
return false;
}
std::vector<int> SCH_ITEM::ViewGetLayers() const
{
// Basic fallback

View File

@ -251,6 +251,19 @@ public:
virtual void SetExcludedFromSim( bool aExclude ) { }
virtual bool GetExcludedFromSim() const { return false; }
bool ResolveExcludedFromSim() const;
virtual void SetExcludedFromBOM( bool aExcludeFromBOM ) { }
virtual bool GetExcludedFromBOM() const { return false; }
bool ResolveExcludedFromBOM() const;
virtual void SetExcludedFromBoard( bool aExcludeFromBoard ) { }
virtual bool GetExcludedFromBoard() const { return false; }
bool ResolveExcludedFromBoard() const;
virtual void SetDNP( bool aDNP ) { }
virtual bool GetDNP() const { return false; }
bool ResolveDNP() const;
/**
* Check if object is movable from the anchor point.
@ -739,7 +752,7 @@ protected:
bool m_connectivity_dirty;
/// Store pointers to rule areas which this item is contained within
std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
private:
friend class LIB_SYMBOL;

View File

@ -45,6 +45,7 @@
#include <core/mirror.h>
#include <trigo.h>
#include <sch_label.h>
#include <sch_rule_area.h>
#include <magic_enum.hpp>
#include <api/api_utils.h>
#include <api/schematic/schematic_types.pb.h>
@ -769,6 +770,58 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
return true;
}
else if( Type() == SCH_DIRECTIVE_LABEL_T && token->IsSameAs( wxT( "EXCLUDE_FROM_BOM" ) ) )
{
const SCH_DIRECTIVE_LABEL* directive = static_cast<const SCH_DIRECTIVE_LABEL*>( this );
*token = wxEmptyString;
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
{
if( ruleArea->GetExcludedFromBOM() )
*token = _( "Excluded from BOM" );
}
return true;
}
else if( Type() == SCH_DIRECTIVE_LABEL_T && token->IsSameAs( wxT( "EXCLUDE_FROM_BOARD" ) ) )
{
const SCH_DIRECTIVE_LABEL* directive = static_cast<const SCH_DIRECTIVE_LABEL*>( this );
*token = wxEmptyString;
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
{
if( ruleArea->GetExcludedFromBoard() )
*token = _( "Excluded from board" );
}
return true;
}
else if( Type() == SCH_DIRECTIVE_LABEL_T && token->IsSameAs( wxT( "EXCLUDE_FROM_SIM" ) ) )
{
const SCH_DIRECTIVE_LABEL* directive = static_cast<const SCH_DIRECTIVE_LABEL*>( this );
*token = wxEmptyString;
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
{
if( ruleArea->GetExcludedFromSim() )
*token = _( "Excluded from simulation" );
}
return true;
}
else if( Type() == SCH_DIRECTIVE_LABEL_T && token->IsSameAs( wxT( "DNP" ) ) )
{
const SCH_DIRECTIVE_LABEL* directive = static_cast<const SCH_DIRECTIVE_LABEL*>( this );
*token = wxEmptyString;
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
{
if( ruleArea->GetDNP() )
*token = _( "DNP" );
}
return true;
}
for( const SCH_FIELD& field : m_fields)
{
@ -1792,6 +1845,12 @@ void SCH_DIRECTIVE_LABEL::RemoveConnectedRuleArea( SCH_RULE_AREA* aRuleArea )
}
const std::unordered_set<SCH_RULE_AREA*> SCH_DIRECTIVE_LABEL::GetConnectedRuleAreas() const
{
return m_connected_rule_areas;
}
bool SCH_DIRECTIVE_LABEL::IsDangling() const
{
return m_isDangling && m_connected_rule_areas.empty();

View File

@ -493,6 +493,8 @@ public:
/// @brief Removes a specific rule area from the cache
void RemoveConnectedRuleArea( SCH_RULE_AREA* aRuleArea );
const std::unordered_set<SCH_RULE_AREA*> GetConnectedRuleAreas() const;
/// @brief Determines dangling state from connectivity and cached connected rule areas
virtual bool IsDangling() const override;

View File

@ -55,6 +55,30 @@ public:
EDA_ITEM* Clone() const override;
/**
* Set or clear the exclude from simulation flag.
*/
void SetExcludedFromSim( bool aExcludeFromSim ) override { m_excludedFromSim = aExcludeFromSim; }
bool GetExcludedFromSim() const override { return m_excludedFromSim; }
/**
* Set or clear the exclude from schematic bill of materials flag.
*/
void SetExcludedFromBOM( bool aExcludeFromBOM ) override { m_excludedFromBOM = aExcludeFromBOM; }
bool GetExcludedFromBOM() const override { return m_excludedFromBOM; }
/**
* Set or clear exclude from board netlist flag.
*/
void SetExcludedFromBoard( bool aExcludeFromBoard ) override { m_excludedFromBoard = aExcludeFromBoard; }
bool GetExcludedFromBoard() const override { return m_excludedFromBoard; }
/**
* Set or clear the 'Do Not Populate' flag.
*/
bool GetDNP() const override { return m_DNP; }
void SetDNP( bool aDNP ) override { m_DNP = aDNP; }
std::vector<int> ViewGetLayers() const override;
bool IsFilledForHitTesting() const override
@ -116,6 +140,12 @@ protected:
/// Clear the list of items which this rule area affects.
void clearContainedItems();
protected:
bool m_excludedFromSim;
bool m_excludedFromBOM;
bool m_excludedFromBoard;
bool m_DNP; ///< True if symbol is set to 'Do Not Populate'.
/// All #SCH_ITEM objects currently contained or intersecting the rule area.
std::unordered_set<SCH_ITEM*> m_items;
@ -123,7 +153,7 @@ protected:
std::unordered_set<SCH_DIRECTIVE_LABEL*> m_directives;
/// All #SCH_ITEM objectss contained or intersecting the rule area in the previous update.
std::unordered_set<SCH_ITEM*> m_prev_items;
std::unordered_set<SCH_ITEM*> m_prev_items;
/// All SCH_DIRECTIVE_LABEL objects attached to the rule area border in the previous update.
std::unordered_set<SCH_DIRECTIVE_LABEL*> m_prev_directives;

View File

@ -272,7 +272,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
{
*token = wxEmptyString;
if( aPath->GetExcludedFromBOM() || this->GetExcludedFromBOM() )
if( aPath->GetExcludedFromBOM() || this->ResolveExcludedFromBOM() )
*token = _( "Excluded from BOM" );
return true;
@ -281,7 +281,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
{
*token = wxEmptyString;
if( aPath->GetExcludedFromBoard() || this->GetExcludedFromBoard() )
if( aPath->GetExcludedFromBoard() || this->ResolveExcludedFromBoard() )
*token = _( "Excluded from board" );
return true;
@ -290,7 +290,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
{
*token = wxEmptyString;
if( aPath->GetExcludedFromSim() || this->GetExcludedFromSim() )
if( aPath->GetExcludedFromSim() || this->ResolveExcludedFromSim() )
*token = _( "Excluded from simulation" );
return true;
@ -299,7 +299,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
{
*token = wxEmptyString;
if( aPath->GetDNP() || this->GetDNP() )
if( aPath->GetDNP() || this->ResolveDNP() )
*token = _( "DNP" );
return true;

View File

@ -387,20 +387,20 @@ public:
/**
* Set or clear the exclude from schematic bill of materials flag.
*/
void SetExcludedFromBOM( bool aExcludeFromBOM ) { m_excludedFromBOM = aExcludeFromBOM; }
bool GetExcludedFromBOM() const { return m_excludedFromBOM; }
void SetExcludedFromBOM( bool aExcludeFromBOM ) override { m_excludedFromBOM = aExcludeFromBOM; }
bool GetExcludedFromBOM() const override { return m_excludedFromBOM; }
/**
* Set or clear exclude from board netlist flag.
*/
void SetExcludedFromBoard( bool aExcludeFromBoard ) { m_excludedFromBoard = aExcludeFromBoard; }
bool GetExcludedFromBoard() const { return m_excludedFromBoard; }
void SetExcludedFromBoard( bool aExcludeFromBoard ) override { m_excludedFromBoard = aExcludeFromBoard; }
bool GetExcludedFromBoard() const override { return m_excludedFromBoard; }
/**
* Set or clear the 'Do Not Populate' flags
*/
bool GetDNP() const { return m_DNP; }
void SetDNP( bool aDNP ) { m_DNP = aDNP; }
bool GetDNP() const override { return m_DNP; }
void SetDNP( bool aDNP ) override { m_DNP = aDNP; }
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;

View File

@ -1424,7 +1424,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, i
{
*token = wxEmptyString;
if( aPath->GetExcludedFromBOM() || this->GetExcludedFromBOM() )
if( aPath->GetExcludedFromBOM() || this->ResolveExcludedFromBOM() )
*token = _( "Excluded from BOM" );
return true;
@ -1433,7 +1433,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, i
{
*token = wxEmptyString;
if( aPath->GetExcludedFromBoard() || this->GetExcludedFromBoard() )
if( aPath->GetExcludedFromBoard() || this->ResolveExcludedFromBoard() )
*token = _( "Excluded from board" );
return true;
@ -1442,7 +1442,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, i
{
*token = wxEmptyString;
if( aPath->GetExcludedFromSim() || this->GetExcludedFromSim() )
if( aPath->GetExcludedFromSim() || this->ResolveExcludedFromSim() )
*token = _( "Excluded from simulation" );
return true;
@ -1451,7 +1451,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, i
{
*token = wxEmptyString;
if( aPath->GetDNP() || this->GetDNP() )
if( aPath->GetDNP() || this->ResolveDNP() )
*token = _( "DNP" );
return true;

View File

@ -177,20 +177,20 @@ public:
/**
* Set or clear the exclude from schematic bill of materials flag.
*/
void SetExcludedFromBOM( bool aExcludeFromBOM ) { m_excludedFromBOM = aExcludeFromBOM; }
bool GetExcludedFromBOM() const { return m_excludedFromBOM; }
void SetExcludedFromBOM( bool aExcludeFromBOM ) override { m_excludedFromBOM = aExcludeFromBOM; }
bool GetExcludedFromBOM() const override { return m_excludedFromBOM; }
/**
* Set or clear exclude from board netlist flag.
*/
void SetExcludedFromBoard( bool aExcludeFromBoard ) { m_excludedFromBoard = aExcludeFromBoard; }
bool GetExcludedFromBoard() const { return m_excludedFromBoard; }
void SetExcludedFromBoard( bool aExcludeFromBoard ) override { m_excludedFromBoard = aExcludeFromBoard; }
bool GetExcludedFromBoard() const override { return m_excludedFromBoard; }
/**
* Set or clear the 'Do Not Populate' flag.
*/
bool GetDNP() const { return m_DNP; }
void SetDNP( bool aDNP ) { m_DNP = aDNP; }
bool GetDNP() const override { return m_DNP; }
void SetDNP( bool aDNP ) override { m_DNP = aDNP; }
virtual int GetOrientation() const { return SYM_NORMAL; }

View File

@ -234,13 +234,13 @@ wxString SYMBOL_SEARCH_HANDLER::getResultCell( const SCH_SEARCH_HIT& aHit, int a
else if( aCol == 5 )
return m_frame->MessageTextFromValue( sym->GetPosition().y );
else if( aCol == 6 )
return sym->GetExcludedFromSim() ? wxS( "X" ) : wxS( " " );
return sym->ResolveExcludedFromSim() ? wxS( "X" ) : wxS( " " );
else if( aCol == 7 )
return sym->GetExcludedFromBOM() ? wxS( "X" ) : wxS( " " );
return sym->ResolveExcludedFromBOM() ? wxS( "X" ) : wxS( " " );
else if( aCol == 8 )
return sym->GetExcludedFromBoard() ? wxS( "X" ) : wxS( " " );
return sym->ResolveExcludedFromBoard() ? wxS( "X" ) : wxS( " " );
else if( aCol == 9 )
return sym->GetDNP() ? wxS( "X" ) : wxS( " " );
return sym->ResolveDNP() ? wxS( "X" ) : wxS( " " );
else if( aCol == 10 )
return sym->GetLibId().Format();
else if( aCol == 11 )