From b399a970f93dc7ca61da34b37b67740f7dc4adee Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 9 Mar 2023 14:33:04 +0000 Subject: [PATCH] Porting Salome to OCCT 7.7.0 --- src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp | 15 +++++++++++++++ src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp index 38ecc3fe2..7cc6a022f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp @@ -21,14 +21,22 @@ #include "GeomAlgoAPI_Tools.h" +#include + // OOCT includes #include #include +#include #include +#include +#include + #include #include +#include + //============================================================================= /*! * @@ -140,6 +148,13 @@ bool IGESExport(const std::string& theFileName, IGESControl_Writer ICW( "M", aBrepMode ); // export explicitly in meters Interface_Static::SetCVal( "xstep.cascade.unit", "M" ); +#if OCC_VERSION_LARGE >= 0x07070000 + Interface_Static::SetCVal("write.iges.unit", "M"); + XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info + Standard_Real aScaleFactorMM = UnitsMethods::GetCasCadeLengthUnit(); + ICW.Model()->ChangeGlobalSection().SetCascadeUnit(aScaleFactorMM); +#endif + // 09.03.2010 skl for bug 0020726 // change default value "Average" to "Max" Interface_Static::SetCVal( "write.precision.mode", "Max" ); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp index 224840ec5..9f8370c28 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp @@ -34,6 +34,8 @@ #include #include +#include + // a structure to manage step document exported attributes struct GeomAlgoAPI_STEPAttributes { bool myHasColor; ///< true if color is defined @@ -145,10 +147,19 @@ bool STEPExport(const std::string& theFileName, // store the XCAF document to STEP file try { GeomAlgoAPI_Tools::Localizer aLocalizer; // Set "C" numeric locale to save numbers correctly + +#if OCC_VERSION_LARGE < 0x07070000 STEPCAFControl_Writer aWriter; Interface_Static::SetCVal("xstep.cascade.unit", "M"); Interface_Static::SetIVal("write.step.nonmanifold", 0); // 1 don't allow to export assemly tree Interface_Static::SetCVal("write.step.unit", "M"); +#else + STEPCAFControl_Writer aWriterTmp; + Interface_Static::SetCVal("xstep.cascade.unit", "M"); + Interface_Static::SetIVal("write.step.nonmanifold", 0); // 1 don't allow to export assemly tree + Interface_Static::SetCVal("write.step.unit", "M"); + STEPCAFControl_Writer aWriter; +#endif auto aStatus = aWriter.Transfer(aDoc, STEPControl_AsIs); if (aStatus == IFSelect_RetDone) @@ -156,7 +167,7 @@ bool STEPExport(const std::string& theFileName, if (aStatus != IFSelect_RetDone) theError = "STEP Export failed"; } - catch (Standard_Failure exception) { + catch (Standard_Failure&) { theError = "Exception catched in STEPExport"; } return theError.empty(); -- 2.39.2