ADDED: support for DNP & friends at the sheet level.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14387
This commit is contained in:
Jeff Young 2024-06-02 22:26:49 +01:00
parent 1f69680d91
commit aee7680a6c
17 changed files with 1978 additions and 1248 deletions

View File

@ -198,6 +198,11 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataToWindow()
m_pageNumberTextCtrl->ChangeValue( pageNumber );
m_cbExcludeFromSim->SetValue( m_sheet->GetExcludedFromSim() );
m_cbExcludeFromBom->SetValue( m_sheet->GetExcludedFromBOM() );
m_cbExcludeFromBoard->SetValue( m_sheet->GetExcludedFromBoard() );
m_cbDNP->SetValue( m_sheet->GetDNP() );
return true;
}
@ -389,7 +394,7 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
m_sheet->SetFields( *m_fields );
m_sheet->SetBorderWidth( m_borderWidth.GetValue() );
m_sheet->SetBorderWidth( m_borderWidth.GetIntValue() );
COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
@ -414,6 +419,11 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
m_sheet->SetBorderColor( m_borderSwatch->GetSwatchColor() );
m_sheet->SetBackgroundColor( m_backgroundSwatch->GetSwatchColor() );
m_sheet->SetExcludedFromSim( m_cbExcludeFromSim->GetValue() );
m_sheet->SetExcludedFromBOM( m_cbExcludeFromBom->GetValue() );
m_sheet->SetExcludedFromBoard( m_cbExcludeFromBoard->GetValue() );
m_sheet->SetDNP( m_cbDNP->GetValue() );
SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
instance.push_back( m_sheet );
@ -447,16 +457,14 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
wxCHECK( aIsUndoable, false );
wxString msg;
wxFileName sheetFileName(
EnsureFileExtension( aNewFilename, FILEEXT::KiCadSchematicFileExtension ) );
wxFileName sheetFileName( EnsureFileExtension( aNewFilename,
FILEEXT::KiCadSchematicFileExtension ) );
// Sheet file names are relative to the path of the current sheet. This allows for
// nesting of schematic files in subfolders. Screen file names are always absolute.
SCHEMATIC& schematic = m_frame->Schematic();
SCH_SHEET_LIST fullHierarchy = schematic.GetFullHierarchy();
wxFileName screenFileName( sheetFileName );
wxFileName tmp( sheetFileName );
SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
wxCHECK( currentScreen, false );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -124,69 +124,129 @@ DIALOG_SHEET_PROPERTIES_BASE::DIALOG_SHEET_PROPERTIES_BASE( wxWindow* parent, wx
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Style") ), wxHORIZONTAL );
m_borderWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Border width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
sbSizer2->Add( m_borderWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
m_borderWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_borderWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_borderWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
sbSizer2->Add( m_borderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
sbSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
m_borderColorLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Border color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
sbSizer2->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_borderSwatch = new COLOR_SWATCH( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_borderSwatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_borderSwatch->SetMinSize( wxSize( 48,24 ) );
sbSizer2->Add( m_borderSwatch, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer2->Add( 40, 0, 1, wxEXPAND, 5 );
m_backgroundColorLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Background fill:"), wxDefaultPosition, wxDefaultSize, 0 );
m_backgroundColorLabel->Wrap( -1 );
sbSizer2->Add( m_backgroundColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_backgroundSwatch = new COLOR_SWATCH( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_backgroundSwatch->SetMinSize( wxSize( 48,24 ) );
sbSizer2->Add( m_backgroundSwatch, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizer5->Add( sbSizer2, 1, wxEXPAND|wxBOTTOM, 5 );
m_longForm->Add( bSizer5, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( m_longForm, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbAttributes;
sbAttributes = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Attributes") ), wxVERTICAL );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
m_pageNumberStaticText = new wxStaticText( this, wxID_ANY, _("Page number:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pageNumberStaticText = new wxStaticText( sbAttributes->GetStaticBox(), wxID_ANY, _("Page number:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pageNumberStaticText->Wrap( -1 );
bSizer6->Add( m_pageNumberStaticText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_pageNumberTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_pageNumberTextCtrl = new wxTextCtrl( sbAttributes->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer6->Add( m_pageNumberTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bSizer6->Add( 0, 0, 3, wxEXPAND, 5 );
mainSizer->Add( bSizer6, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
sbAttributes->Add( bSizer6, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 10 );
m_cbExcludeFromSim = new wxCheckBox( sbAttributes->GetStaticBox(), wxID_ANY, _("Exclude from simulation"), wxDefaultPosition, wxDefaultSize, 0 );
sbAttributes->Add( m_cbExcludeFromSim, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
sbAttributes->Add( 0, 10, 0, wxEXPAND, 5 );
m_cbExcludeFromBom = new wxCheckBox( sbAttributes->GetStaticBox(), 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") );
sbAttributes->Add( m_cbExcludeFromBom, 0, wxALL, 5 );
m_cbExcludeFromBoard = new wxCheckBox( sbAttributes->GetStaticBox(), 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") );
sbAttributes->Add( m_cbExcludeFromBoard, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbDNP = new wxCheckBox( sbAttributes->GetStaticBox(), wxID_ANY, _("Do not populate"), wxDefaultPosition, wxDefaultSize, 0 );
sbAttributes->Add( m_cbDNP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizer5->Add( sbAttributes, 0, wxEXPAND|wxRIGHT, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Style") ), wxVERTICAL );
wxBoxSizer* bStyleColumns;
bStyleColumns = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bBorderSizer;
bBorderSizer = new wxBoxSizer( wxVERTICAL );
m_borderLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderLabel->Wrap( -1 );
bBorderSizer->Add( m_borderLabel, 0, wxBOTTOM|wxLEFT, 5 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
m_borderWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
bSizer10->Add( m_borderWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
m_borderWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer10->Add( m_borderWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_borderWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
bSizer10->Add( m_borderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
bSizer10->Add( 20, 0, 0, wxEXPAND, 5 );
m_borderColorLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
bSizer10->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_borderSwatch = new COLOR_SWATCH( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_borderSwatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_borderSwatch->SetMinSize( wxSize( 48,24 ) );
bSizer10->Add( m_borderSwatch, 0, wxALIGN_CENTER_VERTICAL, 5 );
bBorderSizer->Add( bSizer10, 1, wxEXPAND, 5 );
bStyleColumns->Add( bBorderSizer, 2, wxEXPAND, 5 );
wxBoxSizer* bFillSizer;
bFillSizer = new wxBoxSizer( wxVERTICAL );
m_fillLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Fill"), wxDefaultPosition, wxDefaultSize, 0 );
m_fillLabel->Wrap( -1 );
bFillSizer->Add( m_fillLabel, 0, wxBOTTOM, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
m_backgroundColorLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_backgroundColorLabel->Wrap( -1 );
bSizer11->Add( m_backgroundColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_backgroundSwatch = new COLOR_SWATCH( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_backgroundSwatch->SetMinSize( wxSize( 48,24 ) );
bSizer11->Add( m_backgroundSwatch, 0, wxALIGN_CENTER_VERTICAL, 5 );
bFillSizer->Add( bSizer11, 1, wxEXPAND, 5 );
bStyleColumns->Add( bFillSizer, 1, wxEXPAND, 5 );
sbSizer2->Add( bStyleColumns, 0, wxEXPAND, 5 );
bSizer5->Add( sbSizer2, 1, wxEXPAND|wxLEFT, 10 );
m_longForm->Add( bSizer5, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( m_longForm, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sizerBottom = new wxBoxSizer( wxHORIZONTAL );
@ -223,6 +283,9 @@ DIALOG_SHEET_PROPERTIES_BASE::DIALOG_SHEET_PROPERTIES_BASE( wxWindow* parent, wx
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_cbExcludeFromSim->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_cbExcludeFromBom->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_cbExcludeFromBoard->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnCheckBox ), NULL, this );
}
DIALOG_SHEET_PROPERTIES_BASE::~DIALOG_SHEET_PROPERTIES_BASE()
@ -235,5 +298,8 @@ DIALOG_SHEET_PROPERTIES_BASE::~DIALOG_SHEET_PROPERTIES_BASE()
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_cbExcludeFromSim->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_cbExcludeFromBom->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_cbExcludeFromBoard->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnCheckBox ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -32,6 +32,7 @@ class WX_INFOBAR;
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -52,15 +53,21 @@ class DIALOG_SHEET_PROPERTIES_BASE : public DIALOG_SHIM
STD_BITMAP_BUTTON* m_bpMoveUp;
STD_BITMAP_BUTTON* m_bpMoveDown;
STD_BITMAP_BUTTON* m_bpDelete;
wxStaticText* m_pageNumberStaticText;
wxTextCtrl* m_pageNumberTextCtrl;
wxCheckBox* m_cbExcludeFromSim;
wxCheckBox* m_cbExcludeFromBom;
wxCheckBox* m_cbExcludeFromBoard;
wxCheckBox* m_cbDNP;
wxStaticText* m_borderLabel;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
wxStaticText* m_borderColorLabel;
COLOR_SWATCH* m_borderSwatch;
wxStaticText* m_fillLabel;
wxStaticText* m_backgroundColorLabel;
COLOR_SWATCH* m_backgroundSwatch;
wxStaticText* m_pageNumberStaticText;
wxTextCtrl* m_pageNumberTextCtrl;
wxBoxSizer* m_sizerBottom;
wxStaticText* m_hierarchicalPathLabel;
wxStaticText* m_hierarchicalPath;
@ -76,6 +83,7 @@ class DIALOG_SHEET_PROPERTIES_BASE : public DIALOG_SHIM
virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckBox( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -1278,6 +1278,9 @@ int ERC_TESTER::TestSimModelIssues()
for( SCH_SHEET_PATH& sheet : sheets )
{
if( sheet.GetExcludedFromSim() )
continue;
std::vector<SCH_MARKER*> markers;
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )

View File

@ -204,6 +204,9 @@ bool NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries( unsigned aNetlistOptions
for( SCH_SHEET_PATH& sheet : GetSheets( aNetlistOptions ) )
{
if( sheet.GetExcludedFromSim() )
continue;
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
@ -326,6 +329,9 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions )
for( const SCH_SHEET_PATH& sheet : GetSheets( aNetlistOptions ) )
{
if( sheet.GetExcludedFromSim() )
continue;
for( SCH_ITEM* item : sheet.LastScreen()->Items() )
{
if( item->GetExcludedFromSim() )

View File

@ -292,13 +292,17 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
for( EDA_ITEM* item : ordered_symbols )
{
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
bool forBOM = aCtl & GNL_OPT_BOM;
bool forBoard = aCtl & GNL_OPT_KICAD;
if( !symbol
|| ( ( aCtl & GNL_OPT_BOM ) && symbol->GetExcludedFromBOM() )
|| ( ( aCtl & GNL_OPT_KICAD ) && symbol->GetExcludedFromBoard() ) )
{
if( !symbol )
continue;
if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->GetExcludedFromBOM() ) )
continue;
if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->GetExcludedFromBoard() ) )
continue;
}
// Output the symbol's elements in order of expected access frequency. This may
// not always look best, but it will allow faster execution under XSL processing
@ -730,13 +734,17 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
{
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( pin->GetParentSymbol() );
bool forBOM = aCtl & GNL_OPT_BOM;
bool forBoard = aCtl & GNL_OPT_KICAD;
if( !symbol
|| ( ( aCtl & GNL_OPT_BOM ) && symbol->GetExcludedFromBOM() )
|| ( ( aCtl & GNL_OPT_KICAD ) && symbol->GetExcludedFromBoard() ) )
{
if( !symbol )
continue;
if( forBOM && ( sheet.GetExcludedFromBOM() || symbol->GetExcludedFromBOM() ) )
continue;
if( forBoard && ( sheet.GetExcludedFromBoard() || symbol->GetExcludedFromBoard() ) )
continue;
}
net_record->m_Nodes.emplace_back( pin, sheet );
}

View File

@ -1521,6 +1521,9 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
//
for( SCH_ITEM* item : GetScreen()->Items() )
{
if( GetCurrentSheet().GetExcludedFromSim() )
continue;
if( item->Type() == SCH_LINE_T )
{
SCH_LINE* line = static_cast<SCH_LINE*>( item );
@ -1600,6 +1603,9 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
SCH_LINE* longestWire = nullptr;
double length = 0.0;
if( subgraph->GetSheet().GetExcludedFromSim() )
continue;
for( SCH_ITEM* item : subgraph->GetItems() )
{
if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T } ) )

View File

@ -104,4 +104,5 @@
//#define SEXPR_SCHEMATIC_FILE_VERSION 20230819 // Allow multiple library symbol inheritance depth.
//#define SEXPR_SCHEMATIC_FILE_VERSION 20231120 // generator_version; V8 cleanups
//#define SEXPR_SCHEMATIC_FILE_VERSION 20240101 // Tables.
#define SEXPR_SCHEMATIC_FILE_VERSION 20240417 // Rule areas
//#define SEXPR_SCHEMATIC_FILE_VERSION 20240417 // Rule areas
#define SEXPR_SCHEMATIC_FILE_VERSION 20240602 // Sheet attributes

View File

@ -1012,6 +1012,11 @@ void SCH_IO_KICAD_SEXPR::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale,
aSheet->GetSize().y ).c_str() );
m_out->Print( 0, " (exclude_from_sim %s)", ( aSheet->GetExcludedFromSim() ) ? "yes" : "no" );
m_out->Print( 0, " (in_bom %s)", ( aSheet->GetExcludedFromBOM() ) ? "no" : "yes" );
m_out->Print( 0, " (on_board %s)", ( aSheet->GetExcludedFromBoard() ) ? "no" : "yes" );
m_out->Print( 0, " (dnp %s)", ( aSheet->GetDNP() ) ? "yes" : "no" );
if( aSheet->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
m_out->Print( 0, " (fields_autoplaced yes)" );

View File

@ -3288,6 +3288,26 @@ SCH_SHEET* SCH_IO_KICAD_SEXPR_PARSER::parseSheet()
break;
}
case T_exclude_from_sim:
sheet->SetExcludedFromSim( parseBool() );
NeedRIGHT();
break;
case T_in_bom:
sheet->SetExcludedFromBOM( !parseBool() );
NeedRIGHT();
break;
case T_on_board:
sheet->SetExcludedFromBoard( !parseBool() );
NeedRIGHT();
break;
case T_dnp:
sheet->SetDNP( parseBool() );
NeedRIGHT();
break;
case T_fields_autoplaced:
if( parseMaybeAbsentBool( true ) )
sheet->SetFieldsAutoplaced();

View File

@ -218,7 +218,7 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
draw( static_cast<const SCH_FIELD*>( aItem ), aLayer, aDimmed );
break;
case SCH_HIER_LABEL_T:
draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer );
draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer, aDimmed );
break;
case SCH_GLOBAL_LABEL_T:
draw( static_cast<const SCH_GLOBALLABEL*>( aItem ), aLayer );
@ -227,7 +227,7 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
draw( static_cast<const SCH_SHEET*>( aItem ), aLayer );
break;
case SCH_SHEET_PIN_T:
draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer );
draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer, aDimmed );
break;
case SCH_NO_CONNECT_T:
draw( static_cast<const SCH_NO_CONNECT*>( aItem ), aLayer );
@ -2532,7 +2532,7 @@ void SCH_PAINTER::draw( const SCH_LABEL* aLabel, int aLayer )
}
void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer )
void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
@ -2553,7 +2553,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer )
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows );
COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows, aDimmed );
if( drawingDangling )
{
@ -2575,7 +2575,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer )
conn = aLabel->Connection();
if( conn && conn->IsBus() )
color = getRenderColor( aLabel, LAYER_BUS, drawingShadows );
color = getRenderColor( aLabel, LAYER_BUS, drawingShadows, aDimmed );
}
std::vector<VECTOR2I> pts;
@ -2675,10 +2675,10 @@ void SCH_PAINTER::draw( const SCH_SHEET* aSheet, int aLayer )
if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children )
{
for( const SCH_FIELD& field : aSheet->GetFields() )
draw( &field, aLayer, false );
draw( &field, aLayer, aSheet->GetDNP() );
for( SCH_SHEET_PIN* sheetPin : aSheet->GetPins() )
draw( static_cast<SCH_HIERLABEL*>( sheetPin ), aLayer );
draw( static_cast<SCH_HIERLABEL*>( sheetPin ), aLayer, aSheet->GetDNP() );
}
if( isFieldsLayer( aLayer ) )
@ -2710,6 +2710,33 @@ void SCH_PAINTER::draw( const SCH_SHEET* aSheet, int aLayer )
m_gal->DrawRectangle( pos, pos + size );
}
if( aSheet->GetDNP() )
{
BOX2I bbox = aSheet->GetBodyBoundingBox();
BOX2I pins = aSheet->GetBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
bbox.Inflate( KiROUND( margins.x ), KiROUND( margins.y ) );
VECTOR2I pt1 = bbox.GetOrigin();
VECTOR2I pt2 = bbox.GetEnd();
m_gal->PushDepth();
m_gal->AdvanceDepth();
m_gal->SetIsStroke( true );
m_gal->SetIsFill( true );
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_DNP_MARKER ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_DNP_MARKER ) );
m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
std::swap( pt1.x, pt2.x );
m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
m_gal->PopDepth();
}
}

View File

@ -92,7 +92,7 @@ private:
void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed );
void draw( const SCH_LABEL* aLabel, int aLayer );
void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
void draw( const SCH_HIERLABEL* aLabel, int aLayer );
void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed );
void draw( const SCH_GLOBALLABEL* aLabel, int aLayer );
void draw( const SCH_SHEET* aSheet, int aLayer );
void draw( const SCH_NO_CONNECT* aNC, int aLayer );

View File

@ -363,6 +363,30 @@ public:
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) 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 ) { m_excludedFromBOM = aExcludeFromBOM; }
bool GetExcludedFromBOM() const { return m_excludedFromBOM; }
/**
* Set or clear exclude from board netlist flag.
*/
void SetExcludedFromBoard( bool aExcludeFromBoard ) { m_excludedFromBoard = aExcludeFromBoard; }
bool GetExcludedFromBoard() const { return m_excludedFromBoard; }
/**
* Set or clear the 'Do Not Populate' flaga
*/
bool GetDNP() const { return m_DNP; }
void SetDNP( bool aDNP ) { m_DNP = aDNP; }
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
BITMAPS GetMenuImage() const override;
@ -517,6 +541,11 @@ private:
std::vector<SCH_SHEET_PIN*> m_pins; // The list of sheet connection points.
std::vector<SCH_FIELD> m_fields;
bool m_excludedFromSim;
bool m_excludedFromBOM;
bool m_excludedFromBoard;
bool m_DNP;
VECTOR2I m_pos; // The position of the sheet.
VECTOR2I m_size; // The size of the sheet.
int m_borderWidth;

View File

@ -261,6 +261,54 @@ SCH_SCREEN* SCH_SHEET_PATH::LastScreen() const
}
bool SCH_SHEET_PATH::GetExcludedFromSim() const
{
for( SCH_SHEET* sheet : m_sheets )
{
if( sheet->GetExcludedFromSim() )
return true;
}
return false;
}
bool SCH_SHEET_PATH::GetExcludedFromBOM() const
{
for( SCH_SHEET* sheet : m_sheets )
{
if( sheet->GetExcludedFromBOM() )
return true;
}
return false;
}
bool SCH_SHEET_PATH::GetExcludedFromBoard() const
{
for( SCH_SHEET* sheet : m_sheets )
{
if( sheet->GetExcludedFromBoard() )
return true;
}
return false;
}
bool SCH_SHEET_PATH::GetDNP() const
{
for( SCH_SHEET* sheet : m_sheets )
{
if( sheet->GetDNP() )
return true;
}
return false;
}
wxString SCH_SHEET_PATH::PathAsString() const
{
wxString s;

View File

@ -263,6 +263,11 @@ public:
///< @copydoc SCH_SHEET_PATH::LastScreen()
SCH_SCREEN* LastScreen() const;
bool GetExcludedFromSim() const;
bool GetExcludedFromBOM() const;
bool GetExcludedFromBoard() const;
bool GetDNP() const;
/**
* Fetch a SCH_ITEM by ID.
*/

View File

@ -1458,22 +1458,38 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, i
}
else if( token->IsSameAs( wxT( "EXCLUDE_FROM_BOM" ) ) )
{
*token = this->GetExcludedFromBOM() ? _( "Excluded from BOM" ) : wxString( "" );
*token = wxEmptyString;
if( aPath->GetExcludedFromBOM() || this->GetExcludedFromBOM() )
*token = _( "Excluded from BOM" );
return true;
}
else if( token->IsSameAs( wxT( "EXCLUDE_FROM_BOARD" ) ) )
{
*token = this->GetExcludedFromBoard() ? _( "Excluded from board" ) : wxString( "" );
*token = wxEmptyString;
if( aPath->GetExcludedFromBoard() || this->GetExcludedFromBoard() )
*token = _( "Excluded from board" );
return true;
}
else if( token->IsSameAs( wxT( "EXCLUDE_FROM_SIM" ) ) )
{
*token = this->GetExcludedFromSim() ? _( "Excluded from simulation" ) : wxString( "" );
*token = wxEmptyString;
if( aPath->GetExcludedFromSim() || this->GetExcludedFromSim() )
*token = _( "Excluded from simulation" );
return true;
}
else if( token->IsSameAs( wxT( "DNP" ) ) )
{
*token = this->GetDNP() ? _( "DNP" ) : wxString( "" );
*token = wxEmptyString;
if( aPath->GetDNP() || this->GetDNP() )
*token = _( "DNP" );
return true;
}
else if( token->StartsWith( wxT( "SHORT_NET_NAME(" ) )