From 41e274684c917f9b18ab889f28ccfd9d900ca82a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 1 Sep 2023 23:59:29 +0100 Subject: [PATCH] Make sure pads with no net get assigned Default netclass on board open. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15562 --- pcbnew/plugins/kicad/pcb_parser.cpp | 9 +++++++++ qa/data/pcbnew/issue7567.kicad_pro | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 30535a8761..1eb971177d 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -4189,6 +4189,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) VECTOR2I sz; VECTOR2I pt; + bool foundNet = false; std::unique_ptr pad = std::make_unique( aParent ); @@ -4395,6 +4396,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent ) } case T_net: + foundNet = true; + if( ! pad->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) ) { 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() ) { // At some point it was possible to assign a number to aperture pads so we need to clean diff --git a/qa/data/pcbnew/issue7567.kicad_pro b/qa/data/pcbnew/issue7567.kicad_pro index 85b244dd2b..fd38d3714c 100755 --- a/qa/data/pcbnew/issue7567.kicad_pro +++ b/qa/data/pcbnew/issue7567.kicad_pro @@ -409,7 +409,7 @@ "classes": [ { "bus_width": 12, - "clearance": 0.2032, + "clearance": 0.1778, "diff_pair_gap": 0.25, "diff_pair_via_gap": 0.25, "diff_pair_width": 0.2,