Don't output pins to net if parent symbol isn't included on board.

Fixes https://gitlab.com/kicad/code/kicad/issues/5984
This commit is contained in:
Jeff Young 2020-10-15 14:22:12 +01:00
parent e684c6d94d
commit 445b9df827
2 changed files with 20 additions and 6 deletions

View File

@ -48,7 +48,7 @@ bool NETLIST_EXPORTER_GENERIC::WriteNetlist( const wxString& aOutFileName,
}
XNODE* NETLIST_EXPORTER_GENERIC::makeRoot( int aCtl )
XNODE* NETLIST_EXPORTER_GENERIC::makeRoot( unsigned aCtl )
{
XNODE* xroot = node( "export" );
@ -69,7 +69,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeRoot( int aCtl )
xroot->AddChild( makeLibraries() );
if( aCtl & GNL_NETS )
xroot->AddChild( makeListOfNets() );
xroot->AddChild( makeListOfNets( aCtl ) );
return xroot;
}
@ -272,7 +272,9 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeComponents( unsigned aCtl )
if( !comp
|| ( ( aCtl & GNL_OPT_BOM ) && !comp->GetIncludeInBom() )
|| ( ( aCtl & GNL_OPT_KICAD ) && !comp->GetIncludeOnBoard() ) )
{
continue;
}
// Output the component's elements in order of expected access frequency.
// This may not always look best, but it will allow faster execution
@ -570,7 +572,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeLibParts()
}
XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets()
XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets( unsigned aCtl )
{
XNODE* xnets = node( "nets" ); // auto_ptr if exceptions ever get used.
wxString netCodeTxt;
@ -607,7 +609,19 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets()
for( SCH_ITEM* item : subgraph->m_items )
{
if( item->Type() == SCH_PIN_T )
sorted_items.emplace_back( static_cast<SCH_PIN*>( item ), sheet );
{
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SCH_COMPONENT* comp = pin->GetParentComponent();
if( !comp
|| ( ( aCtl & GNL_OPT_BOM ) && !comp->GetIncludeInBom() )
|| ( ( aCtl & GNL_OPT_KICAD ) && !comp->GetIncludeOnBoard() ) )
{
continue;
}
sorted_items.emplace_back( pin, sheet );
}
}
}

View File

@ -103,7 +103,7 @@ protected:
* @param aCtl - a bitset or-ed together from GNL_ENUM values
* @return XNODE* - the root nodes
*/
XNODE* makeRoot( int aCtl = GNL_ALL );
XNODE* makeRoot( unsigned aCtl = GNL_ALL );
/**
* @return XNODE* - returns a sub-tree holding all the schematic components.
@ -126,7 +126,7 @@ protected:
* Fill out an XML node with a list of nets and returns it.
* @return XNODE* - the list of nets nodes
*/
XNODE* makeListOfNets();
XNODE* makeListOfNets( unsigned aCtl );
/**
* Fill out an XML node with a list of used libraries and returns it.