From a17cd9d05453f0ffeb9cc9118a840a96bfd4c591 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Thu, 24 Aug 2023 20:42:58 -0400 Subject: [PATCH] Make VRML use board edge bounding box for parity with step Fixes https://gitlab.com/kicad/code/kicad/-/issues/15472 --- pcbnew/dialogs/dialog_export_idf.cpp | 5 ++--- pcbnew/dialogs/dialog_export_vrml.cpp | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pcbnew/dialogs/dialog_export_idf.cpp b/pcbnew/dialogs/dialog_export_idf.cpp index 0f5ebe7451..ae693ced78 100644 --- a/pcbnew/dialogs/dialog_export_idf.cpp +++ b/pcbnew/dialogs/dialog_export_idf.cpp @@ -195,9 +195,8 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event ) if( dlg.GetAutoAdjustOffset() ) { BOX2I bbox = GetBoard()->GetBoardEdgesBoundingBox(); - - aXRef = bbox.Centre().x * pcbIUScale.MM_PER_IU; - aYRef = bbox.Centre().y * pcbIUScale.MM_PER_IU; + aXRef = pcbIUScale.IUTomm( bbox.GetCenter().x ); + aYRef = pcbIUScale.IUTomm( bbox.GetCenter().y ); } else { diff --git a/pcbnew/dialogs/dialog_export_vrml.cpp b/pcbnew/dialogs/dialog_export_vrml.cpp index 54bd605c59..4e877a0788 100644 --- a/pcbnew/dialogs/dialog_export_vrml.cpp +++ b/pcbnew/dialogs/dialog_export_vrml.cpp @@ -230,10 +230,9 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event ) if( dlg.GetOriginChoice() == 1 ) { // Origin = board center: - BOARD* pcb = GetBoard(); - VECTOR2I center = pcb->GetBoundingBox().GetCenter(); - aXRef = pcbIUScale.IUTomm( center.x ); - aYRef = pcbIUScale.IUTomm( center.y ); + BOX2I bbox = GetBoard()->GetBoardEdgesBoundingBox(); + aXRef = pcbIUScale.IUTomm( bbox.GetCenter().x ); + aYRef = pcbIUScale.IUTomm( bbox.GetCenter().y ); } double scale = scaleList[dlg.GetUnits()]; // final scale export