diff --git a/src/DESTEP/DESTEP_ConfigurationNode.cxx b/src/DESTEP/DESTEP_ConfigurationNode.cxx index 1963515398..b7c7fc2aaf 100644 --- a/src/DESTEP/DESTEP_ConfigurationNode.cxx +++ b/src/DESTEP/DESTEP_ConfigurationNode.cxx @@ -55,17 +55,17 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.ReadBSplineContinuity = - (StepData_ConfParameters::ReadMode_BSplineContinuity)theResource->IntegerVal( + (DESTEP_Parameters::ReadMode_BSplineContinuity)theResource->IntegerVal( "read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, aScope); InternalParameters.ReadPrecisionMode = - (StepData_ConfParameters::ReadMode_Precision) + (DESTEP_Parameters::ReadMode_Precision) theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope); InternalParameters.ReadPrecisionVal = theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope); InternalParameters.ReadMaxPrecisionMode = - (StepData_ConfParameters::ReadMode_MaxPrecision)theResource->IntegerVal( + (DESTEP_Parameters::ReadMode_MaxPrecision)theResource->IntegerVal( "read.maxprecision.mode", InternalParameters.ReadMaxPrecisionMode, aScope); @@ -76,16 +76,16 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe InternalParameters.ReadSameParamMode, aScope); InternalParameters.ReadSurfaceCurveMode = - (StepData_ConfParameters::ReadMode_SurfaceCurve)theResource->IntegerVal( + (DESTEP_Parameters::ReadMode_SurfaceCurve)theResource->IntegerVal( "read.surfacecurve.mode", InternalParameters.ReadSurfaceCurveMode, aScope); InternalParameters.EncodeRegAngle = theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope); InternalParameters.AngleUnit = - (StepData_ConfParameters::AngleUnitMode)theResource->IntegerVal("angleunit.mode", - InternalParameters.AngleUnit, - aScope); + (DESTEP_Parameters::AngleUnitMode)theResource->IntegerVal("angleunit.mode", + InternalParameters.AngleUnit, + aScope); InternalParameters.ReadResourceName = theResource->StringVal("read.resource.name", InternalParameters.ReadResourceName, aScope); @@ -94,18 +94,19 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe InternalParameters.ReadProductMode = theResource->BooleanVal("read.product.mode", InternalParameters.ReadProductMode, aScope); InternalParameters.ReadProductContext = - (StepData_ConfParameters::ReadMode_ProductContext)theResource->IntegerVal( + (DESTEP_Parameters::ReadMode_ProductContext)theResource->IntegerVal( "read.product.context", InternalParameters.ReadProductContext, aScope); InternalParameters.ReadShapeRepr = - (StepData_ConfParameters::ReadMode_ShapeRepr) - theResource->IntegerVal("read.shape.repr", InternalParameters.ReadShapeRepr, aScope); + (DESTEP_Parameters::ReadMode_ShapeRepr)theResource->IntegerVal("read.shape.repr", + InternalParameters.ReadShapeRepr, + aScope); InternalParameters.ReadTessellated = - (StepData_ConfParameters::RWMode_Tessellated) + (DESTEP_Parameters::RWMode_Tessellated) theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope); InternalParameters.ReadAssemblyLevel = - (StepData_ConfParameters::ReadMode_AssemblyLevel) + (DESTEP_Parameters::ReadMode_AssemblyLevel) theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope); InternalParameters.ReadRelationship = theResource->BooleanVal("read.shape.relationship", InternalParameters.ReadRelationship, aScope); @@ -145,20 +146,22 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe theResource->BooleanVal("read.metadata", InternalParameters.ReadMetadata, aScope); InternalParameters.WritePrecisionMode = - (StepData_ConfParameters::WriteMode_PrecisionMode)theResource->IntegerVal( + (DESTEP_Parameters::WriteMode_PrecisionMode)theResource->IntegerVal( "write.precision.mode", InternalParameters.WritePrecisionMode, aScope); InternalParameters.WritePrecisionVal = theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope); InternalParameters.WriteAssembly = - (StepData_ConfParameters::WriteMode_Assembly) - theResource->IntegerVal("write.assembly", InternalParameters.WriteAssembly, aScope); + (DESTEP_Parameters::WriteMode_Assembly)theResource->IntegerVal("write.assembly", + InternalParameters.WriteAssembly, + aScope); InternalParameters.WriteSchema = - (StepData_ConfParameters::WriteMode_StepSchema) - theResource->IntegerVal("write.schema", InternalParameters.WriteSchema, aScope); + (DESTEP_Parameters::WriteMode_StepSchema)theResource->IntegerVal("write.schema", + InternalParameters.WriteSchema, + aScope); InternalParameters.WriteTessellated = - (StepData_ConfParameters::RWMode_Tessellated) + (DESTEP_Parameters::RWMode_Tessellated) theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope); InternalParameters.WriteProductName = theResource->StringVal("write.product.name", InternalParameters.WriteProductName, aScope); @@ -175,7 +178,7 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe InternalParameters.WriteSequence = theResource->StringVal("write.sequence", InternalParameters.WriteSequence, aScope); InternalParameters.WriteVertexMode = - (StepData_ConfParameters::WriteMode_VertexMode) + (DESTEP_Parameters::WriteMode_VertexMode) theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope); InternalParameters.WriteSubshapeNames = theResource->BooleanVal("write.stepcaf.subshapes.name", diff --git a/src/DESTEP/DESTEP_ConfigurationNode.hxx b/src/DESTEP/DESTEP_ConfigurationNode.hxx index 055bc90d1a..b4819ff6b5 100644 --- a/src/DESTEP/DESTEP_ConfigurationNode.hxx +++ b/src/DESTEP/DESTEP_ConfigurationNode.hxx @@ -14,10 +14,10 @@ #ifndef _DESTEP_ConfigurationNode_HeaderFile #define _DESTEP_ConfigurationNode_HeaderFile +#include #include #include #include -#include #include //! The purpose of this class is to configure the transfer process for STEP format @@ -87,7 +87,7 @@ public: Standard_OVERRIDE; public: - StepData_ConfParameters InternalParameters; + DESTEP_Parameters InternalParameters; }; #endif // _DESTEP_ConfigurationNode_HeaderFile diff --git a/src/DESTEP/DESTEP_Parameters.cxx b/src/DESTEP/DESTEP_Parameters.cxx new file mode 100644 index 0000000000..871f22d24a --- /dev/null +++ b/src/DESTEP/DESTEP_Parameters.cxx @@ -0,0 +1,97 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +//================================================================================================= + +DESTEP_Parameters::DESTEP_Parameters() {} + +//================================================================================================= + +void DESTEP_Parameters::InitFromStatic() +{ + ReadBSplineContinuity = (DESTEP_Parameters::ReadMode_BSplineContinuity)Interface_Static::IVal( + "read.iges.bspline.continuity"); + ReadPrecisionMode = + (DESTEP_Parameters::ReadMode_Precision)Interface_Static::IVal("read.precision.mode"); + ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); + ReadMaxPrecisionMode = + (DESTEP_Parameters::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode"); + ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); + ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; + ReadSurfaceCurveMode = + (DESTEP_Parameters::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode"); + EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI; + AngleUnit = (DESTEP_Parameters::AngleUnitMode)Interface_Static::IVal("step.angleunit.mode"); + + ReadResourceName = Interface_Static::CVal("read.step.resource.name"); + ReadSequence = Interface_Static::CVal("read.step.sequence"); + ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1; + ReadProductContext = + (DESTEP_Parameters::ReadMode_ProductContext)Interface_Static::IVal("read.step.product.context"); + ReadShapeRepr = + (DESTEP_Parameters::ReadMode_ShapeRepr)Interface_Static::IVal("read.step.shape.repr"); + ReadTessellated = + (DESTEP_Parameters::RWMode_Tessellated)Interface_Static::IVal("read.step.tessellated"); + ReadAssemblyLevel = + (DESTEP_Parameters::ReadMode_AssemblyLevel)Interface_Static::IVal("read.step.assembly.level"); + ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1; + ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1; + ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1; + ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1; + ReadCodePage = (Resource_FormatType)Interface_Static::IVal("read.step.codepage"); + ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1; + ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1; + ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1; + ReadRootTransformation = Interface_Static::IVal("read.step.root.transformation") == 1; + ReadColor = Interface_Static::IVal("read.color") == 1; + ReadName = Interface_Static::IVal("read.name") == 1; + ReadLayer = Interface_Static::IVal("read.layer") == 1; + ReadProps = Interface_Static::IVal("read.props") == 1; + ReadMetadata = Interface_Static::IVal("read.metadata") == 1; + + WritePrecisionMode = + (DESTEP_Parameters::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode"); + WritePrecisionVal = Interface_Static::RVal("write.precision.val"); + WriteAssembly = + (DESTEP_Parameters::WriteMode_Assembly)Interface_Static::IVal("write.step.assembly"); + WriteSchema = + (DESTEP_Parameters::WriteMode_StepSchema)Interface_Static::IVal("write.step.schema"); + WriteTessellated = + (DESTEP_Parameters::RWMode_Tessellated)Interface_Static::IVal("write.step.tessellated"); + WriteProductName = Interface_Static::CVal("write.step.product.name"); + WriteSurfaceCurMode = Interface_Static::IVal("write.surfacecurve.mode") == 1; + WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.step.unit"); + WriteResourceName = Interface_Static::CVal("write.step.resource.name"); + WriteSequence = Interface_Static::CVal("write.step.sequence"); + WriteVertexMode = + (DESTEP_Parameters::WriteMode_VertexMode)Interface_Static::IVal("write.step.vertex.mode"); + WriteSubshapeNames = Interface_Static::IVal("write.stepcaf.subshapes.name") == 1; + WriteColor = Interface_Static::IVal("write.color") == 1; + WriteNonmanifold = Interface_Static::IVal("write.step.nonmanifold") == 1; + WriteName = Interface_Static::IVal("write.name") == 1; + WriteLayer = Interface_Static::IVal("write.layer") == 1; + WriteProps = Interface_Static::IVal("write.props") == 1; + WriteModelType = (STEPControl_StepModelType)Interface_Static::IVal("write.model.type"); +} + +//================================================================================================= + +void DESTEP_Parameters::Reset() +{ + DESTEP_Parameters aParameters; + *this = aParameters; +} diff --git a/src/DESTEP/DESTEP_Parameters.hxx b/src/DESTEP/DESTEP_Parameters.hxx new file mode 100644 index 0000000000..de3d2738e5 --- /dev/null +++ b/src/DESTEP/DESTEP_Parameters.hxx @@ -0,0 +1,204 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _DESTEP_Parameters_HeaderFile +#define _DESTEP_Parameters_HeaderFile + +#include +#include +#include +#include + +class DESTEP_Parameters +{ +public: + enum ReadMode_BSplineContinuity + { + ReadMode_BSplineContinuity_C0 = 0, + ReadMode_BSplineContinuity_C1, + ReadMode_BSplineContinuity_C2 + }; + + enum ReadMode_Precision + { + ReadMode_Precision_File = 0, + ReadMode_Precision_User + }; + + enum ReadMode_MaxPrecision + { + ReadMode_MaxPrecision_Preferred = 0, + ReadMode_MaxPrecision_Forced + }; + + enum ReadMode_SurfaceCurve + { + ReadMode_SurfaceCurve_Default = 0, + ReadMode_SurfaceCurve_2DUse_Preferred = 2, + ReadMode_SurfaceCurve_2DUse_Forced = -2, + ReadMode_SurfaceCurve_3DUse_Preferred = 3, + ReadMode_SurfaceCurve_3DUse_Forced = -3 + }; + + enum AngleUnitMode + { + AngleUnitMode_File = 0, + AngleUnitMode_Rad, + AngleUnitMode_Deg + }; + + enum ReadMode_ProductContext + { + ReadMode_ProductContext_All = 1, + ReadMode_ProductContext_Design, + ReadMode_ProductContext_Analysis + }; + + enum ReadMode_ShapeRepr + { + ReadMode_ShapeRepr_All = 1, + ReadMode_ShapeRepr_ABSR, + ReadMode_ShapeRepr_MSSR, + ReadMode_ShapeRepr_GBSSR, + ReadMode_ShapeRepr_FBSR, + ReadMode_ShapeRepr_EBWSR, + ReadMode_ShapeRepr_GBWSR + }; + + enum ReadMode_AssemblyLevel + { + ReadMode_AssemblyLevel_All = 1, + ReadMode_AssemblyLevel_Assembly, + ReadMode_AssemblyLevel_Structure, + ReadMode_AssemblyLevel_Shape + }; + + enum RWMode_Tessellated + { + RWMode_Tessellated_Off = 0, + RWMode_Tessellated_On, + RWMode_Tessellated_OnNoBRep + }; + + enum WriteMode_PrecisionMode + { + WriteMode_PrecisionMode_Least = -1, + WriteMode_PrecisionMode_Average = 0, + WriteMode_PrecisionMode_Greatest = 1, + WriteMode_PrecisionMode_Session = 2 + }; + + enum WriteMode_Assembly + { + WriteMode_Assembly_Off = 0, + WriteMode_Assembly_On, + WriteMode_Assembly_Auto + }; + + enum WriteMode_StepSchema + { + WriteMode_StepSchema_AP214CD = 1, + WriteMode_StepSchema_AP214DIS, + WriteMode_StepSchema_AP203, + WriteMode_StepSchema_AP214IS, + WriteMode_StepSchema_AP242DIS + }; + + enum WriteMode_VertexMode + { + WriteMode_VertexMode_OneCompound = 0, + WriteMode_VertexMode_SingleVertex + }; + + Standard_EXPORT DESTEP_Parameters(); + + //! Initialize parameters + Standard_EXPORT void InitFromStatic(); + + //! Reset used parameters + Standard_EXPORT void Reset(); + + Standard_EXPORT TCollection_AsciiString GetString(const ReadMode_ProductContext theMode) + { + switch (theMode) + { + case ReadMode_ProductContext_All: + return "all"; + case ReadMode_ProductContext_Design: + return "design"; + case ReadMode_ProductContext_Analysis: + return "analysis"; + default: + return ""; + } + } + +public: + // Common + // clang-format off + ReadMode_BSplineContinuity ReadBSplineContinuity = ReadMode_BSplineContinuity_C1; // #include +#include #include #include #include #include #include -#include #include #include #include @@ -70,9 +70,9 @@ bool DESTEP_Provider::Read(const TCollection_AsciiString& thePath, aReader.SetPropsMode(aNode->InternalParameters.ReadProps); aReader.SetMetaMode(aNode->InternalParameters.ReadMetadata); - IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid; - StepData_ConfParameters aParams = aNode->InternalParameters; - aReadStat = aReader.ReadFile(thePath.ToCString(), aParams); + IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid; + DESTEP_Parameters aParams = aNode->InternalParameters; + aReadStat = aReader.ReadFile(thePath.ToCString(), aParams); if (aReadStat != IFSelect_RetDone) { Message::SendFail() << "Error in the DESTEP_Provider during reading the file " << thePath @@ -114,8 +114,8 @@ bool DESTEP_Provider::Write(const TCollection_AsciiString& thePath, aWriter.SetNameMode(aNode->InternalParameters.WriteName); aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer); aWriter.SetPropsMode(aNode->InternalParameters.WriteProps); - StepData_ConfParameters aParams = aNode->InternalParameters; - Standard_Real aScaleFactorMM = 1.; + DESTEP_Parameters aParams = aNode->InternalParameters; + Standard_Real aScaleFactorMM = 1.; if (XCAFDoc_DocumentTool::GetLengthUnit(theDocument, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter)) @@ -200,8 +200,8 @@ bool DESTEP_Provider::Read(const TCollection_AsciiString& thePath, personizeWS(theWS); STEPControl_Reader aReader; aReader.SetWS(theWS); - IFSelect_ReturnStatus aReadstat = IFSelect_RetVoid; - StepData_ConfParameters aParams = aNode->InternalParameters; + IFSelect_ReturnStatus aReadstat = IFSelect_RetVoid; + DESTEP_Parameters aParams = aNode->InternalParameters; aReadstat = aReader.ReadFile(thePath.ToCString(), aParams); Handle(StepData_StepModel) aModel = aReader.StepModel(); if (aReadstat != IFSelect_RetDone) @@ -242,7 +242,7 @@ bool DESTEP_Provider::Write(const TCollection_AsciiString& thePath, IFSelect_ReturnStatus aWritestat = IFSelect_RetVoid; Handle(StepData_StepModel) aModel = aWriter.Model(); ; - StepData_ConfParameters aParams = aNode->InternalParameters; + DESTEP_Parameters aParams = aNode->InternalParameters; aModel->SetLocalLengthUnit(aNode->GlobalParameters.SystemUnit); UnitsMethods_LengthUnit aTargetUnit = UnitsMethods::GetLengthUnitByFactorValue(aNode->GlobalParameters.LengthUnit, diff --git a/src/DESTEP/FILES b/src/DESTEP/FILES index 3b3c6b86c1..871afca533 100644 --- a/src/DESTEP/FILES +++ b/src/DESTEP/FILES @@ -1,4 +1,6 @@ DESTEP_ConfigurationNode.cxx DESTEP_ConfigurationNode.hxx +DESTEP_Parameters.cxx +DESTEP_Parameters.hxx DESTEP_Provider.cxx DESTEP_Provider.hxx diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 2034d02ded..9c47f86874 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -375,7 +375,7 @@ IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString th //purpose : //======================================================================= IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString theFileName, - const StepData_ConfParameters& theParams) + const DESTEP_Parameters& theParams) { return myReader.ReadFile(theFileName, theParams); } @@ -450,7 +450,7 @@ Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename //======================================================================= Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename, const Handle(TDocStd_Document)& doc, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Message_ProgressRange& theProgress) { if (ReadFile(filename, theParams) != IFSelect_RetDone) @@ -482,7 +482,7 @@ Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString & //======================================================================= Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString& filename, const Handle(TDocStd_Document)& doc, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Message_ProgressRange& theProgress) { if (ReadFile(filename.ToCString(), theParams) != IFSelect_RetDone) diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.hxx b/src/STEPCAFControl/STEPCAFControl_Reader.hxx index 262c422f40..d5a13322c5 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.hxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.hxx @@ -91,7 +91,7 @@ public: //! @param[in] theParams default configuration parameters //! @return read status Standard_EXPORT IFSelect_ReturnStatus ReadFile(const Standard_CString theFileName, - const StepData_ConfParameters& theParams); + const DESTEP_Parameters& theParams); //! Loads a file from stream and returns the read status. //! @param[in] theName auxiliary stream name @@ -123,7 +123,7 @@ public: Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& filename, const Handle(TDocStd_Document)& doc, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Translate STEP file given by filename into the document @@ -136,7 +136,7 @@ public: //! Return True if succeeded, and False in case of fail Standard_EXPORT Standard_Boolean Perform (const Standard_CString filename, const Handle(TDocStd_Document)& doc, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Returns data on external files diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index d9a716269b..0e4ac924cd 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -401,7 +401,7 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const Handle(TDocStd_Document)& //purpose : //======================================================================= Standard_Boolean STEPCAFControl_Writer::Transfer(const Handle(TDocStd_Document)& theDoc, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const STEPControl_StepModelType theMode, const Standard_CString theMulti, const Message_ProgressRange& theProgress) @@ -438,7 +438,7 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_Label& theLabel, //purpose : //======================================================================= Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_Label& theLabel, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const STEPControl_StepModelType theMode, const Standard_CString theIsMulti, const Message_ProgressRange& theProgress) @@ -475,7 +475,7 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_LabelSequence& theLab //purpose : //======================================================================= Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_LabelSequence& theLabels, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const STEPControl_StepModelType theMode, const Standard_CString theIsMulti, const Message_ProgressRange& theProgress) @@ -514,7 +514,7 @@ Standard_Boolean STEPCAFControl_Writer::Perform(const Handle(TDocStd_Document)& //======================================================================= Standard_Boolean STEPCAFControl_Writer::Perform(const Handle(TDocStd_Document)& theDoc, const Standard_CString theFileName, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Message_ProgressRange& theProgress) { if (!Transfer(theDoc, theParams, STEPControl_AsIs, 0L, theProgress)) @@ -687,8 +687,8 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter, if (aPS1.UserBreak()) return Standard_False; - StepData_ConfParameters::WriteMode_Assembly assemblymode = aModel->InternalParameters.WriteAssembly; - aModel->InternalParameters.WriteAssembly = StepData_ConfParameters::WriteMode_Assembly_On; + DESTEP_Parameters::WriteMode_Assembly assemblymode = aModel->InternalParameters.WriteAssembly; + aModel->InternalParameters.WriteAssembly = DESTEP_Parameters::WriteMode_Assembly_On; theWriter.Transfer(aSass, STEPControl_AsIs, aModel->InternalParameters, Standard_True, aPS1.Next()); aModel->InternalParameters.WriteAssembly = assemblymode; } @@ -849,8 +849,8 @@ TopoDS_Shape STEPCAFControl_Writer::transferExternFiles(const TDF_Label& theLabe anExtFile->SetWS(aNewWS); anExtFile->SetName(aNewName); anExtFile->SetLabel(theLabel); - StepData_ConfParameters::WriteMode_Assembly anAssemblymode = aStepWriter.Model()->InternalParameters.WriteAssembly; - aStepWriter.Model()->InternalParameters.WriteAssembly = StepData_ConfParameters::WriteMode_Assembly_Off; + DESTEP_Parameters::WriteMode_Assembly anAssemblymode = aStepWriter.Model()->InternalParameters.WriteAssembly; + aStepWriter.Model()->InternalParameters.WriteAssembly = DESTEP_Parameters::WriteMode_Assembly_Off; const Standard_CString anIsMulti = 0; anExtFile->SetTransferStatus(transfer(aStepWriter, aLabelSeq, theMode, anIsMulti, Standard_True, theProgress)); aStepWriter.Model()->InternalParameters.WriteAssembly = anAssemblymode; diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.hxx b/src/STEPCAFControl/STEPCAFControl_Writer.hxx index ef970c6914..fa6ed158fd 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.hxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.hxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -103,7 +103,7 @@ public: //! @param theProgress progress indicator //! Returns True if translation is OK Standard_EXPORT Standard_Boolean Transfer(const Handle(TDocStd_Document)& theDoc, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const STEPControl_StepModelType theMode = STEPControl_AsIs, const Standard_CString theIsMulti = 0, const Message_ProgressRange& theProgress = Message_ProgressRange()); @@ -118,7 +118,7 @@ public: //! This method uses if need to set parameters avoiding //! initialization from Interface_Static Standard_EXPORT Standard_Boolean Transfer(const TDF_Label& theLabel, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const STEPControl_StepModelType theMode = STEPControl_AsIs, const Standard_CString theIsMulti = 0, const Message_ProgressRange& theProgress = Message_ProgressRange()); @@ -133,7 +133,7 @@ public: //! This method uses if need to set parameters avoiding //! initialization from Interface_Static Standard_EXPORT Standard_Boolean Transfer(const TDF_LabelSequence& theLabelSeq, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const STEPControl_StepModelType theMode = STEPControl_AsIs, const Standard_CString theIsMulti = 0, const Message_ProgressRange& theProgress = Message_ProgressRange()); @@ -154,7 +154,7 @@ public: //! Returns True if translation is OK Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& theDoc, const Standard_CString theFileName, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Returns data on external files diff --git a/src/STEPConstruct/STEPConstruct_ContextTool.hxx b/src/STEPConstruct/STEPConstruct_ContextTool.hxx index 35add18f49..0e136cf524 100644 --- a/src/STEPConstruct/STEPConstruct_ContextTool.hxx +++ b/src/STEPConstruct/STEPConstruct_ContextTool.hxx @@ -143,7 +143,7 @@ private: STEPConstruct_AP203Context theAP203; Handle(StepGeom_Axis2Placement3d) myAxis; StepData_Factors myGlobalFactor; - StepData_ConfParameters::WriteMode_StepSchema mySchema; + DESTEP_Parameters::WriteMode_StepSchema mySchema; TCollection_AsciiString myProductName; }; diff --git a/src/STEPControl/STEPControl_Reader.cxx b/src/STEPControl/STEPControl_Reader.cxx index a35346360d..b6b6bcd6c1 100644 --- a/src/STEPControl/STEPControl_Reader.cxx +++ b/src/STEPControl/STEPControl_Reader.cxx @@ -136,7 +136,7 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filena //purpose : //======================================================================= IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filename, - const StepData_ConfParameters& theParams) + const DESTEP_Parameters& theParams) { Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary(); Handle(Interface_Protocol) aProtocol = WS()->Protocol(); @@ -208,7 +208,7 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString theN //purpose : //======================================================================= IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString theName, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, std::istream& theIStream) { Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary(); @@ -326,7 +326,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() } // determinate roots used ProductDefinitionContext if(IsRoot) { - StepData_ConfParameters::ReadMode_ProductContext aProdContMode = aStepModel->InternalParameters.ReadProductContext; + DESTEP_Parameters::ReadMode_ProductContext aProdContMode = aStepModel->InternalParameters.ReadProductContext; TCollection_AsciiString str1 = aStepModel->InternalParameters.GetString(aProdContMode); Standard_Integer ICS = aStepModel->InternalParameters.ReadProductContext; if(ICS>1) { diff --git a/src/STEPControl/STEPControl_Reader.hxx b/src/STEPControl/STEPControl_Reader.hxx index 86550b9737..e7913a833b 100644 --- a/src/STEPControl/STEPControl_Reader.hxx +++ b/src/STEPControl/STEPControl_Reader.hxx @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -96,11 +96,11 @@ public: //! Loads a file and returns the read status //! Zero for a Model which compies with the Controller Standard_EXPORT IFSelect_ReturnStatus ReadFile(const Standard_CString filename, - const StepData_ConfParameters& theParams); + const DESTEP_Parameters& theParams); //! Loads a file from stream and returns the read status Standard_EXPORT IFSelect_ReturnStatus ReadStream(const Standard_CString theName, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, std::istream& theIStream); //! Transfers a root given its rank in the list of candidate roots diff --git a/src/STEPControl/STEPControl_Writer.cxx b/src/STEPControl/STEPControl_Writer.cxx index e16cb584c3..f09d68a1a7 100644 --- a/src/STEPControl/STEPControl_Writer.cxx +++ b/src/STEPControl/STEPControl_Writer.cxx @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -140,7 +140,7 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer IFSelect_ReturnStatus STEPControl_Writer::Transfer (const TopoDS_Shape& sh, const STEPControl_StepModelType mode, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Standard_Boolean compgraph, const Message_ProgressRange& theProgress) { diff --git a/src/STEPControl/STEPControl_Writer.hxx b/src/STEPControl/STEPControl_Writer.hxx index 312a6fb0fc..e2c113b6a0 100644 --- a/src/STEPControl/STEPControl_Writer.hxx +++ b/src/STEPControl/STEPControl_Writer.hxx @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -94,7 +94,7 @@ public: Standard_EXPORT IFSelect_ReturnStatus Transfer (const TopoDS_Shape& sh, const STEPControl_StepModelType mode, - const StepData_ConfParameters& theParams, + const DESTEP_Parameters& theParams, const Standard_Boolean compgraph = Standard_True, const Message_ProgressRange& theProgress = Message_ProgressRange()); diff --git a/src/StepData/FILES b/src/StepData/FILES index f1de2437c0..75ee894be1 100644 --- a/src/StepData/FILES +++ b/src/StepData/FILES @@ -1,7 +1,6 @@ StepData.cxx StepData.hxx StepData_Array1OfField.hxx -StepData_ConfParameters.cxx StepData_ConfParameters.hxx StepData_DefaultGeneral.cxx StepData_DefaultGeneral.hxx diff --git a/src/StepData/StepData_ConfParameters.cxx b/src/StepData/StepData_ConfParameters.cxx deleted file mode 100644 index 57e0205350..0000000000 --- a/src/StepData/StepData_ConfParameters.cxx +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2023 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include - -//======================================================================= -// function : StepData_ConfParameters -// purpose : -//======================================================================= -StepData_ConfParameters::StepData_ConfParameters() -{} - -//======================================================================= -// function : InitParameters -// purpose : -//======================================================================= -void StepData_ConfParameters::InitFromStatic() -{ - ReadBSplineContinuity = (StepData_ConfParameters::ReadMode_BSplineContinuity)Interface_Static::IVal("read.iges.bspline.continuity"); - ReadPrecisionMode = (StepData_ConfParameters::ReadMode_Precision)Interface_Static::IVal("read.precision.mode"); - ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); - ReadMaxPrecisionMode = (StepData_ConfParameters::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode"); - ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); - ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; - ReadSurfaceCurveMode = (StepData_ConfParameters::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode"); - EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI; - AngleUnit = (StepData_ConfParameters::AngleUnitMode)Interface_Static::IVal("step.angleunit.mode"); - - ReadResourceName = Interface_Static::CVal("read.step.resource.name"); - ReadSequence = Interface_Static::CVal("read.step.sequence"); - ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1; - ReadProductContext = (StepData_ConfParameters::ReadMode_ProductContext)Interface_Static::IVal("read.step.product.context"); - ReadShapeRepr = (StepData_ConfParameters::ReadMode_ShapeRepr)Interface_Static::IVal("read.step.shape.repr"); - ReadTessellated = (StepData_ConfParameters::RWMode_Tessellated)Interface_Static::IVal("read.step.tessellated"); - ReadAssemblyLevel = (StepData_ConfParameters::ReadMode_AssemblyLevel)Interface_Static::IVal("read.step.assembly.level"); - ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1; - ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1; - ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1; - ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1; - ReadCodePage = (Resource_FormatType)Interface_Static::IVal("read.step.codepage"); - ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1; - ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1; - ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1; - ReadRootTransformation = Interface_Static::IVal("read.step.root.transformation") == 1; - ReadColor = Interface_Static::IVal("read.color") == 1; - ReadName = Interface_Static::IVal("read.name") == 1; - ReadLayer = Interface_Static::IVal("read.layer") == 1; - ReadProps = Interface_Static::IVal("read.props") == 1; - ReadMetadata = Interface_Static::IVal("read.metadata") == 1; - - WritePrecisionMode = (StepData_ConfParameters::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode"); - WritePrecisionVal = Interface_Static::RVal("write.precision.val"); - WriteAssembly = (StepData_ConfParameters::WriteMode_Assembly)Interface_Static::IVal("write.step.assembly"); - WriteSchema = (StepData_ConfParameters::WriteMode_StepSchema)Interface_Static::IVal("write.step.schema"); - WriteTessellated = (StepData_ConfParameters::RWMode_Tessellated)Interface_Static::IVal("write.step.tessellated"); - WriteProductName = Interface_Static::CVal("write.step.product.name"); - WriteSurfaceCurMode = Interface_Static::IVal("write.surfacecurve.mode") == 1; - WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.step.unit"); - WriteResourceName = Interface_Static::CVal("write.step.resource.name"); - WriteSequence = Interface_Static::CVal("write.step.sequence"); - WriteVertexMode = (StepData_ConfParameters::WriteMode_VertexMode)Interface_Static::IVal("write.step.vertex.mode"); - WriteSubshapeNames = Interface_Static::IVal("write.stepcaf.subshapes.name") == 1; - WriteColor = Interface_Static::IVal("write.color") == 1; - WriteNonmanifold = Interface_Static::IVal("write.step.nonmanifold") == 1; - WriteName = Interface_Static::IVal("write.name") == 1; - WriteLayer = Interface_Static::IVal("write.layer") == 1; - WriteProps = Interface_Static::IVal("write.props") == 1; - WriteModelType = (STEPControl_StepModelType)Interface_Static::IVal("write.model.type"); -} - -//======================================================================= -// function : ResetParameters -// purpose : -//======================================================================= -void StepData_ConfParameters::Reset() -{ - StepData_ConfParameters aParameters; - *this = aParameters; -} diff --git a/src/StepData/StepData_ConfParameters.hxx b/src/StepData/StepData_ConfParameters.hxx index 8a4f8be1b9..bf657d4251 100644 --- a/src/StepData/StepData_ConfParameters.hxx +++ b/src/StepData/StepData_ConfParameters.hxx @@ -14,181 +14,9 @@ #ifndef _StepData_ConfParameters_HeaderFile #define _StepData_ConfParameters_HeaderFile -#include -#include -#include -#include +#include -class StepData_ConfParameters -{ - -public: - - enum ReadMode_BSplineContinuity - { - ReadMode_BSplineContinuity_C0 = 0, - ReadMode_BSplineContinuity_C1, - ReadMode_BSplineContinuity_C2 - }; - enum ReadMode_Precision - { - ReadMode_Precision_File = 0, - ReadMode_Precision_User - }; - enum ReadMode_MaxPrecision - { - ReadMode_MaxPrecision_Preferred = 0, - ReadMode_MaxPrecision_Forced - }; - enum ReadMode_SurfaceCurve - { - ReadMode_SurfaceCurve_Default = 0, - ReadMode_SurfaceCurve_2DUse_Preferred = 2, - ReadMode_SurfaceCurve_2DUse_Forced = -2, - ReadMode_SurfaceCurve_3DUse_Preferred = 3, - ReadMode_SurfaceCurve_3DUse_Forced = -3 - }; - enum AngleUnitMode - { - AngleUnitMode_File = 0, - AngleUnitMode_Rad, - AngleUnitMode_Deg - }; - enum ReadMode_ProductContext - { - ReadMode_ProductContext_All = 1, - ReadMode_ProductContext_Design, - ReadMode_ProductContext_Analysis - }; - enum ReadMode_ShapeRepr - { - ReadMode_ShapeRepr_All = 1, - ReadMode_ShapeRepr_ABSR, - ReadMode_ShapeRepr_MSSR, - ReadMode_ShapeRepr_GBSSR, - ReadMode_ShapeRepr_FBSR, - ReadMode_ShapeRepr_EBWSR, - ReadMode_ShapeRepr_GBWSR - }; - enum ReadMode_AssemblyLevel - { - ReadMode_AssemblyLevel_All = 1, - ReadMode_AssemblyLevel_Assembly, - ReadMode_AssemblyLevel_Structure, - ReadMode_AssemblyLevel_Shape - }; - enum RWMode_Tessellated - { - RWMode_Tessellated_Off = 0, - RWMode_Tessellated_On, - RWMode_Tessellated_OnNoBRep - }; - enum WriteMode_PrecisionMode - { - WriteMode_PrecisionMode_Least = -1, - WriteMode_PrecisionMode_Average = 0, - WriteMode_PrecisionMode_Greatest = 1, - WriteMode_PrecisionMode_Session = 2 - }; - enum WriteMode_Assembly - { - WriteMode_Assembly_Off = 0, - WriteMode_Assembly_On, - WriteMode_Assembly_Auto - }; - enum WriteMode_StepSchema - { - WriteMode_StepSchema_AP214CD = 1, - WriteMode_StepSchema_AP214DIS, - WriteMode_StepSchema_AP203, - WriteMode_StepSchema_AP214IS, - WriteMode_StepSchema_AP242DIS - }; - enum WriteMode_VertexMode - { - WriteMode_VertexMode_OneCompound = 0, - WriteMode_VertexMode_SingleVertex - }; - - Standard_EXPORT StepData_ConfParameters(); - - //! Initialize parameters - Standard_EXPORT void InitFromStatic(); - - //! Reset used parameters - Standard_EXPORT void Reset(); - - Standard_EXPORT TCollection_AsciiString GetString(const ReadMode_ProductContext theMode) - { - switch (theMode) - { - case ReadMode_ProductContext_All: - return "all"; - case ReadMode_ProductContext_Design: - return "design"; - case ReadMode_ProductContext_Analysis: - return "analysis"; - default: - return ""; - } - } - -public: - // Common -// clang-format off - ReadMode_BSplineContinuity ReadBSplineContinuity = ReadMode_BSplineContinuity_C1; // #include #include -#include +#include class Standard_Transient; class Interface_EntityIterator; @@ -124,7 +124,7 @@ public: public: - StepData_ConfParameters InternalParameters; + DESTEP_Parameters InternalParameters; DEFINE_STANDARD_RTTIEXT(StepData_StepModel,Interface_InterfaceModel) diff --git a/src/XSDRAWSTEP/XSDRAWSTEP.cxx b/src/XSDRAWSTEP/XSDRAWSTEP.cxx index 5dcea73704..9f123cf4e1 100644 --- a/src/XSDRAWSTEP/XSDRAWSTEP.cxx +++ b/src/XSDRAWSTEP/XSDRAWSTEP.cxx @@ -284,7 +284,7 @@ static Standard_Integer testreadstep(Draw_Interpretor& theDI, STEPControl_Controller::Init(); XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info IFSelect_ReturnStatus aReadStat; - StepData_ConfParameters aParameters; + DESTEP_Parameters aParameters; aParameters.InitFromStatic(); int aNbSubShape = 0; OSD_Parallel::For @@ -497,7 +497,7 @@ static Standard_Integer testwrite(Draw_Interpretor& theDI, return 1; } - StepData_ConfParameters aParameters; + DESTEP_Parameters aParameters; aParameters.InitFromStatic(); OSD_Parallel::For