Eeschema: add support for excluding symbols from board.
ADDED: Support for excluding symbols from board during. This allows for creating bill of materials only symbols. Fixes https://gitlab.com/kicad/code/kicad/-/issues/2522
This commit is contained in:
parent
d7d877241a
commit
037898f6fb
|
@ -154,24 +154,6 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindComponentAndItem( const wxString& aReference,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute a remote command sent by Pcbnew via a socket connection.
|
|
||||||
* <p>
|
|
||||||
* When user selects a module or pin in Pcbnew, Eeschema shows that same
|
|
||||||
* component or pin and moves cursor on the item. The socket port used
|
|
||||||
* is #KICAD_SCH_PORT_SERVICE_NUMBER which defaults to 4243.
|
|
||||||
*
|
|
||||||
* Valid commands are:
|
|
||||||
* \li \c \$PART: \c "reference" Put cursor on component.
|
|
||||||
* \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on component reference.
|
|
||||||
* \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on component value.
|
|
||||||
* \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the component pin.
|
|
||||||
* \li \c \$NET: \c "netname" Highlight a specified net
|
|
||||||
* \li \c \$CLEAR: \c "HIGHLIGHTED" Clear components highlight
|
|
||||||
* <p>
|
|
||||||
* They are a keyword followed by a quoted string.
|
|
||||||
* @param cmdline = received command from Pcbnew
|
|
||||||
*/
|
|
||||||
void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
{
|
{
|
||||||
SCH_EDITOR_CONTROL* editor = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
|
SCH_EDITOR_CONTROL* editor = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
|
||||||
|
@ -463,7 +445,7 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
NETLIST_EXPORTER_KICAD exporter( &Schematic() );
|
NETLIST_EXPORTER_KICAD exporter( &Schematic() );
|
||||||
STRING_FORMATTER formatter;
|
STRING_FORMATTER formatter;
|
||||||
|
|
||||||
exporter.Format( &formatter, GNL_ALL );
|
exporter.Format( &formatter, GNL_ALL | GNL_OPT_KICAD );
|
||||||
|
|
||||||
payload = formatter.GetString();
|
payload = formatter.GetString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,7 +475,7 @@ void DIALOG_BOM::OnRunGenerator( wxCommandEvent& event )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_parent->ReadyToNetlist( false, false ) )
|
if( m_parent->ReadyToNetlist( false, false ) )
|
||||||
m_parent->WriteNetListFile( -1, fullfilename, 0, &reporter );
|
m_parent->WriteNetListFile( -1, fullfilename, GNL_OPT_BOM, &reporter );
|
||||||
|
|
||||||
m_Messages->SetValue( reportmsg );
|
m_Messages->SetValue( reportmsg );
|
||||||
|
|
||||||
|
|
|
@ -224,6 +224,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
|
||||||
m_libraryNameTextCtrl->SetValue( m_cmp->GetLibId().Format() );
|
m_libraryNameTextCtrl->SetValue( m_cmp->GetLibId().Format() );
|
||||||
|
|
||||||
m_cbExcludeFromBom->SetValue( !m_cmp->GetIncludeInBom() );
|
m_cbExcludeFromBom->SetValue( !m_cmp->GetIncludeInBom() );
|
||||||
|
m_cbExcludeFromBoard->SetValue( !m_cmp->GetIncludeOnBoard() );
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
|
@ -518,6 +519,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
||||||
m_cmp->SetRef( &GetParent()->GetCurrentSheet(), m_fields->at( REFERENCE ).GetText() );
|
m_cmp->SetRef( &GetParent()->GetCurrentSheet(), m_fields->at( REFERENCE ).GetText() );
|
||||||
|
|
||||||
m_cmp->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
|
m_cmp->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
|
||||||
|
m_cmp->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
|
||||||
|
|
||||||
// The value, footprint and datasheet fields and exclude from bill of materials setting
|
// The value, footprint and datasheet fields and exclude from bill of materials setting
|
||||||
// should be kept in sync in multi-unit parts.
|
// should be kept in sync in multi-unit parts.
|
||||||
|
|
|
@ -118,7 +118,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE
|
||||||
sbSizerLibraryReference = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbol") ), wxVERTICAL );
|
sbSizerLibraryReference = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbol") ), wxVERTICAL );
|
||||||
|
|
||||||
wxFlexGridSizer* fgSizer1;
|
wxFlexGridSizer* fgSizer1;
|
||||||
fgSizer1 = new wxFlexGridSizer( 4, 2, 0, 0 );
|
fgSizer1 = new wxFlexGridSizer( 5, 2, 0, 0 );
|
||||||
fgSizer1->AddGrowableCol( 1 );
|
fgSizer1->AddGrowableCol( 1 );
|
||||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||||
|
@ -168,7 +168,15 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE
|
||||||
m_cbExcludeFromBom = new wxCheckBox( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, _("Exclude from bill of materials"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_cbExcludeFromBom = new wxCheckBox( sbSizerLibraryReference->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") );
|
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") );
|
||||||
|
|
||||||
fgSizer1->Add( m_cbExcludeFromBom, 0, wxBOTTOM, 5 );
|
fgSizer1->Add( m_cbExcludeFromBom, 0, 0, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_cbExcludeFromBoard = new wxCheckBox( sbSizerLibraryReference->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") );
|
||||||
|
|
||||||
|
fgSizer1->Add( m_cbExcludeFromBoard, 0, wxBOTTOM, 5 );
|
||||||
|
|
||||||
|
|
||||||
sbSizerLibraryReference->Add( fgSizer1, 0, wxEXPAND, 5 );
|
sbSizerLibraryReference->Add( fgSizer1, 0, wxEXPAND, 5 );
|
||||||
|
|
|
@ -183,6 +183,7 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
|
<property name="auth_needed">0</property>
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
@ -256,6 +257,7 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
|
<property name="auth_needed">0</property>
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
@ -329,6 +331,7 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
|
<property name="auth_needed">0</property>
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
@ -412,6 +415,7 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
|
<property name="auth_needed">0</property>
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
@ -495,6 +499,7 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
|
<property name="auth_needed">0</property>
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
@ -594,7 +599,7 @@
|
||||||
<property name="name">fgSizer1</property>
|
<property name="name">fgSizer1</property>
|
||||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<property name="rows">4</property>
|
<property name="rows">5</property>
|
||||||
<property name="vgap">0</property>
|
<property name="vgap">0</property>
|
||||||
<object class="sizeritem" expanded="0">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
|
@ -743,6 +748,7 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
|
<property name="auth_needed">0</property>
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
@ -1016,7 +1022,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxBOTTOM</property>
|
<property name="flag"></property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxCheckBox" expanded="1">
|
<object class="wxCheckBox" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -1078,6 +1084,80 @@
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxEXPAND</property>
|
||||||
|
<property name="proportion">1</property>
|
||||||
|
<object class="spacer" expanded="1">
|
||||||
|
<property name="height">0</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="width">0</property>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxBOTTOM</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxCheckBox" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></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="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
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>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1442,6 +1522,7 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
|
<property name="auth_needed">0</property>
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
|
|
@ -58,6 +58,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE : public DIALOG_SHIM
|
||||||
wxChoice* m_unitChoice;
|
wxChoice* m_unitChoice;
|
||||||
wxCheckBox* m_cbAlternateSymbol;
|
wxCheckBox* m_cbAlternateSymbol;
|
||||||
wxCheckBox* m_cbExcludeFromBom;
|
wxCheckBox* m_cbExcludeFromBom;
|
||||||
|
wxCheckBox* m_cbExcludeFromBoard;
|
||||||
wxRadioBox* m_rbOrientation;
|
wxRadioBox* m_rbOrientation;
|
||||||
wxRadioBox* m_rbMirror;
|
wxRadioBox* m_rbMirror;
|
||||||
wxStaticLine* m_staticline1;
|
wxStaticLine* m_staticline1;
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
|
|
||||||
static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 );
|
static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 );
|
||||||
|
|
||||||
bool NETLIST_EXPORTER_GENERIC::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
|
bool NETLIST_EXPORTER_GENERIC::WriteNetlist( const wxString& aOutFileName,
|
||||||
|
unsigned aNetlistOptions )
|
||||||
{
|
{
|
||||||
// output the XML format netlist.
|
// output the XML format netlist.
|
||||||
wxXmlDocument xdoc;
|
wxXmlDocument xdoc;
|
||||||
|
@ -58,7 +59,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeRoot( int aCtl )
|
||||||
xroot->AddChild( makeDesignHeader() );
|
xroot->AddChild( makeDesignHeader() );
|
||||||
|
|
||||||
if( aCtl & GNL_COMPONENTS )
|
if( aCtl & GNL_COMPONENTS )
|
||||||
xroot->AddChild( makeComponents() );
|
xroot->AddChild( makeComponents( aCtl ) );
|
||||||
|
|
||||||
if( aCtl & GNL_PARTS )
|
if( aCtl & GNL_PARTS )
|
||||||
xroot->AddChild( makeLibParts() );
|
xroot->AddChild( makeLibParts() );
|
||||||
|
@ -85,7 +86,8 @@ struct COMP_FIELDS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT* comp, SCH_SHEET_PATH* aSheet )
|
void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT* comp,
|
||||||
|
SCH_SHEET_PATH* aSheet )
|
||||||
{
|
{
|
||||||
COMP_FIELDS fields;
|
COMP_FIELDS fields;
|
||||||
|
|
||||||
|
@ -117,7 +119,8 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT*
|
||||||
int unit = comp2->GetUnit();
|
int unit = comp2->GetUnit();
|
||||||
|
|
||||||
// The lowest unit number wins. User should only set fields in any one unit.
|
// The lowest unit number wins. User should only set fields in any one unit.
|
||||||
// remark: IsVoid() returns true for empty strings or the "~" string (empty field value)
|
// remark: IsVoid() returns true for empty strings or the "~" string (empty
|
||||||
|
// field value)
|
||||||
if( !comp2->GetField( VALUE )->IsVoid()
|
if( !comp2->GetField( VALUE )->IsVoid()
|
||||||
&& ( unit < minUnit || fields.value.IsEmpty() ) )
|
&& ( unit < minUnit || fields.value.IsEmpty() ) )
|
||||||
fields.value = comp2->GetField( VALUE )->GetText();
|
fields.value = comp2->GetField( VALUE )->GetText();
|
||||||
|
@ -190,7 +193,7 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XNODE* NETLIST_EXPORTER_GENERIC::makeComponents()
|
XNODE* NETLIST_EXPORTER_GENERIC::makeComponents( unsigned aCtl )
|
||||||
{
|
{
|
||||||
XNODE* xcomps = node( "components" );
|
XNODE* xcomps = node( "components" );
|
||||||
|
|
||||||
|
@ -234,7 +237,9 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeComponents()
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* comp = findNextComponent( item, &sheet );
|
SCH_COMPONENT* comp = findNextComponent( item, &sheet );
|
||||||
|
|
||||||
if( !comp || !comp->GetIncludeInBom() )
|
if( !comp
|
||||||
|
|| ( ( aCtl & GNL_OPT_BOM ) && !comp->GetIncludeInBom() )
|
||||||
|
|| ( ( aCtl & GNL_OPT_KICAD ) && !comp->GetIncludeOnBoard() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
XNODE* xcomp; // current component being constructed
|
XNODE* xcomp; // current component being constructed
|
||||||
|
@ -597,7 +602,8 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XNODE* NETLIST_EXPORTER_GENERIC::node( const wxString& aName, const wxString& aTextualContent /* = wxEmptyString*/ )
|
XNODE* NETLIST_EXPORTER_GENERIC::node( const wxString& aName,
|
||||||
|
const wxString& aTextualContent /* = wxEmptyString*/ )
|
||||||
{
|
{
|
||||||
XNODE* n = new XNODE( wxXML_ELEMENT_NODE, aName );
|
XNODE* n = new XNODE( wxXML_ELEMENT_NODE, aName );
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2018 KiCad Developers
|
* Copyright (C) 1992-2020 KiCad Developers
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -39,8 +39,7 @@ class SYMBOL_LIB_TABLE;
|
||||||
#define GENERIC_INTERMEDIATE_NETLIST_EXT wxT( "xml" )
|
#define GENERIC_INTERMEDIATE_NETLIST_EXT wxT( "xml" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum GNL
|
* A set of bits which control the totality of the tree built by makeRoot()
|
||||||
* is a set of bit which control the totality of the tree built by makeRoot()
|
|
||||||
*/
|
*/
|
||||||
enum GNL_T
|
enum GNL_T
|
||||||
{
|
{
|
||||||
|
@ -49,13 +48,16 @@ enum GNL_T
|
||||||
GNL_PARTS = 1 << 2,
|
GNL_PARTS = 1 << 2,
|
||||||
GNL_HEADER = 1 << 3,
|
GNL_HEADER = 1 << 3,
|
||||||
GNL_NETS = 1 << 4,
|
GNL_NETS = 1 << 4,
|
||||||
|
GNL_OPT_KICAD = 1 << 5,
|
||||||
|
GNL_OPT_BOM = 1 << 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NETLIST_EXPORTER_GENERIC
|
* Generate a generic XML based netlist file.
|
||||||
* generates a generic XML based netlist file. This allows using XSLT or other methods to
|
*
|
||||||
* transform the XML to other netlist formats outside of the C++ codebase.
|
* This allows using XSLT or other methods to transform the XML to other netlist formats
|
||||||
|
* outside of the C++ codebase.
|
||||||
*/
|
*/
|
||||||
class NETLIST_EXPORTER_GENERIC : public NETLIST_EXPORTER
|
class NETLIST_EXPORTER_GENERIC : public NETLIST_EXPORTER
|
||||||
{
|
{
|
||||||
|
@ -68,8 +70,12 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function WriteNetlist
|
* Write generic netlist to \a aOutFileName.
|
||||||
* writes to specified output file
|
*
|
||||||
|
* @param aOutFileName is the file name to write.
|
||||||
|
* @param aNetlistOptions are the options used to control the netlist output.
|
||||||
|
*
|
||||||
|
* @return true if the netlist was written successfully.
|
||||||
*/
|
*/
|
||||||
bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override;
|
bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override;
|
||||||
|
|
||||||
|
@ -77,8 +83,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Function node
|
* A convenience function that creates a new XNODE with an optional textual child.
|
||||||
* is a convenience function that creates a new XNODE with an optional textual child.
|
|
||||||
* It also provides some insulation from a possible change in XML library.
|
* It also provides some insulation from a possible change in XML library.
|
||||||
*
|
*
|
||||||
* @param aName is the name to associate with a new node of type wxXML_ELEMENT_NODE.
|
* @param aName is the name to associate with a new node of type wxXML_ELEMENT_NODE.
|
||||||
|
@ -88,8 +93,7 @@ protected:
|
||||||
XNODE* node( const wxString& aName, const wxString& aTextualContent = wxEmptyString );
|
XNODE* node( const wxString& aName, const wxString& aTextualContent = wxEmptyString );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function makeGenericRoot
|
* Build the entire document tree for the generic export. This is factored
|
||||||
* builds the entire document tree for the generic export. This is factored
|
|
||||||
* out here so we can write the tree in either S-expression file format
|
* out here so we can write the tree in either S-expression file format
|
||||||
* or in XML if we put the tree built here into a wxXmlDocument.
|
* or in XML if we put the tree built here into a wxXmlDocument.
|
||||||
* @param aCtl - a bitset or-ed together from GNL_ENUM values
|
* @param aCtl - a bitset or-ed together from GNL_ENUM values
|
||||||
|
@ -98,35 +102,30 @@ protected:
|
||||||
XNODE* makeRoot( int aCtl = GNL_ALL );
|
XNODE* makeRoot( int aCtl = GNL_ALL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function makeComponents
|
|
||||||
* @return XNODE* - returns a sub-tree holding all the schematic components.
|
* @return XNODE* - returns a sub-tree holding all the schematic components.
|
||||||
*/
|
*/
|
||||||
XNODE* makeComponents();
|
XNODE* makeComponents( unsigned aCtl );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function makeDesignHeader
|
* Fills out a project "design" header into an XML node.
|
||||||
* fills out a project "design" header into an XML node.
|
|
||||||
* @return XNODE* - the design header
|
* @return XNODE* - the design header
|
||||||
*/
|
*/
|
||||||
XNODE* makeDesignHeader();
|
XNODE* makeDesignHeader();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function makeLibParts
|
* Fill out an XML node with the unique library parts and returns it.
|
||||||
* fills out an XML node with the unique library parts and returns it.
|
|
||||||
* @return XNODE* - the library parts nodes
|
* @return XNODE* - the library parts nodes
|
||||||
*/
|
*/
|
||||||
XNODE* makeLibParts();
|
XNODE* makeLibParts();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function makeListOfNets
|
* Fill out an XML node with a list of nets and returns it.
|
||||||
* fills out an XML node with a list of nets and returns it.
|
|
||||||
* @return XNODE* - the list of nets nodes
|
* @return XNODE* - the list of nets nodes
|
||||||
*/
|
*/
|
||||||
XNODE* makeListOfNets();
|
XNODE* makeListOfNets();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function makeLibraries
|
* Fill out an XML node with a list of used libraries and returns it.
|
||||||
* fills out an XML node with a list of used libraries and returns it.
|
|
||||||
* Must have called makeGenericLibParts() before this function.
|
* Must have called makeGenericLibParts() before this function.
|
||||||
* @return XNODE* - the library nodes
|
* @return XNODE* - the library nodes
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.TXT for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -39,7 +39,7 @@ bool NETLIST_EXPORTER_KICAD::WriteNetlist( const wxString& aOutFileName, unsigne
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FILE_OUTPUTFORMATTER formatter( aOutFileName );
|
FILE_OUTPUTFORMATTER formatter( aOutFileName );
|
||||||
Format( &formatter, GNL_ALL );
|
Format( &formatter, GNL_ALL | GNL_OPT_KICAD );
|
||||||
}
|
}
|
||||||
|
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2017 KiCad Developers
|
* Copyright (C) 1992-2020 KiCad Developers
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -31,9 +31,8 @@
|
||||||
class OUTPUTFORMATTER;
|
class OUTPUTFORMATTER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NETLIST_EXPORTER_KICAD
|
* Generate the KiCad netlist format supported by Pcbnew. It is basically the generic
|
||||||
* generates the kicad netlist format supported by pcbnew. It is basically
|
* netlist format just formatted slightly different.
|
||||||
* the generic netlist format just formatted slightly different.
|
|
||||||
*/
|
*/
|
||||||
class NETLIST_EXPORTER_KICAD : public NETLIST_EXPORTER_GENERIC
|
class NETLIST_EXPORTER_KICAD : public NETLIST_EXPORTER_GENERIC
|
||||||
{
|
{
|
||||||
|
@ -43,14 +42,13 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function WriteNetlist
|
* Write netlist to \a aOutFileName.
|
||||||
* writes to specified output file
|
|
||||||
*/
|
*/
|
||||||
bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override;
|
bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Format
|
* Output this s-expression netlist into @a aOutputFormatter.
|
||||||
* outputs this s-expression netlist into @a aOutputFormatter.
|
*
|
||||||
* @param aOutputFormatter is the destination of the serialization to text.
|
* @param aOutputFormatter is the destination of the serialization to text.
|
||||||
* @param aCtl is bit set composed by OR-ing together enum GNL bits, it allows outputting
|
* @param aCtl is bit set composed by OR-ing together enum GNL bits, it allows outputting
|
||||||
* a subset of the full document model.
|
* a subset of the full document model.
|
||||||
|
|
|
@ -167,6 +167,7 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) :
|
||||||
m_lib_id = aComponent.m_lib_id;
|
m_lib_id = aComponent.m_lib_id;
|
||||||
m_isInNetlist = aComponent.m_isInNetlist;
|
m_isInNetlist = aComponent.m_isInNetlist;
|
||||||
m_inBom = aComponent.m_inBom;
|
m_inBom = aComponent.m_inBom;
|
||||||
|
m_onBoard = aComponent.m_onBoard;
|
||||||
|
|
||||||
if( aComponent.m_part )
|
if( aComponent.m_part )
|
||||||
SetLibSymbol( new LIB_PART( *aComponent.m_part.get() ) );
|
SetLibSymbol( new LIB_PART( *aComponent.m_part.get() ) );
|
||||||
|
@ -211,6 +212,7 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
|
||||||
m_prefix = wxString( wxT( "U" ) );
|
m_prefix = wxString( wxT( "U" ) );
|
||||||
m_isInNetlist = true;
|
m_isInNetlist = true;
|
||||||
m_inBom = true;
|
m_inBom = true;
|
||||||
|
m_onBoard = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1526,7 +1528,7 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
|
||||||
void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
||||||
SCH_SHEET_PATH* aSheetPath )
|
SCH_SHEET_PATH* aSheetPath )
|
||||||
{
|
{
|
||||||
if( !m_part )
|
if( !m_part || !m_onBoard )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( LIB_PIN* pin = m_part->GetNextPin(); pin; pin = m_part->GetNextPin( pin ) )
|
for( LIB_PIN* pin = m_part->GetNextPin(); pin; pin = m_part->GetNextPin( pin ) )
|
||||||
|
|
|
@ -125,8 +125,8 @@ private:
|
||||||
SCH_PIN_MAP m_pinMap; ///< the component's pins mapped by LIB_PIN*
|
SCH_PIN_MAP m_pinMap; ///< the component's pins mapped by LIB_PIN*
|
||||||
|
|
||||||
bool m_isInNetlist; ///< True if the component should appear in the netlist
|
bool m_isInNetlist; ///< True if the component should appear in the netlist
|
||||||
|
|
||||||
bool m_inBom; ///< True to include in bill of materials export.
|
bool m_inBom; ///< True to include in bill of materials export.
|
||||||
|
bool m_onBoard; ///< True to include in netlist when updating board.
|
||||||
|
|
||||||
// Defines the hierarchical path and reference of the component. This allows support
|
// Defines the hierarchical path and reference of the component. This allows support
|
||||||
// for multiple references to a single sub-sheet.
|
// for multiple references to a single sub-sheet.
|
||||||
|
@ -608,7 +608,7 @@ public:
|
||||||
|
|
||||||
wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
|
wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
|
||||||
|
|
||||||
bool IsConnectable() const override { return true; }
|
bool IsConnectable() const override { return m_onBoard; }
|
||||||
|
|
||||||
bool CanConnect( const SCH_ITEM* aItem ) const override
|
bool CanConnect( const SCH_ITEM* aItem ) const override
|
||||||
{
|
{
|
||||||
|
@ -683,6 +683,9 @@ public:
|
||||||
bool GetIncludeInBom() const { return m_inBom; }
|
bool GetIncludeInBom() const { return m_inBom; }
|
||||||
void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
|
void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
|
||||||
|
|
||||||
|
bool GetIncludeOnBoard() const { return m_onBoard; }
|
||||||
|
void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doIsConnected( const wxPoint& aPosition ) const override;
|
bool doIsConnected( const wxPoint& aPosition ) const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -267,10 +267,22 @@ public:
|
||||||
wxString GetScreenDesc() const override;
|
wxString GetScreenDesc() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a remote command send by Pcbnew via a socket,
|
* Execute a remote command sent by Pcbnew via a socket connection.
|
||||||
* port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243)
|
* <p>
|
||||||
* this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
|
* When user selects a module or pin in Pcbnew, Eeschema shows that same
|
||||||
* @param cmdline = received command from socket
|
* component or pin and moves cursor on the item. The socket port used
|
||||||
|
* is #KICAD_SCH_PORT_SERVICE_NUMBER which defaults to 4243.
|
||||||
|
*
|
||||||
|
* Valid commands are:
|
||||||
|
* \li \c \$PART: \c "reference" Put cursor on component.
|
||||||
|
* \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on component reference.
|
||||||
|
* \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on component value.
|
||||||
|
* \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the component pin.
|
||||||
|
* \li \c \$NET: \c "netname" Highlight a specified net
|
||||||
|
* \li \c \$CLEAR: \c "HIGHLIGHTED" Clear components highlight
|
||||||
|
* <p>
|
||||||
|
* They are a keyword followed by a quoted string.
|
||||||
|
* @param cmdline = received command from Pcbnew
|
||||||
*/
|
*/
|
||||||
void ExecuteRemoteCommand( const char* cmdline ) override;
|
void ExecuteRemoteCommand( const char* cmdline ) override;
|
||||||
|
|
||||||
|
|
|
@ -45,4 +45,6 @@
|
||||||
|
|
||||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20200512 // Add support for exclude from BOM.
|
//#define SEXPR_SCHEMATIC_FILE_VERSION 20200512 // Add support for exclude from BOM.
|
||||||
|
|
||||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20200602
|
//#define SEXPR_SCHEMATIC_FILE_VERSION 20200602 // Add support for exclude from board.
|
||||||
|
|
||||||
|
#define SEXPR_SCHEMATIC_FILE_VERSION 20200608
|
||||||
|
|
|
@ -2150,6 +2150,11 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_on_board:
|
||||||
|
symbol->SetIncludeOnBoard( parseBool() );
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
case T_uuid:
|
case T_uuid:
|
||||||
NeedSYMBOL();
|
NeedSYMBOL();
|
||||||
const_cast<KIID&>( symbol->m_Uuid ) = KIID( FromUTF8() );
|
const_cast<KIID&>( symbol->m_Uuid ) = KIID( FromUTF8() );
|
||||||
|
|
|
@ -941,6 +941,7 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, int aNestLevel )
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel + 1, "(in_bom %s)", ( aSymbol->GetIncludeInBom() ) ? "yes" : "no" );
|
m_out->Print( aNestLevel + 1, "(in_bom %s)", ( aSymbol->GetIncludeInBom() ) ? "yes" : "no" );
|
||||||
|
m_out->Print( 0, " (on_board %s)", ( aSymbol->GetIncludeOnBoard() ) ? "yes" : "no" );
|
||||||
|
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ non_logic
|
||||||
none
|
none
|
||||||
number
|
number
|
||||||
offset
|
offset
|
||||||
|
on_board
|
||||||
open_collector
|
open_collector
|
||||||
open_emitter
|
open_emitter
|
||||||
outline
|
outline
|
||||||
|
|
Loading…
Reference in New Issue