From 93db7a130a8b49b7de01897de337016b3ee30e24 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 12 Mar 2021 17:37:09 +0000 Subject: [PATCH] Offset 3D models when moving footprint origin. Fixes https://gitlab.com/kicad/code/kicad/issues/7868 --- pcbnew/footprint.cpp | 7 +++++++ pcbnew/tools/drawing_tool.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index e32470abe1..54a049069a 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -1539,6 +1539,13 @@ void FOOTPRINT::MoveAnchorPosition( const wxPoint& aMoveVector ) zone->Move( moveVector ); } + // Update the 3D models + for( FP_3DMODEL& model : Models() ) + { + model.m_Offset.x += Iu2Millimeter( moveVector.x ); + model.m_Offset.y -= Iu2Millimeter( moveVector.y ); + } + m_cachedBoundingBox.Move( moveVector ); m_cachedVisibleBBox.Move( moveVector ); m_cachedTextExcludedBBox.Move( moveVector ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 2fb5679b14..4f16ed71fc 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1209,7 +1209,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent ) return 0; SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ANCHOR ); - PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); + PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); std::string tool = aEvent.GetCommandStr().get(); m_frame->PushTool( tool );