#include "GeomAlgoAPI_Tools.h"
+#include <Basics_OCCTVersion.hxx>
+
// OOCT includes
#include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx>
+#include <IGESData_IGESModel.hxx>
#include <Interface_Static.hxx>
+#include <XSAlgo.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
+
#include <TopoDS_Shape.hxx>
#include <TopoDS_Iterator.hxx>
+#include <UnitsMethods.hxx>
+
//=============================================================================
/*!
*
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" );
#include <Interface_Static.hxx>
#include <Quantity_Color.hxx>
+#include <Basics_OCCTVersion.hxx>
+
// a structure to manage step document exported attributes
struct GeomAlgoAPI_STEPAttributes {
bool myHasColor; ///< true if color is defined
// 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)
if (aStatus != IFSelect_RetDone)
theError = "STEP Export failed";
}
- catch (Standard_Failure exception) {
+ catch (Standard_Failure&) {
theError = "Exception catched in STEPExport";
}
return theError.empty();