From fe14e2fc447d7f161d9fc711b6ca307311c206bb Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 7 Mar 2023 17:18:15 +0000 Subject: [PATCH] Porting Salome to OCCT 7.7.0 --- src/GEOMUtils/GEOMUtils.cxx | 4 ++++ src/IGESPlugin/IGESPlugin_ExportDriver.cxx | 14 ++++++++++++++ src/STEPPlugin/STEPPlugin_ExportDriver.cxx | 17 ++++++++++++----- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/GEOMUtils/GEOMUtils.cxx b/src/GEOMUtils/GEOMUtils.cxx index 6528b650c..4abf1f3b3 100644 --- a/src/GEOMUtils/GEOMUtils.cxx +++ b/src/GEOMUtils/GEOMUtils.cxx @@ -26,6 +26,8 @@ #include +#include + // OCCT Includes #include @@ -994,7 +996,9 @@ Standard_Real GEOMUtils::GetMinDistance // skl 30.06.2008 // additional workaround for bugs 19899, 19908 and 19910 from Mantis +#if OCC_VERSION_LARGE < 0x07070000 aResult = GEOMUtils::GetMinDistanceSingular(theShape1, theShape2, thePnt1, thePnt2); +#endif /* if (dist > -1.0) { diff --git a/src/IGESPlugin/IGESPlugin_ExportDriver.cxx b/src/IGESPlugin/IGESPlugin_ExportDriver.cxx index fb647f808..8c3af7cfd 100644 --- a/src/IGESPlugin/IGESPlugin_ExportDriver.cxx +++ b/src/IGESPlugin/IGESPlugin_ExportDriver.cxx @@ -24,6 +24,7 @@ // KERNEL includes #include #include +#include // GEOM includes #include "GEOM_Function.hxx" @@ -31,11 +32,17 @@ // OOCT includes #include #include +#include #include +#include +#include + #include #include +#include + //============================================================================= /*! * KindOfBRep @@ -161,6 +168,13 @@ Standard_Integer IGESPlugin_ExportDriver::Execute(Handle(TFunction_Logbook)& /*l 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/STEPPlugin/STEPPlugin_ExportDriver.cxx b/src/STEPPlugin/STEPPlugin_ExportDriver.cxx index c31bc1481..4b684034b 100644 --- a/src/STEPPlugin/STEPPlugin_ExportDriver.cxx +++ b/src/STEPPlugin/STEPPlugin_ExportDriver.cxx @@ -25,6 +25,7 @@ // KERNEL includes #include #include +#include // GEOM includes #include "GEOM_Function.hxx" @@ -120,14 +121,20 @@ Standard_Integer STEPPlugin_ExportDriver::Execute(Handle(TFunction_Logbook)& /*l // Set "C" numeric locale to save numbers correctly Kernel_Utils::Localizer loc; - IFSelect_ReturnStatus status ; - //VRV: OCC 4.0 migration +#if OCC_VERSION_LARGE < 0x07070000 STEPControl_Writer aWriter; Interface_Static::SetCVal("xstep.cascade.unit","M"); Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString()); Interface_Static::SetIVal("write.step.nonmanifold", 1); - status = aWriter.Transfer( aShape, STEPControl_AsIs ); - //VRV: OCC 4.0 migration +#else + STEPControl_Writer aWriterTmp; + Interface_Static::SetCVal("xstep.cascade.unit","M"); + Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString()); + Interface_Static::SetIVal("write.step.nonmanifold", 1); + STEPControl_Writer aWriter; +#endif + + IFSelect_ReturnStatus status = aWriter.Transfer( aShape, STEPControl_AsIs ); if( status == IFSelect_RetDone ) status = aWriter.Write( aFileName.ToCString() ); @@ -137,7 +144,7 @@ Standard_Integer STEPPlugin_ExportDriver::Execute(Handle(TFunction_Logbook)& /*l } catch (Standard_Failure&) { - //THROW_SALOME_CORBA_EXCEPTION("Exception caught in STEPExport", SALOME::BAD_PARAM); + //THROW_SALOME_CORBA_EXCEPTION("Exception caught in STEPExport", SALOME::BAD_PARAM); } return 0; }