From 98431eed791aa92325ef0bb91901a53f863b4ea2 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 19 Jul 2022 10:35:31 -0700 Subject: [PATCH] Avoid scaling unity models There is no benefit to applying the identity transformation to models when exporting the board to STEP Fixes https://gitlab.com/kicad/code/kicad/issues/12036 --- utils/kicad2step/pcb/oce_utils.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index 06578c3e52..7005c8ec60 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -1379,7 +1379,6 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source, Handle( TDocStd_Document )& dest, TRIPLET aScale ) { // transfer data from Source into a top level component of Dest - gp_GTrsf scale_transform; scale_transform.SetVectorialPart( gp_Mat( aScale.x, 0, 0, 0, aScale.y, 0, @@ -1412,18 +1411,22 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source, if( !shape.IsNull() ) { - brep.Perform( shape, Standard_False ); - TopoDS_Shape scaled_shape; + TopoDS_Shape scaled_shape( shape ); - if( brep.IsDone() ) + if( aScale.x != 1.0 || aScale.y != 1.0 || aScale.z != 1.0 ) { - scaled_shape = brep.Shape(); - } - else - { - ReportMessage( wxT( " * transfertModel(): failed to scale model\n" ) ); + brep.Perform( shape, Standard_False ); - scaled_shape = shape; + if( brep.IsDone() ) + { + scaled_shape = brep.Shape(); + } + else + { + ReportMessage( wxT( " * transfertModel(): failed to scale model\n" ) ); + + scaled_shape = shape; + } } TDF_Label niulab = d_assy->AddComponent( component, scaled_shape, Standard_False );