Netlisters: do not remove unconnected pins from netlists needing all pins.
Fixes #8499 https://gitlab.com/kicad/code/kicad/issues/8499
This commit is contained in:
parent
fdcc49d3ee
commit
40b96c8388
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2017 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -119,7 +119,9 @@ static bool sortPinsByNum( PIN_INFO& aPin1, PIN_INFO& aPin2 )
|
|||
}
|
||||
|
||||
|
||||
void NETLIST_EXPORTER_BASE::CreatePinList( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheetPath )
|
||||
void NETLIST_EXPORTER_BASE::CreatePinList( SCH_COMPONENT* aSymbol,
|
||||
SCH_SHEET_PATH* aSheetPath,
|
||||
bool aKeepUnconnectedPins )
|
||||
{
|
||||
wxString ref( aSymbol->GetRef( aSheetPath ) );
|
||||
|
||||
|
@ -145,7 +147,8 @@ void NETLIST_EXPORTER_BASE::CreatePinList( SCH_COMPONENT* aSymbol, SCH_SHEET_PAT
|
|||
// Collect all pins for this reference designator by searching the entire design for
|
||||
// other parts with the same reference designator.
|
||||
// This is only done once, it would be too expensive otherwise.
|
||||
findAllUnitsOfSymbol( aSymbol, aSymbol->GetPartRef().get(), aSheetPath );
|
||||
findAllUnitsOfSymbol( aSymbol, aSymbol->GetPartRef().get(),
|
||||
aSheetPath, aKeepUnconnectedPins );
|
||||
}
|
||||
|
||||
else // GetUnitCount() <= 1 means one part per package
|
||||
|
@ -158,11 +161,13 @@ void NETLIST_EXPORTER_BASE::CreatePinList( SCH_COMPONENT* aSymbol, SCH_SHEET_PAT
|
|||
{
|
||||
const wxString& netName = conn->Name();
|
||||
|
||||
// Skip unconnected pins
|
||||
if( !aKeepUnconnectedPins ) // Skip unconnected pins if requested
|
||||
{
|
||||
CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, *aSheetPath );
|
||||
|
||||
if( !sg || sg->m_no_connect || sg->m_items.size() < 2 )
|
||||
continue;
|
||||
}
|
||||
|
||||
m_sortedSymbolPinList.emplace_back( pin->GetNumber(), netName );
|
||||
}
|
||||
|
@ -214,7 +219,8 @@ void NETLIST_EXPORTER_BASE::eraseDuplicatePins()
|
|||
|
||||
|
||||
void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol,
|
||||
LIB_PART* aPart, SCH_SHEET_PATH* aSheetPath )
|
||||
LIB_PART* aPart, SCH_SHEET_PATH* aSheetPath,
|
||||
bool aKeepUnconnectedPins )
|
||||
{
|
||||
wxString ref = aSymbol->GetRef( aSheetPath );
|
||||
wxString ref2;
|
||||
|
@ -241,11 +247,13 @@ void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol,
|
|||
{
|
||||
const wxString& netName = conn->Name();
|
||||
|
||||
// Skip unconnected pins
|
||||
if( !aKeepUnconnectedPins ) // Skip unconnected pins if requested
|
||||
{
|
||||
CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, sheet );
|
||||
|
||||
if( !sg || sg->m_no_connect || sg->m_items.size() < 2 )
|
||||
continue;
|
||||
}
|
||||
|
||||
m_sortedSymbolPinList.emplace_back( pin->GetNumber(), netName );
|
||||
}
|
||||
|
|
|
@ -115,8 +115,10 @@ protected:
|
|||
* This list is sorted by pin number. The symbol is the next actual symbol after \a aSymbol.
|
||||
* Power symbols and virtual symbols that have their reference designators starting with
|
||||
* '#' are skipped.
|
||||
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
|
||||
* but usually we need all pins in netlists.
|
||||
*/
|
||||
void CreatePinList( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheetPath );
|
||||
void CreatePinList( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheetPath, bool aKeepUnconnectedPins );
|
||||
|
||||
/**
|
||||
* Check if the given symbol should be processed for netlisting.
|
||||
|
@ -147,9 +149,11 @@ protected:
|
|||
* Search the entire design for all units of \a aSymbol based on matching reference
|
||||
* designator, and for each unit, add all its pins to the temporary sorted pin list,
|
||||
* m_sortedSymbolPinList.
|
||||
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
|
||||
* but usually we need all pins in netlists.
|
||||
*/
|
||||
void findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol, LIB_PART* aPart,
|
||||
SCH_SHEET_PATH* aSheetPath );
|
||||
SCH_SHEET_PATH* aSheetPath, bool aKeepUnconnectedPins );
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -77,7 +77,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
if( !symbol )
|
||||
continue;
|
||||
|
||||
CreatePinList( symbol, &sheet );
|
||||
CreatePinList( symbol, &sheet, true );
|
||||
|
||||
if( symbol->GetPartRef() && symbol->GetPartRef()->GetFPFilters().GetCount() != 0 )
|
||||
cmpList.push_back( SCH_REFERENCE( symbol, symbol->GetPartRef().get(), sheet ) );
|
||||
|
|
|
@ -287,7 +287,7 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
|
|||
if( !symbol )
|
||||
continue;
|
||||
|
||||
CreatePinList( symbol, &sheet );
|
||||
CreatePinList( symbol, &sheet, true );
|
||||
SPICE_ITEM spiceItem;
|
||||
spiceItem.m_parent = symbol;
|
||||
|
||||
|
|
Loading…
Reference in New Issue