Make sure pads with no net get assigned Default netclass on board open.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15562
This commit is contained in:
Jeff Young 2023-09-01 23:59:29 +01:00
parent 2d762acc7d
commit 41e274684c
2 changed files with 10 additions and 1 deletions

View File

@ -4189,6 +4189,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
VECTOR2I sz; VECTOR2I sz;
VECTOR2I pt; VECTOR2I pt;
bool foundNet = false;
std::unique_ptr<PAD> pad = std::make_unique<PAD>( aParent ); std::unique_ptr<PAD> pad = std::make_unique<PAD>( aParent );
@ -4395,6 +4396,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
} }
case T_net: case T_net:
foundNet = true;
if( ! pad->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) ) if( ! pad->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
{ {
wxLogError( _( "Invalid net ID in\nfile: %s\nline: %d offset: %d" ), wxLogError( _( "Invalid net ID in\nfile: %s\nline: %d offset: %d" ),
@ -4694,6 +4697,12 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
} }
} }
if( !foundNet )
{
// Make sure default netclass is correctly assigned to pads that don't define a net.
pad->SetNetCode( 0, /* aNoAssert */ true );
}
if( !pad->CanHaveNumber() ) if( !pad->CanHaveNumber() )
{ {
// At some point it was possible to assign a number to aperture pads so we need to clean // At some point it was possible to assign a number to aperture pads so we need to clean

View File

@ -409,7 +409,7 @@
"classes": [ "classes": [
{ {
"bus_width": 12, "bus_width": 12,
"clearance": 0.2032, "clearance": 0.1778,
"diff_pair_gap": 0.25, "diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25, "diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2, "diff_pair_width": 0.2,