Fix issue with default netclass vs orphaned net netclass.

This commit is contained in:
Jeff Young 2020-04-28 17:17:38 +01:00
parent 9d6b987ecc
commit 932fdf8674
1 changed files with 12 additions and 4 deletions

View File

@ -81,15 +81,23 @@ bool BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode, bool aNoAssert )
int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem, wxString* aSource ) const int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem, wxString* aSource ) const
{ {
NETCLASSPTR netclass = GetNetClass(); NETCLASSPTR netclass;
int myClearance = netclass->GetClearance();
if( aSource ) // NB: we must check the net first, as when it is 0 GetNetClass() will return the
*aSource = wxString::Format( _( "%s netclass clearance" ), netclass->GetName() ); // orphaned net netclass, not the default netclass.
if( m_netinfo->GetNet() == 0 )
netclass = GetBoard()->GetDesignSettings().GetDefault();
else
netclass = GetNetClass();
int myClearance = netclass->GetClearance();
if( aItem && aItem->GetClearance() > myClearance ) if( aItem && aItem->GetClearance() > myClearance )
return aItem->GetClearance( nullptr, aSource ); return aItem->GetClearance( nullptr, aSource );
if( aSource )
*aSource = wxString::Format( _( "%s netclass clearance" ), netclass->GetName() );
return myClearance; return myClearance;
} }