From 986dbfd235853edd2f5e87418620dd5c4c77000a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 24 Feb 2024 23:24:54 +0000 Subject: [PATCH] Don't double-add pads to commit. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17087 --- pcbnew/router/pns_kicad_iface.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 03f808dfd9..7497b7a77b 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1817,6 +1817,9 @@ void PNS_KICAD_IFACE::modifyBoardItem( PNS::ITEM* aItem ) PNS::ARC* arc = static_cast( aItem ); PCB_ARC* arc_board = static_cast( board_item ); const SHAPE_ARC* arc_shape = static_cast( arc->Shape() ); + + m_commit->Modify( arc_board ); + arc_board->SetStart( VECTOR2I( arc_shape->GetP0() ) ); arc_board->SetEnd( VECTOR2I( arc_shape->GetP1() ) ); arc_board->SetMid( VECTOR2I( arc_shape->GetArcMid() ) ); @@ -1829,6 +1832,9 @@ void PNS_KICAD_IFACE::modifyBoardItem( PNS::ITEM* aItem ) PNS::SEGMENT* seg = static_cast( aItem ); PCB_TRACK* track = static_cast( board_item ); const SEG& s = seg->Seg(); + + m_commit->Modify( track ); + track->SetStart( VECTOR2I( s.A.x, s.A.y ) ); track->SetEnd( VECTOR2I( s.B.x, s.B.y ) ); track->SetWidth( seg->Width() ); @@ -1839,6 +1845,9 @@ void PNS_KICAD_IFACE::modifyBoardItem( PNS::ITEM* aItem ) { PCB_VIA* via_board = static_cast( board_item ); PNS::VIA* via = static_cast( aItem ); + + m_commit->Modify( via_board ); + via_board->SetPosition( VECTOR2I( via->Pos().x, via->Pos().y ) ); via_board->SetWidth( via->Diameter() ); via_board->SetDrill( via->Drill() ); @@ -1855,20 +1864,22 @@ void PNS_KICAD_IFACE::modifyBoardItem( PNS::ITEM* aItem ) PAD* pad = static_cast( aItem->Parent() ); VECTOR2I pos = static_cast( aItem )->Pos(); + // Don't add to commit; we'll add the parent footprints when processing the m_fpOffsets + m_fpOffsets[pad].p_old = pad->GetPosition(); m_fpOffsets[pad].p_new = pos; break; } - default: break; + default: + m_commit->Modify( aItem->Parent() ); + break; } } void PNS_KICAD_IFACE::UpdateItem( PNS::ITEM* aItem ) { - BOARD_ITEM* board_item = aItem->Parent(); - m_commit->Modify( board_item ); modifyBoardItem( aItem ); }