diff --git a/utils/kicad2step/pcb/kicadmodule.cpp b/utils/kicad2step/pcb/kicadmodule.cpp index 1e6a0fb95b..e721c638f3 100644 --- a/utils/kicad2step/pcb/kicadmodule.cpp +++ b/utils/kicad2step/pcb/kicadmodule.cpp @@ -376,7 +376,7 @@ bool KICADMODULE::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver, wxString::FromUTF8Unchecked( i->m_modelname.c_str() ) ).ToUTF8() ); if( aPCB->AddComponent( fname, m_refdes, LAYER_BOTTOM == m_side ? true : false, - newpos, m_rotation, i->m_offset, i->m_rotation, i->m_scale ) ) + newpos, m_rotation, i->m_offset, i->m_rotation ) ) hasdata = true; } diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index 5c9f982a8c..3ee8529c08 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include @@ -580,7 +579,7 @@ bool PCBMODEL::AddPadHole( KICADPAD* aPad ) // add a component at the given position and orientation bool PCBMODEL::AddComponent( const std::string& aFileName, const std::string& aRefDes, bool aBottom, DOUBLET aPosition, double aRotation, - TRIPLET aOffset, TRIPLET aOrientation, TRIPLET aScale ) + TRIPLET aOffset, TRIPLET aOrientation ) { if( aFileName.empty() ) { @@ -596,7 +595,7 @@ bool PCBMODEL::AddComponent( const std::string& aFileName, const std::string& aR // first retrieve a label TDF_Label lmodel; - if( !getModelLabel( aFileName, aScale, lmodel ) ) + if( !getModelLabel( aFileName, lmodel ) ) { std::ostringstream ostr; #ifdef __WXDEBUG__ @@ -909,11 +908,9 @@ bool PCBMODEL::WriteSTEP( const std::string& aFileName ) } -bool PCBMODEL::getModelLabel( const std::string aFileName, TRIPLET aScale, TDF_Label& aLabel ) +bool PCBMODEL::getModelLabel( const std::string aFileName, TDF_Label& aLabel ) { - std::string model_key = aFileName + "_" + std::to_string( aScale.x ) + "_" + std::to_string( aScale.y ) + "_" + std::to_string( aScale.z ); - - MODEL_MAP::const_iterator mm = m_models.find( model_key ); + MODEL_MAP::const_iterator mm = m_models.find( aFileName ); if( mm != m_models.end() ) { @@ -1003,7 +1000,7 @@ bool PCBMODEL::getModelLabel( const std::string aFileName, TRIPLET aScale, TDF_L { std::string altFileName = altFile.GetFullPath().ToStdString(); - if( getModelLabel( altFileName, aScale, aLabel ) ) + if( getModelLabel( altFileName, aLabel ) ) { return true; } @@ -1019,7 +1016,7 @@ bool PCBMODEL::getModelLabel( const std::string aFileName, TRIPLET aScale, TDF_L return false; } - aLabel = transferModel( doc, m_doc, aScale ); + aLabel = transferModel( doc, m_doc ); if( aLabel.IsNull() ) { @@ -1039,7 +1036,7 @@ bool PCBMODEL::getModelLabel( const std::string aFileName, TRIPLET aScale, TDF_L TCollection_ExtendedString partname( pname.c_str() ); TDataStd_Name::Set( aLabel, partname ); - m_models.insert( MODEL_DATUM( model_key, aLabel ) ); + m_models.insert( MODEL_DATUM( aFileName, aLabel ) ); ++m_components; return true; } @@ -1179,17 +1176,10 @@ bool PCBMODEL::readSTEP( Handle(TDocStd_Document)& doc, const char* fname ) TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source, - Handle( TDocStd_Document )& dest, TRIPLET aScale ) + Handle( TDocStd_Document )& dest ) { // 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, - 0, 0, aScale.z ) ); - BRepBuilderAPI_GTransform brep( scale_transform ); - - // s_assy = shape tool for the source Handle(XCAFDoc_ShapeTool) s_assy = XCAFDoc_DocumentTool::ShapeTool ( source->Main() ); @@ -1216,22 +1206,7 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source, if ( !shape.IsNull() ) { - brep.Perform( shape, Standard_False ); - TopoDS_Shape scaled_shape; - - if ( brep.IsDone() ) { - scaled_shape = brep.Shape(); - } else { - std::ostringstream ostr; -#ifdef __WXDEBUG__ - ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; -#endif /* __WXDEBUG */ - ostr << " * failed to scale model\n"; - wxLogMessage( "%s", ostr.str().c_str() ); - scaled_shape = shape; - } - - TDF_Label niulab = d_assy->AddComponent( component, scaled_shape, Standard_False ); + TDF_Label niulab = d_assy->AddComponent( component, shape, Standard_False ); // check for per-surface colors stop.Init( shape, TopAbs_FACE ); diff --git a/utils/kicad2step/pcb/oce_utils.h b/utils/kicad2step/pcb/oce_utils.h index 52cf6711b3..709d02574c 100644 --- a/utils/kicad2step/pcb/oce_utils.h +++ b/utils/kicad2step/pcb/oce_utils.h @@ -99,7 +99,7 @@ class PCBMODEL std::list< KICADCURVE > m_curves; std::vector< TopoDS_Shape > m_cutouts; - bool getModelLabel( const std::string aFileName, TRIPLET aScale, TDF_Label& aLabel ); + bool getModelLabel( const std::string aFileName, TDF_Label& aLabel ); bool getModelLocation( bool aBottom, DOUBLET aPosition, double aRotation, TRIPLET aOffset, TRIPLET aOrientation, TopLoc_Location& aLocation ); @@ -108,7 +108,7 @@ class PCBMODEL bool readSTEP( Handle( TDocStd_Document )& m_doc, const char* fname ); TDF_Label transferModel( Handle( TDocStd_Document )& source, - Handle( TDocStd_Document )& dest, TRIPLET aScale ); + Handle( TDocStd_Document )& dest ); public: PCBMODEL(); @@ -123,7 +123,7 @@ public: // add a component at the given position and orientation bool AddComponent( const std::string& aFileName, const std::string& aRefDes, bool aBottom, DOUBLET aPosition, double aRotation, - TRIPLET aOffset, TRIPLET aOrientation, TRIPLET aScale ); + TRIPLET aOffset, TRIPLET aOrientation ); // set the thickness of the PCB (mm); the top of the PCB shall be at Z = aThickness // aThickness < 0.0 == use default thickness