Change gears on no-connect net generation. See bug rpt.
Fixes https://gitlab.com/kicad/code/kicad/issues/6534 Fixes https://gitlab.com/kicad/code/kicad/issues/6615
This commit is contained in:
parent
e6550fb92e
commit
7b347d793b
|
@ -578,9 +578,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
|||
typedef std::pair<SCH_PIN*, SCH_SHEET_PATH> MEMBER_RECORD;
|
||||
typedef std::pair<wxString, std::vector<MEMBER_RECORD>> NET_RECORD;
|
||||
std::vector<NET_RECORD*> nets;
|
||||
|
||||
// Pre-allocate the no-net node
|
||||
nets.emplace_back( new NET_RECORD() );
|
||||
std::vector<NET_RECORD*> noConnects;
|
||||
|
||||
for( const auto& it : m_schematic->ConnectionGraph()->GetNetMap() )
|
||||
{
|
||||
|
@ -593,7 +591,8 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
|||
|
||||
if( !subgraphs[0]->m_strong_driver && subgraphs[0]->m_no_connect )
|
||||
{
|
||||
net_record = nets[0];
|
||||
noConnects.emplace_back( new NET_RECORD( "no_connect_", std::vector<MEMBER_RECORD>() ) );
|
||||
net_record = noConnects.back();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -625,6 +624,15 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
|||
}
|
||||
}
|
||||
|
||||
// Netlist ordering: Net name, then ref des, then pin name
|
||||
std::sort( nets.begin(), nets.end(),
|
||||
[]( const NET_RECORD* a, const NET_RECORD*b )
|
||||
{
|
||||
return StrNumCmp( a->first, b->first ) < 0;
|
||||
} );
|
||||
|
||||
nets.insert( nets.end(), noConnects.begin(), noConnects.end() );
|
||||
|
||||
for( int i = 0; i < (int) nets.size(); ++i )
|
||||
{
|
||||
NET_RECORD* net_record = nets[i];
|
||||
|
@ -678,8 +686,12 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
|||
|
||||
if( !added )
|
||||
{
|
||||
xnets->AddChild( xnet = node( "net" ) );
|
||||
netCodeTxt.Printf( "%d", i );
|
||||
|
||||
if( net_record->first == "no_connect_" )
|
||||
net_record->first += netCodeTxt;
|
||||
|
||||
xnets->AddChild( xnet = node( "net" ) );
|
||||
xnet->AddAttribute( "code", netCodeTxt );
|
||||
xnet->AddAttribute( "name", net_record->first );
|
||||
|
||||
|
|
|
@ -1009,8 +1009,9 @@ bool DIALOG_NET_INSPECTOR::netFilterMatches( NETINFO_ITEM* aNet ) const
|
|||
{
|
||||
// Note: the filtering is case insensitive.
|
||||
|
||||
// Show no-connect nets only if specifically asked for by filter
|
||||
if( m_netFilter.empty() )
|
||||
return true;
|
||||
return !aNet->GetNetname().StartsWith( "no_connect_" );
|
||||
|
||||
wxString net_str = UnescapeString( aNet->GetNetname() ).Upper();
|
||||
|
||||
|
|
|
@ -861,6 +861,10 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
|||
if( displayNetname )
|
||||
{
|
||||
wxString netname = UnescapeString( aPad->GetShortNetname() );
|
||||
|
||||
if( netname.StartsWith( "no_connect_" ) )
|
||||
netname = "x";
|
||||
|
||||
// calculate the size of net name text:
|
||||
double tsize = 1.5 * padsize.x / netname.Length();
|
||||
tsize = std::min( tsize, size );
|
||||
|
|
|
@ -36,7 +36,7 @@ bool ITEM::collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV, VEC
|
|||
const SHAPE* shapeB = aOther->Shape();
|
||||
|
||||
// same nets? no collision!
|
||||
if( aDifferentNetsOnly && m_net == aOther->m_net && m_net > 0 && aOther->m_net > 0 )
|
||||
if( aDifferentNetsOnly && m_net == aOther->m_net && m_net >= 0 && aOther->m_net >= 0 )
|
||||
return false;
|
||||
|
||||
// check if we are not on completely different layers first
|
||||
|
|
|
@ -315,7 +315,7 @@ void TOOL_BASE::updateEndItem( const TOOL_EVENT& aEvent )
|
|||
VECTOR2I mousePos = controls()->GetMousePosition();
|
||||
|
||||
if( m_router->Settings().Mode() != RM_MarkObstacles &&
|
||||
( m_router->GetCurrentNets().empty() || m_router->GetCurrentNets().front() <= 0 ) )
|
||||
( m_router->GetCurrentNets().empty() || m_router->GetCurrentNets().front() < 0 ) )
|
||||
{
|
||||
m_endSnapPoint = snapToItem( snapEnabled, nullptr, mousePos );
|
||||
controls()->ForceCursorPosition( true, m_endSnapPoint );
|
||||
|
|
|
@ -116,12 +116,10 @@ bool TOPOLOGY::LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine )
|
|||
}
|
||||
else
|
||||
{
|
||||
TOPOLOGY topo( tmpNode.get() );
|
||||
int anchor = 0;
|
||||
ITEM* it = nullptr;
|
||||
int anchor;
|
||||
|
||||
if( jt->Net() > 0 )
|
||||
it = topo.NearestUnconnectedItem( jt, &anchor );
|
||||
TOPOLOGY topo( tmpNode.get() );
|
||||
ITEM* it = topo.NearestUnconnectedItem( jt, &anchor );
|
||||
|
||||
if( !it )
|
||||
return false;
|
||||
|
|
|
@ -946,7 +946,7 @@ bool ROUTER_TOOL::prepareInteractive()
|
|||
|
||||
editFrame->SetActiveLayer( ToLAYER_ID( routingLayer ) );
|
||||
|
||||
if( m_startItem && m_startItem->Net() > 0 )
|
||||
if( m_startItem && m_startItem->Net() >= 0 )
|
||||
highlightNet( true, m_startItem->Net() );
|
||||
|
||||
controls()->ForceCursorPosition( false );
|
||||
|
|
Loading…
Reference in New Issue