From 45910bc7c1a37b421e14783a53cc0941db7b5818 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 cd443f94b0..ebfb314616 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1814,6 +1814,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() ) ); @@ -1826,6 +1829,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() ); @@ -1836,6 +1842,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() ); @@ -1852,20 +1861,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 ); }