Remove pads not on copper layers (just on tech layers) from connectivity calculation.
Pads not on copper layers now do not have a netname, and are no longer taken in account in connectivity. Especially it avoid creating useless rats-nests for these pads.
This commit is contained in:
parent
9e90cb9572
commit
dd702cd53d
|
@ -109,6 +109,14 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the object is on any copper layer, false otherwise.
|
||||
*/
|
||||
virtual bool IsOnCopperLayer() const
|
||||
{
|
||||
return IsCopperLayer( GetLayer() );
|
||||
}
|
||||
|
||||
/**
|
||||
* A value of wxPoint(0,0) which can be passed to the Draw() functions.
|
||||
*/
|
||||
|
|
|
@ -49,6 +49,9 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype
|
|||
|
||||
bool BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode, bool aNoAssert )
|
||||
{
|
||||
if( !IsOnCopperLayer() )
|
||||
aNetCode = 0;
|
||||
|
||||
// if aNetCode < 0 ( typically NETINFO_LIST::FORCE_ORPHANED )
|
||||
// or no parent board,
|
||||
// set the m_netinfo to the dummy NETINFO_LIST::ORPHANED
|
||||
|
|
|
@ -102,12 +102,13 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function SetNetCode
|
||||
* sets net using a net code.
|
||||
* Sets net using a net code.
|
||||
* @param aNetCode is a net code for the new net. It has to exist in NETINFO_LIST held by BOARD.
|
||||
* @param aNoAssert if true, do not assert that the net exists.
|
||||
* Otherwise, item is assigned to the unconnected net.
|
||||
* @return true on success, false if the net did not exist
|
||||
* Note also items (in fact pads) not on copper layers will have
|
||||
* their net code always set to 0 (not connected)
|
||||
*/
|
||||
bool SetNetCode( int aNetCode, bool aNoAssert=false );
|
||||
|
||||
|
|
|
@ -295,7 +295,8 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
|
|||
{
|
||||
COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
|
||||
|
||||
if( !net.IsValid() ) // New footprint pad has no net.
|
||||
// Test if new footprint pad has no net (pads not on copper layers have no net).
|
||||
if( !net.IsValid() || !pad->IsOnCopperLayer() )
|
||||
{
|
||||
if( !pad->GetNetname().IsEmpty() )
|
||||
{
|
||||
|
|
|
@ -261,6 +261,16 @@ public:
|
|||
m_boundingRadius = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the pad is on any copper layer, false otherwise.
|
||||
* pads can be only on tech layers to build special pads.
|
||||
* they are therefore not always on a copper layer
|
||||
*/
|
||||
bool IsOnCopperLayer() const override
|
||||
{
|
||||
return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
|
||||
}
|
||||
|
||||
void SetY( int y ) { m_Pos.y = y; }
|
||||
void SetX( int x ) { m_Pos.x = x; }
|
||||
|
||||
|
|
|
@ -228,6 +228,14 @@ public:
|
|||
|
||||
virtual void SwapData( BOARD_ITEM* aImage ) override;
|
||||
|
||||
/**
|
||||
* @return true because a track or a via is always on a copper layer.
|
||||
*/
|
||||
bool IsOnCopperLayer() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined (DEBUG)
|
||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
* Function IsOnCopperLayer
|
||||
* @return true if this zone is on a copper layer, false if on a technical layer
|
||||
*/
|
||||
bool IsOnCopperLayer() const;
|
||||
bool IsOnCopperLayer() const override;
|
||||
|
||||
/**
|
||||
* Function CommonLayerExist
|
||||
|
|
|
@ -112,7 +112,7 @@ void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM* aItem )
|
|||
|
||||
bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
|
||||
{
|
||||
if( !IsCopperLayer( aItem->GetLayer() ) )
|
||||
if( !aItem->IsOnCopperLayer() )
|
||||
return false;
|
||||
|
||||
markItemNetAsDirty ( aItem );
|
||||
|
|
|
@ -123,6 +123,9 @@ void CN_ITEM::RemoveInvalidRefs()
|
|||
|
||||
CN_ITEM* CN_LIST::Add( D_PAD* pad )
|
||||
{
|
||||
if( !pad->IsOnCopperLayer() )
|
||||
return nullptr;
|
||||
|
||||
auto item = new CN_ITEM( pad, false, 1 );
|
||||
item->AddAnchor( pad->ShapePos() );
|
||||
item->SetLayers( LAYER_RANGE( F_Cu, B_Cu ) );
|
||||
|
@ -153,7 +156,7 @@ CN_ITEM* CN_LIST::Add( D_PAD* pad )
|
|||
m_items.push_back( item );
|
||||
SetDirty();
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
CN_ITEM* CN_LIST::Add( TRACK* track )
|
||||
{
|
||||
|
|
|
@ -2761,14 +2761,19 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
|
|||
if( ! pad->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
|
||||
GetChars( CurSource() ), CurLineNumber(), CurOffset() )
|
||||
CurSource(), CurLineNumber(), CurOffset() )
|
||||
);
|
||||
|
||||
NeedSYMBOLorNUMBER();
|
||||
if( m_board && FromUTF8() != m_board->FindNet( pad->GetNetCode() )->GetNetname() )
|
||||
|
||||
// Test validity of the netname in file for netcodes expected having a net name
|
||||
if( m_board && pad->GetNetCode() > 0 &&
|
||||
FromUTF8() != m_board->FindNet( pad->GetNetCode() )->GetNetname() )
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
|
||||
GetChars( CurSource() ), CurLineNumber(), CurOffset() )
|
||||
CurSource(), CurLineNumber(), CurOffset() )
|
||||
);
|
||||
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue