]> OCCT Git - occt.git/commitdiff
0033483: Data Exchange - Static_Interface local instance for the model
authorichesnok <ichesnok@opencascade.com>
Mon, 25 Sep 2023 10:23:08 +0000 (11:23 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Mon, 4 Dec 2023 15:53:06 +0000 (15:53 +0000)
StepData_StepParameters class created and used instead of Interface_Static

52 files changed:
src/QABugs/QABugs_11.cxx
src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx
src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx
src/STEPCAFControl/STEPCAFControl_ConfigurationNode.cxx
src/STEPCAFControl/STEPCAFControl_ConfigurationNode.hxx
src/STEPCAFControl/STEPCAFControl_Provider.cxx
src/STEPCAFControl/STEPCAFControl_Provider.hxx
src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/STEPCAFControl/STEPCAFControl_Reader.hxx
src/STEPCAFControl/STEPCAFControl_Writer.cxx
src/STEPCAFControl/STEPCAFControl_Writer.hxx
src/STEPConstruct/STEPConstruct_ContextTool.cxx
src/STEPConstruct/STEPConstruct_ContextTool.hxx
src/STEPConstruct/STEPConstruct_Part.cxx
src/STEPConstruct/STEPConstruct_Part.hxx
src/STEPConstruct/STEPConstruct_Styles.cxx
src/STEPConstruct/STEPConstruct_Styles.hxx
src/STEPConstruct/STEPConstruct_UnitContext.cxx
src/STEPConstruct/STEPConstruct_UnitContext.hxx
src/STEPConstruct/STEPConstruct_ValidationProps.cxx
src/STEPControl/STEPControl_ActorRead.cxx
src/STEPControl/STEPControl_ActorRead.hxx
src/STEPControl/STEPControl_ActorWrite.cxx
src/STEPControl/STEPControl_ActorWrite.hxx
src/STEPControl/STEPControl_Controller.cxx
src/STEPControl/STEPControl_Controller.hxx
src/STEPControl/STEPControl_Reader.cxx
src/STEPControl/STEPControl_Reader.hxx
src/STEPControl/STEPControl_Writer.cxx
src/STEPControl/STEPControl_Writer.hxx
src/StepData/FILES
src/StepData/StepData_ConfParameters.cxx [new file with mode: 0644]
src/StepData/StepData_ConfParameters.hxx [new file with mode: 0644]
src/StepData/StepData_StepModel.cxx
src/StepData/StepData_StepModel.hxx
src/StepSelect/StepSelect_WorkLibrary.cxx
src/StepToTopoDS/StepToTopoDS_Builder.cxx
src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx
src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx
src/TopoDSToStep/TopoDSToStep_MakeBrepWithVoids.cxx
src/TopoDSToStep/TopoDSToStep_MakeFacetedBrep.cxx
src/TopoDSToStep/TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.cxx
src/TopoDSToStep/TopoDSToStep_MakeGeometricCurveSet.cxx
src/TopoDSToStep/TopoDSToStep_MakeManifoldSolidBrep.cxx
src/TopoDSToStep/TopoDSToStep_MakeShellBasedSurfaceModel.cxx
src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cxx
src/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx
src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cxx
src/TopoDSToStep/TopoDSToStep_Tool.cxx
src/TopoDSToStep/TopoDSToStep_Tool.hxx
src/XSControl/XSControl_Reader.hxx
src/XSDRAWSTEP/XSDRAWSTEP.cxx

index 7c95a8b9e033852c0aedbbad0098cc65d1191710..e84883a962f530c90139982fa13cff201361f3ec 100644 (file)
@@ -91,6 +91,8 @@
 #include <TDocStd_Application.hxx>
 #include <TPrsStd_AISPresentation.hxx>
 #include <ExprIntrp_GenExp.hxx>
+#include <StepData_StepModel.hxx>
+#include <XSControl_WorkSession.hxx>
 
 #if ! defined(_WIN32)
 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
index 080ffe77b5546837105d0b7d46816950bc93c56e..5968e3b72a9d0b69c70af749931e9323f54131d9 100644 (file)
@@ -63,9 +63,10 @@ void STEPCAFControl_ActorWrite::RegisterAssembly (const TopoDS_Shape &S)
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean STEPCAFControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const
+Standard_Boolean STEPCAFControl_ActorWrite::IsAssembly (const Handle(StepData_StepModel)& theModel,
+                                                        TopoDS_Shape &S) const
 {
-  if ( myStdMode ) return STEPControl_ActorWrite::IsAssembly ( S );
+  if ( myStdMode ) return STEPControl_ActorWrite::IsAssembly ( theModel, S );
   return myMap.Contains ( S );
 }
 
index 2d0946ca45c45f6869a5bcc353cee1fd175ebdbb..50e8360e67c93f4f6f2cf2556de44d0d3b6d6cb0 100644 (file)
@@ -39,7 +39,8 @@ public:
   
   //! Check whether shape S is assembly
   //! Returns True if shape is registered in assemblies map
-  Standard_EXPORT virtual Standard_Boolean IsAssembly (TopoDS_Shape& S) const Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Boolean IsAssembly (const Handle(StepData_StepModel)& theModel,
+                                                       TopoDS_Shape& S) const Standard_OVERRIDE;
   
   //! Set standard mode of work
   //! In standard mode Actor (default) behaves exactly as its
index 000077cb1e32e2b6ad708bb0ccab71326e170a92..20b2cffba551e4a2c1819aea97445b7313d0f7c2 100644 (file)
@@ -57,23 +57,23 @@ bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
 {
   TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
 
-  InternalParameters.ReadBSplineContinuity = (ReadMode_BSplineContinuity)
+  InternalParameters.ReadBSplineContinuity = (StepData_ConfParameters::ReadMode_BSplineContinuity)
     theResource->IntegerVal("read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, aScope);
-  InternalParameters.ReadPrecisionMode = (ReadMode_Precision)
+  InternalParameters.ReadPrecisionMode = (StepData_ConfParameters::ReadMode_Precision)
     theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope);
   InternalParameters.ReadPrecisionVal =
     theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope);
-  InternalParameters.ReadMaxPrecisionMode = (ReadMode_MaxPrecision)
+  InternalParameters.ReadMaxPrecisionMode = (StepData_ConfParameters::ReadMode_MaxPrecision)
     theResource->IntegerVal("read.maxprecision.mode", InternalParameters.ReadMaxPrecisionMode, aScope);
   InternalParameters.ReadMaxPrecisionVal =
     theResource->RealVal("read.maxprecision.val", InternalParameters.ReadMaxPrecisionVal, aScope);
   InternalParameters.ReadSameParamMode =
     theResource->BooleanVal("read.stdsameparameter.mode", InternalParameters.ReadSameParamMode, aScope);
-  InternalParameters.ReadSurfaceCurveMode = (ReadMode_SurfaceCurve)
+  InternalParameters.ReadSurfaceCurveMode = (StepData_ConfParameters::ReadMode_SurfaceCurve)
     theResource->IntegerVal("read.surfacecurve.mode", InternalParameters.ReadSurfaceCurveMode, aScope);
   InternalParameters.EncodeRegAngle =
     theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope);
-  InternalParameters.AngleUnit = (AngleUnitMode)
+  InternalParameters.AngleUnit = (StepData_ConfParameters::AngleUnitMode)
     theResource->IntegerVal("angleunit.mode", InternalParameters.AngleUnit, aScope);
 
   InternalParameters.ReadResourceName =
@@ -82,13 +82,13 @@ bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
     theResource->StringVal("read.sequence", InternalParameters.ReadSequence, aScope);
   InternalParameters.ReadProductMode =
     theResource->BooleanVal("read.product.mode", InternalParameters.ReadProductMode, aScope);
-  InternalParameters.ReadProductContext = (ReadMode_ProductContext)
+  InternalParameters.ReadProductContext = (StepData_ConfParameters::ReadMode_ProductContext)
     theResource->IntegerVal("read.product.context", InternalParameters.ReadProductContext, aScope);
-  InternalParameters.ReadShapeRepr = (ReadMode_ShapeRepr)
+  InternalParameters.ReadShapeRepr = (StepData_ConfParameters::ReadMode_ShapeRepr)
     theResource->IntegerVal("read.shape.repr", InternalParameters.ReadShapeRepr, aScope);
-  InternalParameters.ReadTessellated = (RWMode_Tessellated)
+  InternalParameters.ReadTessellated = (StepData_ConfParameters::RWMode_Tessellated)
     theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope);
-  InternalParameters.ReadAssemblyLevel = (ReadMode_AssemblyLevel)
+  InternalParameters.ReadAssemblyLevel = (StepData_ConfParameters::ReadMode_AssemblyLevel)
     theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope);
   InternalParameters.ReadRelationship =
     theResource->BooleanVal("read.shape.relationship", InternalParameters.ReadRelationship, aScope);
@@ -117,15 +117,15 @@ bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
   InternalParameters.ReadProps =
     theResource->BooleanVal("read.props", InternalParameters.ReadProps, aScope);
 
-  InternalParameters.WritePrecisionMode = (WriteMode_PrecisionMode)
+  InternalParameters.WritePrecisionMode = (StepData_ConfParameters::WriteMode_PrecisionMode)
     theResource->IntegerVal("write.precision.mode", InternalParameters.WritePrecisionMode, aScope);
   InternalParameters.WritePrecisionVal =
     theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope);
-  InternalParameters.WriteAssembly = (WriteMode_Assembly)
+  InternalParameters.WriteAssembly = (StepData_ConfParameters::WriteMode_Assembly)
     theResource->IntegerVal("write.assembly", InternalParameters.WriteAssembly, aScope);
-  InternalParameters.WriteSchema = (WriteMode_StepSchema)
+  InternalParameters.WriteSchema = (StepData_ConfParameters::WriteMode_StepSchema)
     theResource->IntegerVal("write.schema", InternalParameters.WriteSchema, aScope);
-  InternalParameters.WriteTessellated = (RWMode_Tessellated)
+  InternalParameters.WriteTessellated = (StepData_ConfParameters::RWMode_Tessellated)
     theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope);
   InternalParameters.WriteProductName =
     theResource->StringVal("write.product.name", InternalParameters.WriteProductName, aScope);
@@ -137,7 +137,7 @@ bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
     theResource->StringVal("write.resource.name", InternalParameters.WriteResourceName, aScope);
   InternalParameters.WriteSequence =
     theResource->StringVal("write.sequence", InternalParameters.WriteSequence, aScope);
-  InternalParameters.WriteVertexMode = (WriteMode_VertexMode)
+  InternalParameters.WriteVertexMode = (StepData_ConfParameters::WriteMode_VertexMode)
     theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope);
   InternalParameters.WriteSubshapeNames =
     theResource->BooleanVal("write.stepcaf.subshapes.name", InternalParameters.WriteSubshapeNames, aScope);
index afd83def43cf20f6ee98d3448292ae19ddcc346d..0611154dbd2c0b2fb33a3d090034eb3889a5567c 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <DE_ConfigurationNode.hxx>
 #include <STEPControl_StepModelType.hxx>
+#include <StepData_ConfParameters.hxx>
 #include <Resource_FormatType.hxx>
 #include <UnitsMethods_LengthUnit.hxx>
 
@@ -88,147 +89,7 @@ public:
 
 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
-  };
-  struct STEPCAFControl_InternalSection
-  {
-    // Common 
-    ReadMode_BSplineContinuity ReadBSplineContinuity = ReadMode_BSplineContinuity_C1; //<! Manages the continuity of BSpline curves
-    ReadMode_Precision ReadPrecisionMode = ReadMode_Precision_File; //<! Reads the precision mode value
-    double ReadPrecisionVal = 0.0001; //<! ReadMode_Precision for shape construction (if enabled user mode)
-    ReadMode_MaxPrecision ReadMaxPrecisionMode = ReadMode_MaxPrecision_Preferred; //<! Defines the mode of applying the maximum allowed tolerance
-    double ReadMaxPrecisionVal = 1; //<! Defines the maximum allowable tolerance
-    bool ReadSameParamMode = false; //<! Defines the using of BRepLib::SameParameter
-    ReadMode_SurfaceCurve ReadSurfaceCurveMode = ReadMode_SurfaceCurve_Default; //<! Reference for the computation of curves in case of 2D/3D
-    double EncodeRegAngle = 0.57295779513; //<! Continuity which these two faces are connected with at that edge
-    AngleUnitMode AngleUnit = AngleUnitMode_File; //<! Indicates what angle units should be used when a STEP file is read
-
-    // Read
-    TCollection_AsciiString ReadResourceName = "STEP"; //<! Defines the name of the resource file to read
-    TCollection_AsciiString ReadSequence = "FromSTEP"; //<! Defines the name of the sequence of operators to read
-    bool ReadProductMode = true; //<! Defines the approach used for selection of top-level STEP entities for translation, and for recognition of assembly structures
-    ReadMode_ProductContext ReadProductContext = ReadMode_ProductContext_All; //<! When reading AP 209 STEP files, allows selecting either only 'design' or 'analysis', or both types of products for translation
-    ReadMode_ShapeRepr ReadShapeRepr = ReadMode_ShapeRepr_All; //<! Specifies preferred type of representation of the shape of the product
-    RWMode_Tessellated ReadTessellated = RWMode_Tessellated_On; //!< Defines whether tessellated shapes should be translated
-    ReadMode_AssemblyLevel ReadAssemblyLevel = ReadMode_AssemblyLevel_All; //<! Specifies which data should be read for the products found in the STEP file
-    bool ReadRelationship = true; //<! Defines whether shapes associated with the main SHAPE_DEFINITION_REPRESENTATION entity of the product via SHAPE_REPRESENTATIONSHIP_RELATION should be translated
-    bool ReadShapeAspect = true; //<! Defines whether shapes associated with the PRODUCT_DEFINITION_SHAPE entity of the product via SHAPE_ASPECT should be translated
-    bool ReadConstrRelation = false; //<! Flag regulating translation of "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP" entities
-    bool ReadSubshapeNames = false; //<! Indicates whether to read sub-shape names from 'Name' attributes of STEP Representation Items
-    Resource_FormatType ReadCodePage = Resource_FormatType_UTF8; //<! STEP file encoding for names translation
-    bool ReadNonmanifold = false; //<! Defines non-manifold topology reading
-    bool ReadIdeas = false; //<! Defines !I-Deas-like STEP processing
-    bool ReadAllShapes = false; //<! Parameter to read all top level solids and shells
-    bool ReadRootTransformation = true; ///<!/ Mode to variate apply or not transformation placed in the root shape representation
-    bool ReadColor = true; //<! ColorMode is used to indicate read Colors or not
-    bool ReadName = true; //<! NameMode is used to indicate read Name or not
-    bool ReadLayer = true; //<! LayerMode is used to indicate read Layers or not
-    bool ReadProps = true; //<! PropsMode is used to indicate read Validation properties or not
-
-    // Write
-    WriteMode_PrecisionMode WritePrecisionMode = WriteMode_PrecisionMode_Average; //<! Specifies the mode of writing the resolution value into the STEP file
-    double WritePrecisionVal = 0.0001; //<! Resolution value for an STEP file when WriteMode_PrecisionMode is Greatest
-    WriteMode_Assembly WriteAssembly = WriteMode_Assembly_Off; //<! Writing assembly mode
-    WriteMode_StepSchema WriteSchema = WriteMode_StepSchema_AP214CD; //<! Defines the version of schema used for the output STEP file
-    RWMode_Tessellated WriteTessellated = RWMode_Tessellated_OnNoBRep; //!< Defines whether tessellated shapes should be translated
-    TCollection_AsciiString WriteProductName; //<! Defines the text string that will be used for field 'name' of PRODUCT entities written to the STEP file
-    bool WriteSurfaceCurMode = true; //<! Indicates whether parametric curves (curves in parametric space of surface) should be written into the STEP file
-    UnitsMethods_LengthUnit WriteUnit = UnitsMethods_LengthUnit_Millimeter; //<! Defines a unit in which the STEP file should be written
-    TCollection_AsciiString WriteResourceName = "STEP"; //<! Defines the name of the resource file to write
-    TCollection_AsciiString WriteSequence = "ToSTEP"; //<! Defines the name of the sequence of operators to write
-    WriteMode_VertexMode WriteVertexMode = WriteMode_VertexMode_OneCompound; //<! Indicates which of free vertices writing mode is switch on
-    bool WriteSubshapeNames = false; //<! Indicates whether to write sub-shape names to 'Name' attributes of STEP Representation Items
-    bool WriteColor = true; //<! ColorMode is used to indicate write Colors or not
-    bool WriteName = true; //<! NameMode is used to indicate write Name or not
-    bool WriteLayer = true; //<! LayerMode is used to indicate write Layers or not
-    bool WriteProps = true; //<! PropsMode is used to indicate write Validation properties or not
-    STEPControl_StepModelType WriteModelType = STEPControl_AsIs; //<! Gives you the choice of translation mode for an Open CASCADE shape that is being translated to STEP
-
-  } InternalParameters;
-
+  StepData_ConfParameters InternalParameters;
 };
 
 #endif // _STEPCAFControl_ConfigurationNode_HeaderFile
index 6eb2db9feb38994059ea713fc5f64425d94a226a..1efe5cd896b7238d9b11e2526960e4c265a5b7d1 100644 (file)
 #include <Interface_Static.hxx>
 #include <Message.hxx>
 #include <StepData_StepModel.hxx>
+#include <StepData_ConfParameters.hxx>
 #include <STEPCAFControl_ConfigurationNode.hxx>
 #include <STEPCAFControl_Controller.hxx>
 #include <STEPCAFControl_Reader.hxx>
 #include <STEPCAFControl_Writer.hxx>
 #include <XCAFDoc_DocumentTool.hxx>
+#include <XSControl_WorkSession.hxx>
 #include <UnitsMethods.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_Provider, DE_Provider)
@@ -41,116 +43,6 @@ STEPCAFControl_Provider::STEPCAFControl_Provider(const Handle(DE_ConfigurationNo
   :DE_Provider(theNode)
 {}
 
-//=======================================================================
-// function : initStatic
-// purpose  :
-//=======================================================================
-void STEPCAFControl_Provider::initStatic(const Handle(DE_ConfigurationNode)& theNode)
-{
-  Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(theNode);
-  STEPCAFControl_Controller::Init();
-
-  // Get previous values
-  myOldValues.ReadBSplineContinuity = (STEPCAFControl_ConfigurationNode::ReadMode_BSplineContinuity)Interface_Static::IVal("read.iges.bspline.continuity");
-  myOldValues.ReadPrecisionMode = (STEPCAFControl_ConfigurationNode::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
-  myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val");
-  myOldValues.ReadMaxPrecisionMode = (STEPCAFControl_ConfigurationNode::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode");
-  myOldValues.ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val");
-  myOldValues.ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1;
-  myOldValues.ReadSurfaceCurveMode = (STEPCAFControl_ConfigurationNode::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode");
-  myOldValues.EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI;
-  myOldValues.AngleUnit = (STEPCAFControl_ConfigurationNode::AngleUnitMode)Interface_Static::IVal("step.angleunit.mode");
-
-  myOldValues.ReadResourceName = Interface_Static::CVal("read.step.resource.name");
-  myOldValues.ReadSequence = Interface_Static::CVal("read.step.sequence");
-  myOldValues.ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1;
-  myOldValues.ReadProductContext = (STEPCAFControl_ConfigurationNode::ReadMode_ProductContext)Interface_Static::IVal("read.step.product.context");
-  myOldValues.ReadShapeRepr = (STEPCAFControl_ConfigurationNode::ReadMode_ShapeRepr)Interface_Static::IVal("read.step.shape.repr");
-  myOldValues.ReadTessellated = (STEPCAFControl_ConfigurationNode::RWMode_Tessellated)Interface_Static::IVal("read.step.tessellated");
-  myOldValues.ReadAssemblyLevel = (STEPCAFControl_ConfigurationNode::ReadMode_AssemblyLevel)Interface_Static::IVal("read.step.assembly.level");
-  myOldValues.ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1;
-  myOldValues.ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1;
-  myOldValues.ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1;
-  myOldValues.ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1;
-  myOldValues.ReadCodePage = (Resource_FormatType)Interface_Static::IVal("read.step.codepage");
-  myOldValues.ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1;
-  myOldValues.ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1;
-  myOldValues.ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1;
-  myOldValues.ReadRootTransformation = Interface_Static::IVal("read.step.root.transformation") == 1;
-
-  myOldValues.WritePrecisionMode = (STEPCAFControl_ConfigurationNode::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode");
-  myOldValues.WritePrecisionVal = Interface_Static::RVal("write.precision.val");
-  myOldValues.WriteAssembly = (STEPCAFControl_ConfigurationNode::WriteMode_Assembly)Interface_Static::IVal("write.step.assembly");
-  myOldValues.WriteSchema = (STEPCAFControl_ConfigurationNode::WriteMode_StepSchema)Interface_Static::IVal("write.step.schema");
-  myOldValues.WriteTessellated = (STEPCAFControl_ConfigurationNode::RWMode_Tessellated)Interface_Static::IVal("write.step.tessellated");
-  myOldValues.WriteProductName = Interface_Static::CVal("write.step.product.name");
-  myOldValues.WriteSurfaceCurMode = Interface_Static::IVal("write.surfacecurve.mode") == 1;
-  myOldValues.WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.step.unit");
-  myOldValues.WriteResourceName = Interface_Static::CVal("write.resource.name");
-  myOldValues.WriteSequence = Interface_Static::CVal("write.step.sequence");
-  myOldValues.WriteVertexMode = (STEPCAFControl_ConfigurationNode::WriteMode_VertexMode)Interface_Static::IVal("write.step.vertex.mode");
-  myOldValues.WriteSubshapeNames = Interface_Static::IVal("write.stepcaf.subshapes.name") == 1;
-
-  // Set new values
-  setStatic(aNode->InternalParameters);
-}
-
-//=======================================================================
-// function : setStatic
-// purpose  :
-//=======================================================================
-void STEPCAFControl_Provider::setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection& theParameter)
-{
-  Interface_Static::SetIVal("read.iges.bspline.continuity", theParameter.ReadBSplineContinuity);
-  Interface_Static::SetIVal("read.precision.mode", theParameter.ReadPrecisionMode);
-  Interface_Static::SetRVal("read.precision.val", theParameter.ReadPrecisionVal);
-  Interface_Static::SetIVal("read.maxprecision.mode", theParameter.ReadMaxPrecisionMode);
-  Interface_Static::SetRVal("read.maxprecision.val", theParameter.ReadMaxPrecisionVal);
-  Interface_Static::SetIVal("read.stdsameparameter.mode", theParameter.ReadSameParamMode);
-  Interface_Static::SetIVal("read.surfacecurve.mode", theParameter.ReadSurfaceCurveMode);
-  Interface_Static::SetRVal("read.encoderegularity.angle", theParameter.EncodeRegAngle * M_PI / 180.0);
-  Interface_Static::SetIVal("step.angleunit.mode", theParameter.AngleUnit);
-
-  Interface_Static::SetCVal("read.step.resource.name", theParameter.ReadResourceName.ToCString());
-  Interface_Static::SetCVal("read.step.sequence", theParameter.ReadSequence.ToCString());
-  Interface_Static::SetIVal("read.step.product.mode", theParameter.ReadProductMode);
-  Interface_Static::SetIVal("read.step.product.context", theParameter.ReadProductContext);
-  Interface_Static::SetIVal("read.step.shape.repr", theParameter.ReadShapeRepr);
-  Interface_Static::SetIVal("read.step.tessellated", theParameter.ReadTessellated);
-  Interface_Static::SetIVal("read.step.assembly.level", theParameter.ReadAssemblyLevel);
-  Interface_Static::SetIVal("read.step.shape.relationship", theParameter.ReadRelationship);
-  Interface_Static::SetIVal("read.step.shape.aspect", theParameter.ReadShapeAspect);
-  Interface_Static::SetIVal("read.step.constructivegeom.relationship", theParameter.ReadConstrRelation);
-  Interface_Static::SetIVal("read.stepcaf.subshapes.name", theParameter.ReadSubshapeNames);
-  Interface_Static::SetIVal("read.step.codepage", theParameter.ReadCodePage);
-  Interface_Static::SetIVal("read.step.nonmanifold", theParameter.ReadNonmanifold);
-  Interface_Static::SetIVal("read.step.ideas", theParameter.ReadIdeas);
-  Interface_Static::SetIVal("read.step.all.shapes", theParameter.ReadAllShapes);
-  Interface_Static::SetIVal("read.step.root.transformation", theParameter.ReadRootTransformation);
-
-  Interface_Static::SetIVal("write.precision.mode", theParameter.WritePrecisionMode);
-  Interface_Static::SetRVal("write.precision.val", theParameter.WritePrecisionVal);
-  Interface_Static::SetIVal("write.step.assembly", theParameter.WriteAssembly);
-  Interface_Static::SetIVal("write.step.schema", theParameter.WriteSchema);
-  Interface_Static::SetIVal("write.step.tessellated", theParameter.WriteTessellated);
-  Interface_Static::SetCVal("write.step.product.name", theParameter.WriteProductName.ToCString());
-  Interface_Static::SetIVal("write.surfacecurve.mode", theParameter.WriteSurfaceCurMode);
-  Interface_Static::SetIVal("write.step.unit", theParameter.WriteUnit);
-  Interface_Static::SetCVal("write.resource.name", theParameter.WriteResourceName.ToCString());
-  Interface_Static::SetCVal("write.step.sequence", theParameter.WriteSequence.ToCString());
-  Interface_Static::SetIVal("write.step.vertex.mode", theParameter.WriteVertexMode);
-  Interface_Static::SetIVal("write.stepcaf.subshapes.name", theParameter.WriteSubshapeNames);
-}
-
-//=======================================================================
-// function : resetStatic
-// purpose  :
-//=======================================================================
-void STEPCAFControl_Provider::resetStatic()
-{
-  setStatic(myOldValues);
-}
-
 //=======================================================================
 // function : Read
 // purpose  :
@@ -173,8 +65,6 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
     return false;
   }
   Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
-  initStatic(aNode);
-
   XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
   STEPCAFControl_Reader aReader;
   if (!theWS.IsNull())
@@ -185,14 +75,13 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
   aReader.SetNameMode(aNode->InternalParameters.ReadName);
   aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
   aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
-
   IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
-  aReadStat = aReader.ReadFile(thePath.ToCString());
+  StepData_ConfParameters aParams;
+  aReadStat = aReader.ReadFile(thePath.ToCString(), aParams);
   if (aReadStat != IFSelect_RetDone)
   {
     Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
       thePath << "\t: abandon";
-    resetStatic();
     return false;
   }
 
@@ -200,10 +89,8 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
   {
     Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
       thePath << "\t: Cannot read any relevant data from the STEP file";
-    resetStatic();
     return false;
   }
-  resetStatic();
   return true;
 }
 
@@ -223,29 +110,29 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
     return false;
   }
   Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
-  initStatic(aNode);
 
   XCAFDoc_DocumentTool::SetLengthUnit(theDocument, 
-                                      UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter),
-                                      UnitsMethods_LengthUnit_Millimeter);
+    UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit,
+                                     UnitsMethods_LengthUnit_Millimeter), UnitsMethods_LengthUnit_Millimeter);
   STEPCAFControl_Writer aWriter;
   if (!theWS.IsNull())
   {
     aWriter.Init(theWS);
   }
-  STEPControl_StepModelType aMode = static_cast<STEPControl_StepModelType>(aNode->InternalParameters.WriteModelType);
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(aWriter.Writer().WS()->Model());
+  STEPControl_StepModelType aMode =
+    static_cast<STEPControl_StepModelType>(aNode->InternalParameters.WriteModelType);
   aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
   aWriter.SetNameMode(aNode->InternalParameters.WriteName);
   aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
   aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
 
   TDF_Label aLabel;
-
-  if (!aWriter.Transfer(theDocument, aMode, 0, theProgress))
+  StepData_ConfParameters aParams;
+  if (!aWriter.Transfer(theDocument, aParams, aMode, 0, theProgress))
   {
     Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
       thePath << "\t: The document cannot be translated or gives no result";
-    resetStatic();
     return false;
   }
   IFSelect_ReturnStatus aStatus = aWriter.Write(thePath.ToCString());
@@ -255,7 +142,6 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
     {
       Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
         thePath << "\t: No file written";
-      resetStatic();
       return false;;
     }
     case IFSelect_RetDone:
@@ -266,11 +152,9 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
     {
       Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
         thePath << "\t: Error on writing file";
-      resetStatic();
       return false;
     }
   }
-  resetStatic();
   return true;
 }
 
@@ -315,32 +199,29 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
     return false;
   }
   Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
-  initStatic(aNode);
   STEPControl_Reader aReader;
   if(!theWS.IsNull())
   {
     aReader.SetWS(theWS);
   }
   IFSelect_ReturnStatus aReadstat = IFSelect_RetVoid;
-  aReadstat = aReader.ReadFile(thePath.ToCString());
+  StepData_ConfParameters aParams;
+  aReadstat = aReader.ReadFile(thePath.ToCString(), aParams);
+  Handle(StepData_StepModel) aModel = aReader.StepModel();
   if (aReadstat != IFSelect_RetDone)
   {
     Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
       thePath << "\t: abandon, no model loaded";
-    resetStatic();
     return false;
   }
-  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(aReader.Model());
   aModel->SetLocalLengthUnit(aNode->GlobalParameters.LengthUnit);
   if (aReader.TransferRoots() <= 0)
   {
     Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
       thePath << "\t:Cannot read any relevant data from the STEP file";
-    resetStatic();
     return false;
   }
   theShape = aReader.OneShape();
-  resetStatic();
   return true;
 }
 
@@ -360,7 +241,6 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
     return false;
   }
   Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
-  initStatic(aNode);
 
   STEPControl_Writer aWriter;
   if(!theWS.IsNull())
@@ -370,21 +250,19 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
   IFSelect_ReturnStatus aWritestat = IFSelect_RetVoid;
   Handle(StepData_StepModel) aModel = aWriter.Model();
   aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
-  aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
+  StepData_ConfParameters aParams;
+  aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, aParams, true, theProgress);
   if (aWritestat != IFSelect_RetDone)
   {
     Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
       thePath << "\t: abandon, no model loaded";
-    resetStatic();
     return false;
   }
   if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
   {
     Message::SendFail() << "STEPCAFControl_Provider: Error on writing file";
-    resetStatic();
     return false;
   }
-  resetStatic();
   return true;
 }
 
index d7774028b1083a7e7c5e8af695ad45c7b98467a4..244a26f50689540d49467c74d1ce332b1ad82ec3 100644 (file)
@@ -133,18 +133,6 @@ public:
   //! @return provider's vendor name
   Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
 
- private:
-
-   //! Initialize static variables
-   void initStatic(const Handle(DE_ConfigurationNode)& theNode);
-
-   //! Initialize static variables
-   void setStatic(const STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection& theParameter);
-
-   //! Reset used interface static variables
-   void resetStatic();
-
-   STEPCAFControl_ConfigurationNode::STEPCAFControl_InternalSection myOldValues;
 
 };
 
index e9e6ac69c2ee622313ecfdbe1d9e4b2014c43f74..1e5d1227a9dd08889e950ba4798cd505bc2f5e14 100644 (file)
@@ -281,6 +281,10 @@ STEPCAFControl_Reader::STEPCAFControl_Reader()
   myViewMode(Standard_True)
 {
   STEPCAFControl_Controller::Init();
+  if (!myReader.WS().IsNull())
+  {
+    Init(myReader.WS());
+  }
 }
 
 
@@ -348,6 +352,16 @@ IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString th
   return myReader.ReadFile (theFileName);
 }
 
+//=======================================================================
+//function : ReadFile
+//purpose  :
+//=======================================================================
+IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString theFileName,
+                                                       const StepData_ConfParameters& theParams)
+{
+  return myReader.ReadFile(theFileName, theParams);
+}
+
 //=======================================================================
 //function : ReadStream
 //purpose  :
@@ -412,6 +426,21 @@ Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename
   return Transfer (doc, theProgress);
 }
 
+//=======================================================================
+//function : Perform
+//purpose  : 
+//=======================================================================
+Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename,
+                                                 const Handle(TDocStd_Document)& doc,
+                                                 const StepData_ConfParameters& theParams,
+                                                 const Message_ProgressRange& theProgress)
+{
+  if (ReadFile(filename, theParams) != IFSelect_RetDone)
+  {
+    return Standard_False;
+  }
+  return Transfer(doc, theProgress);
+}
 
 //=======================================================================
 //function : Perform
@@ -429,6 +458,21 @@ Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString &
   return Transfer (doc, theProgress);
 }
 
+//=======================================================================
+//function : Perform
+//purpose  : 
+//=======================================================================
+Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString& filename,
+                                                 const Handle(TDocStd_Document)& doc,
+                                                 const StepData_ConfParameters& theParams,
+                                                 const Message_ProgressRange& theProgress)
+{
+  if (ReadFile(filename.ToCString(), theParams) != IFSelect_RetDone)
+  {
+    return Standard_False;
+  }
+  return Transfer(doc, theProgress);
+}
 
 //=======================================================================
 //function : ExternFiles
@@ -2302,7 +2346,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
   Handle(StepVisual_DraughtingModel) aDModel =
     Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
   XSAlgo::AlgoContainer()->PrepareForTransfer();
-  STEPControl_ActorRead anActor;
+  STEPControl_ActorRead anActor(aTP->Model());
   StepData_Factors aLocalFactors = theLocalFactors;
   anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
   Standard_Real aFact = aLocalFactors.LengthFactor();
@@ -2411,7 +2455,7 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
   if (!aSDR.IsNull())
   {
     XSAlgo::AlgoContainer()->PrepareForTransfer();
-    STEPControl_ActorRead anActor;
+    STEPControl_ActorRead anActor(theTR->Model());
     StepData_Factors aLocalFactors = theLocalFactors;
     anActor.PrepareUnits(aSDR, aTP, aLocalFactors);
     aFact = aLocalFactors.LengthFactor();
@@ -2824,7 +2868,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
                 Handle(StepGeom_Axis2Placement3d) anAx
                   = Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
                 XSAlgo::AlgoContainer()->PrepareForTransfer();
-                STEPControl_ActorRead anActor;
+                STEPControl_ActorRead anActor(aTP->Model());
                 StepData_Factors aLocalFactors = theLocalFactors;
                 anActor.PrepareUnits(aSRWP, aTP, aLocalFactors);
                 Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx, aLocalFactors);
@@ -4363,7 +4407,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
       if (!aDMIA.IsNull())
       {
         XSAlgo::AlgoContainer()->PrepareForTransfer();
-        STEPControl_ActorRead anActor;
+        STEPControl_ActorRead anActor(aModel);
         Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
         anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP, aLocalFactors);
         aFact = aLocalFactors.LengthFactor();
@@ -4719,7 +4763,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
     if (!aDModel.IsNull())
     {
       XSAlgo::AlgoContainer()->PrepareForTransfer();
-      STEPControl_ActorRead anActor;
+      STEPControl_ActorRead anActor(aTP->Model());
       anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
     }
 
@@ -4895,11 +4939,8 @@ void STEPCAFControl_Reader::ExpandSubShapes(const Handle(XCAFDoc_ShapeTool)& Sha
   const Handle(Transfer_TransientProcess)& TP = Reader().WS()->TransferReader()->TransientProcess();
   NCollection_DataMap<TopoDS_Shape, Handle(TCollection_HAsciiString)> ShapeNameMap;
   TColStd_MapOfTransient aRepItems;
-
-  // Read translation control variables
-  Standard_Boolean doReadSNames = (Interface_Static::IVal("read.stepcaf.subshapes.name") > 0);
-
-  if (!doReadSNames)
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
+  if (!aStepModel->InternalParameters.ReadSubshapeNames)
     return;
 
   const Interface_Graph& Graph = Reader().WS()->Graph();
index efebd48bfa5b2f63826417becca6ce0706824c24..5fb211931b07ef0f62dbc7ce6b395b36d2654085 100644 (file)
@@ -81,6 +81,14 @@ public:
   //! @return read status
   Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString theFileName);
 
+  //! Loads a file and returns the read status
+  //! Provided for use like single-file reader.
+  //! @param theFileName [in] file to open
+  //! @param theParams [in] default configuration parameters
+  //! @return read status
+  Standard_EXPORT IFSelect_ReturnStatus ReadFile(const Standard_CString theFileName,
+                                                 const StepData_ConfParameters& theParams);
+
   //! Loads a file from stream and returns the read status.
   //! @param theName [in] auxiliary stream name
   //! @param theIStream [in] stream to read from
@@ -108,11 +116,23 @@ public:
   Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& filename,
                                             const Handle(TDocStd_Document)& doc,
                                             const Message_ProgressRange& theProgress = Message_ProgressRange());
-  
+
+  Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& filename,
+                                            const Handle(TDocStd_Document)& doc,
+                                            const StepData_ConfParameters& theParams,
+                                            const Message_ProgressRange& theProgress = Message_ProgressRange());
+  //! Translate STEP file given by filename into the document
+  //! 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 Message_ProgressRange& theProgress = Message_ProgressRange());
+
   //! Translate STEP file given by filename into the document
   //! 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 Message_ProgressRange& theProgress = Message_ProgressRange());
   
   //! Returns data on external files
index 519f46e1b6f39a0fd18ec43d0da705cec40f5d2c..669550e308b86dd5c628bb2fb9e05df15d40dbf8 100644 (file)
@@ -390,6 +390,21 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const Handle(TDocStd_Document)&
                                                  const STEPControl_StepModelType theMode,
                                                  const Standard_CString theMulti,
                                                  const Message_ProgressRange& theProgress)
+{
+  const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWriter.WS()->Model());
+  aModel->InternalParameters.InitFromStatic();
+  return Transfer(theDoc, aModel->InternalParameters, theMode, theMulti, theProgress);
+}
+
+//=======================================================================
+//function : Transfer
+//purpose  :
+//=======================================================================
+Standard_Boolean STEPCAFControl_Writer::Transfer(const Handle(TDocStd_Document)& theDoc,
+                                                 const StepData_ConfParameters& theParams,
+                                                 const STEPControl_StepModelType theMode,
+                                                 const Standard_CString theMulti,
+                                                 const Message_ProgressRange& theProgress)
 {
   Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
   if (aShTool.IsNull())
@@ -399,6 +414,8 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const Handle(TDocStd_Document)&
   myRootLabels.Add(theDoc->Main().Root());
   TDF_LabelSequence aLabels;
   aShTool->GetFreeShapes(aLabels);
+  const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWriter.WS()->Model());
+  aModel->InternalParameters = theParams;
   return transfer(myWriter, aLabels, theMode, theMulti, Standard_False, theProgress);
 }
 
@@ -410,6 +427,21 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_Label& theLabel,
                                                  const STEPControl_StepModelType theMode,
                                                  const Standard_CString theIsMulti,
                                                  const Message_ProgressRange& theProgress)
+{
+  const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWriter.WS()->Model());
+  aModel->InternalParameters.InitFromStatic();
+  return Transfer(theLabel, aModel->InternalParameters, theMode, theIsMulti, theProgress);
+}
+
+//=======================================================================
+//function : Transfer
+//purpose  :
+//=======================================================================
+Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_Label& theLabel,
+                                                 const StepData_ConfParameters& theParams,
+                                                 const STEPControl_StepModelType theMode,
+                                                 const Standard_CString theIsMulti,
+                                                 const Message_ProgressRange& theProgress)
 {
   if (theLabel.IsNull())
   {
@@ -419,6 +451,8 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_Label& theLabel,
   aLabels.Append(theLabel);
   myRootLabels.Clear();
   myRootLabels.Add(theLabel.Root());
+  const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWriter.WS()->Model());
+  aModel->InternalParameters = theParams;
   return transfer(myWriter, aLabels, theMode, theIsMulti, Standard_False, theProgress);
 }
 
@@ -430,6 +464,21 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_LabelSequence& theLab
                                                  const STEPControl_StepModelType theMode,
                                                  const Standard_CString theIsMulti,
                                                  const Message_ProgressRange& theProgress)
+{
+  const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWriter.WS()->Model());
+  aModel->InternalParameters.InitFromStatic();
+  return Transfer(theLabels, aModel->InternalParameters, theMode, theIsMulti, theProgress);
+}
+
+//=======================================================================
+//function : Transfer
+//purpose  :
+//=======================================================================
+Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_LabelSequence& theLabels,
+                                                 const StepData_ConfParameters& theParams,
+                                                 const STEPControl_StepModelType theMode,
+                                                 const Standard_CString theIsMulti,
+                                                 const Message_ProgressRange& theProgress)
 {
   myRootLabels.Clear();
   for (TDF_LabelSequence::Iterator aLabelIter(theLabels);
@@ -441,6 +490,8 @@ Standard_Boolean STEPCAFControl_Writer::Transfer(const TDF_LabelSequence& theLab
       myRootLabels.Add(aLabel.Root());
     }
   }
+  const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(myWriter.WS()->Model());
+  aModel->InternalParameters = theParams;
   return transfer(myWriter, theLabels, theMode, theIsMulti, Standard_False, theProgress);
 }
 
@@ -457,6 +508,20 @@ Standard_Boolean STEPCAFControl_Writer::Perform(const Handle(TDocStd_Document)&
   return Write(theFileName) == IFSelect_RetDone;
 }
 
+//=======================================================================
+//function : Perform
+//purpose  :
+//=======================================================================
+Standard_Boolean STEPCAFControl_Writer::Perform(const Handle(TDocStd_Document)& theDoc,
+                                                const Standard_CString theFileName,
+                                                const StepData_ConfParameters& theParams,
+                                                const Message_ProgressRange& theProgress)
+{
+  if (!Transfer(theDoc, theParams, STEPControl_AsIs, 0L, theProgress))
+    return Standard_False;
+  return Write(theFileName) == IFSelect_RetDone;
+}
+
 //=======================================================================
 //function : Perform
 //purpose  :
@@ -519,7 +584,6 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
   const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(theWriter.WS()->Model());
   prepareUnit(theLabels.First(), aModel, aLocalFactors); // set local length unit to the model
   // translate free top-level shapes of the DECAF document
-  const Standard_Integer aStepSchema = Interface_Static::IVal("write.step.schema");
   TDF_LabelSequence aSubLabels;
   Message_ProgressScope aPS(theProgress, "Labels", theLabels.Length());
   // Iterate on requested shapes
@@ -612,7 +676,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
       if (XCAFDoc_ShapeTool::IsAssembly(aCurL) || XCAFDoc_ShapeTool::IsReference(aCurL))
         anActor->RegisterAssembly(aCurShape);
 
-      theWriter.Transfer(aCurShape, theMode, Standard_False, aRange);
+      theWriter.Transfer(aCurShape, theMode, aModel->InternalParameters, Standard_False, aRange);
       anActor->SetStdMode(Standard_True); // restore default behaviour
     }
     else
@@ -623,10 +687,10 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
       if (aPS1.UserBreak())
         return Standard_False;
 
-      Standard_Integer assemblymode = Interface_Static::IVal("write.step.assembly");
-      Interface_Static::SetCVal("write.step.assembly", "On");
-      theWriter.Transfer(aSass, STEPControl_AsIs, Standard_True, aPS1.Next());
-      Interface_Static::SetIVal("write.step.assembly", assemblymode);
+      StepData_ConfParameters::WriteMode_Assembly assemblymode = aModel->InternalParameters.WriteAssembly;
+      aModel->InternalParameters.WriteAssembly = StepData_ConfParameters::WriteMode_Assembly_On;
+      theWriter.Transfer(aSass, STEPControl_AsIs, aModel->InternalParameters, Standard_True, aPS1.Next());
+      aModel->InternalParameters.WriteAssembly = assemblymode;
     }
   }
   if (aPS.UserBreak())
@@ -656,7 +720,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
     // write G&DTs
     if (GetDimTolMode())
     {
-      if (aStepSchema == 5)
+      if (aModel->InternalParameters.WriteSchema == 5)
       {
         writeDGTsAP242(theWriter.WS(), aSubLabels, aLocalFactors);
       }
@@ -691,7 +755,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
   theWriter.WS()->ComputeGraph(Standard_True);
 
   // Write names for the sub-shapes
-  if (Interface_Static::IVal("write.stepcaf.subshapes.name") != 0)
+  if (aModel->InternalParameters.WriteSubshapeNames != 0)
   {
     const Handle(XSControl_TransferWriter)& TW = this->ChangeWriter().WS()->TransferWriter();
     const Handle(Transfer_FinderProcess)& aFP = TW->FinderProcess();
@@ -785,11 +849,11 @@ TopoDS_Shape STEPCAFControl_Writer::transferExternFiles(const TDF_Label& theLabe
     anExtFile->SetWS(aNewWS);
     anExtFile->SetName(aNewName);
     anExtFile->SetLabel(theLabel);
-    Standard_Integer anAssemblymode = Interface_Static::IVal("write.step.assembly");
-    Interface_Static::SetCVal("write.step.assembly", "Off");
+    StepData_ConfParameters::WriteMode_Assembly anAssemblymode = aStepWriter.Model()->InternalParameters.WriteAssembly;
+    aStepWriter.Model()->InternalParameters.WriteAssembly = StepData_ConfParameters::WriteMode_Assembly_Off;
     const Standard_CString anIsMulti = 0;
     anExtFile->SetTransferStatus(transfer(aStepWriter, aLabelSeq, theMode, anIsMulti, Standard_True, theProgress));
-    Interface_Static::SetIVal("write.step.assembly", anAssemblymode);
+    aStepWriter.Model()->InternalParameters.WriteAssembly = anAssemblymode;
     myLabEF.Bind(theLabel, anExtFile);
     myFiles.Bind(aNewName->ToCString(), anExtFile);
 
@@ -842,7 +906,8 @@ Standard_Boolean STEPCAFControl_Writer::writeExternRefs(const Handle(XSControl_W
   const Handle(XSControl_TransferWriter)& aTW = theWS->TransferWriter();
   const Handle(Transfer_FinderProcess)& aFP = aTW->FinderProcess();
   STEPConstruct_ExternRefs anEFTool(theWS);
-  Standard_Integer aStepSchema = Interface_Static::IVal("write.step.schema");
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(theWS->Model());
+  Standard_Integer aStepSchema = aStepModel->InternalParameters.WriteSchema;
   // Iterate on requested shapes
   for (TDF_LabelSequence::Iterator aLabelIter(theLabels);
        aLabelIter.More(); aLabelIter.Next())
@@ -1290,6 +1355,10 @@ Standard_Boolean STEPCAFControl_Writer::writeColors(const Handle(XSControl_WorkS
     MakeSTEPStyles(Styles, aShape, aSettings, anOverride,
                    aMap, myMapCompMDGPR, DPDCs, ColRGBs, aSTool, 0, anIsComponent);
 
+    const Handle(XSControl_TransferWriter)& aTW = theWS->TransferWriter();
+    const Handle(Transfer_FinderProcess)& aFP = aTW->FinderProcess();
+    Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(aFP->Model());
+
     // create MDGPR and record it in model
     Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation) aMDGPR;
 
@@ -1299,15 +1368,13 @@ Standard_Boolean STEPCAFControl_Writer::writeColors(const Handle(XSControl_WorkS
       {
         Message::SendTrace() << "Error: Current Top-Level shape have MDGPR already " << "\n";
       }
-      Styles.CreateMDGPR(aContext, aMDGPR);
+      Styles.CreateMDGPR(aContext, aMDGPR, aStepModel);
       if (!aMDGPR.IsNull())
         myMapCompMDGPR.Bind(aTopSh, aMDGPR);
     }
     else
     {
       // create SDR and add to model.
-      const Handle(XSControl_TransferWriter)& aTW = theWS->TransferWriter();
-      const Handle(Transfer_FinderProcess)& aFP = aTW->FinderProcess();
       Handle(TransferBRep_ShapeMapper) aMapper = TransferBRep::ShapeMapper(aFP, aShape);
       Handle(StepShape_ContextDependentShapeRepresentation) aCDSR;
       if (aFP->FindTypedTransient(aMapper,
@@ -1896,6 +1963,7 @@ static Standard_Boolean createSHUOStyledItem(const XCAFPrs_Style& theStyle,
   // find the repr item of the shape
   const Handle(XSControl_TransferWriter)& aTW = theWS->TransferWriter();
   const Handle(Transfer_FinderProcess)& aFP = aTW->FinderProcess();
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(aFP->Model());
   Handle(TransferBRep_ShapeMapper) aMapper = TransferBRep::ShapeMapper(aFP, theShape);
   Handle(StepShape_ContextDependentShapeRepresentation) aCDSR;
   aFP->FindTypedTransient(aMapper,
@@ -1938,7 +2006,7 @@ static Standard_Boolean createSHUOStyledItem(const XCAFPrs_Style& theStyle,
     // create MDGPR and record it in model
     Message::SendTrace() << "Warning: " << __FILE__ << ": Create new MDGPR for SHUO instance" << "\n";
     Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation) aMDGPR;
-    aStyles.CreateMDGPR(aContext, aMDGPR);
+    aStyles.CreateMDGPR(aContext, aMDGPR, aStepModel);
     if (!aMDGPR.IsNull())
       theMapCompMDGPR.Bind(aTopSh, aMDGPR);
   }
index 8261c03a0d1206344fa431bcd3f1c8c8284b8a90..4d2dd038230f3079080e7b53b5b25e5abfd933fb 100644 (file)
@@ -24,6 +24,7 @@
 #include <STEPCAFControl_DataMapOfLabelExternFile.hxx>
 #include <STEPControl_Writer.hxx>
 #include <StepAP242_GeometricItemSpecificUsage.hxx>
+#include <StepData_ConfParameters.hxx>
 #include <StepDimTol_Datum.hxx>
 #include <StepDimTol_GeometricTolerance.hxx>
 #include <StepDimTol_HArray1OfDatumSystemOrReference.hxx>
@@ -91,8 +92,33 @@ public:
                                             const Standard_CString theIsMulti = 0,
                                             const Message_ProgressRange& theProgress = Message_ProgressRange());
 
+  //! Transfers a document (or single label) to a STEP model
+  //! This method uses if need to set parameters avoiding
+  //! initialization from Interface_Static
+  //! @param theParams  configuration parameters
+  //! @param theMode    mode of translation of shape is AsIs
+  //! @param theIsMulti if multi is not null pointer, it switches to multifile
+  //!                   mode (with external refs), and string pointed by <multi>
+  //!                   gives prefix for names of extern files (can be empty string)
+  //! @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 STEPControl_StepModelType theMode = STEPControl_AsIs,
+                                            const Standard_CString theIsMulti = 0,
+                                            const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+  //! Method to transfer part of the document specified by label
+  Standard_EXPORT Standard_Boolean Transfer(const TDF_Label& theLabel,
+                                            const STEPControl_StepModelType theMode = STEPControl_AsIs,
+                                            const Standard_CString theIsMulti = 0,
+                                            const Message_ProgressRange& theProgress = Message_ProgressRange());
+
   //! Method to transfer part of the document specified by label
+  //! 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 STEPControl_StepModelType theMode = STEPControl_AsIs,
                                             const Standard_CString theIsMulti = 0,
                                             const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -103,6 +129,15 @@ public:
                                             const Standard_CString theIsMulti = 0,
                                             const Message_ProgressRange& theProgress = Message_ProgressRange());
 
+  //! Mehod to writing sequence of root assemblies or part of the file specified by use by one label 
+  //! 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 STEPControl_StepModelType theMode = STEPControl_AsIs,
+                                            const Standard_CString theIsMulti = 0,
+                                            const Message_ProgressRange& theProgress = Message_ProgressRange());
+
   Standard_EXPORT Standard_Boolean Perform(const Handle(TDocStd_Document)& theDoc,
                                            const TCollection_AsciiString& theFileName,
                                            const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -113,6 +148,15 @@ public:
                                            const Standard_CString theFileName,
                                            const Message_ProgressRange& theProgress = Message_ProgressRange());
 
+  //! Transfers a document and writes it to a STEP file
+  //! This method uses if need to set parameters avoiding
+  //! initialization from Interface_Static
+  //! 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 Message_ProgressRange& theProgress = Message_ProgressRange());
+
   //! Returns data on external files
   //! Returns Null handle if no external files are read
   const NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>& ExternFiles() const { return myFiles; };
index 3f15bf466d97ee2dddbd0b3cbd7324d9a498b2f7..e7da67e011af25f5432e6a8ad1165a2daf7d76a4 100644 (file)
@@ -33,7 +33,6 @@
 #include <STEPConstruct_Assembly.hxx>
 #include <STEPConstruct_ContextTool.hxx>
 #include <STEPConstruct_Part.hxx>
-#include <StepData_StepModel.hxx>
 #include <StepGeom_Axis2Placement3d.hxx>
 #include <StepRepr_NextAssemblyUsageOccurrence.hxx>
 #include <StepShape_ShapeDefinitionRepresentation.hxx>
@@ -69,7 +68,8 @@ STEPConstruct_ContextTool::STEPConstruct_ContextTool (const Handle(StepData_Step
 void STEPConstruct_ContextTool::SetModel (const Handle(StepData_StepModel)& aStepModel)
 {
   theAPD.Nullify();  //thePRPC.Nullify();
-
+  mySchema = aStepModel->InternalParameters.WriteSchema;
+  myProductName = aStepModel->InternalParameters.WriteProductName;
   Standard_Integer i, nb = aStepModel->NbEntities();
   for(i = 1; i<=nb && theAPD.IsNull(); i ++) {
     Handle(Standard_Transient) ent = aStepModel->Value(i);
@@ -111,7 +111,7 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
   Standard_Boolean noapd = theAPD.IsNull();
   if (noapd || enforce) theAPD  = new StepBasic_ApplicationProtocolDefinition;
 
-  switch (Interface_Static::IVal("write.step.schema")) { //j4
+  switch (mySchema) { //j4
   default:
   case 1:
     theAPD->SetApplicationProtocolYear (1997);
@@ -147,7 +147,7 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
   if (theAPD->Application().IsNull())
     theAPD->SetApplication (new StepBasic_ApplicationContext);
   Handle(TCollection_HAsciiString) appl;
-  switch (Interface_Static::IVal("write.step.schema")) { //j4
+  switch (mySchema) { //j4
   default:
   case 1:
   case 2: appl = new TCollection_HAsciiString ( "core data for automotive mechanical design processes" );
@@ -567,8 +567,8 @@ void STEPConstruct_ContextTool::SetIndex (const Standard_Integer ind)
 Handle(TCollection_HAsciiString) STEPConstruct_ContextTool::GetProductName () const
 {
   Handle(TCollection_HAsciiString) PdtName;
-  if (Interface_Static::IsSet("write.step.product.name"))
-    PdtName = new TCollection_HAsciiString(Interface_Static::CVal("write.step.product.name"));
+  if (!myProductName.IsEmpty())
+    PdtName = new TCollection_HAsciiString(myProductName);
   else PdtName = new TCollection_HAsciiString("Product");
 
   for ( Standard_Integer i=1; i <= myLevel.Length(); i++ ) {
@@ -596,7 +596,7 @@ Handle(TColStd_HSequenceOfTransient) STEPConstruct_ContextTool::GetRootsForPart
   if ( ! SDRTool.PRPC().IsNull() ) seq->Append ( SDRTool.PRPC() );
 
   // for AP203, add required product management data
-  if ( Interface_Static::IVal("write.step.schema") == 3 ) {
+  if ( mySchema == 3 ) {
     theAP203.Init ( SDRTool );
     seq->Append (theAP203.GetProductCategoryRelationship());
     seq->Append (theAP203.GetCreator());
@@ -626,7 +626,7 @@ Handle(TColStd_HSequenceOfTransient) STEPConstruct_ContextTool::GetRootsForAssem
   seq->Append ( assembly.ItemValue() );
   
   // for AP203, write required product management data
-  if ( Interface_Static::IVal("write.step.schema") == 3 ) {
+  if ( mySchema == 3 ) {
     theAP203.Init ( assembly.GetNAUO() );
     seq->Append (theAP203.GetSecurity());
     seq->Append (theAP203.GetClassificationOfficer());
index 112aecc2600418cf49bed6f53145c568e07d44ca..35add18f49fde544fef3d609f389d4e0f13161bc 100644 (file)
 #include <TColStd_SequenceOfInteger.hxx>
 #include <STEPConstruct_AP203Context.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <Standard_Integer.hxx>
 #include <TColStd_HSequenceOfTransient.hxx>
 class StepBasic_ApplicationProtocolDefinition;
 class StepGeom_Axis2Placement3d;
-class StepData_StepModel;
 class TCollection_HAsciiString;
 class STEPConstruct_Part;
 class STEPConstruct_Assembly;
@@ -143,6 +143,8 @@ private:
   STEPConstruct_AP203Context theAP203;
   Handle(StepGeom_Axis2Placement3d) myAxis;
   StepData_Factors myGlobalFactor;
+  StepData_ConfParameters::WriteMode_StepSchema mySchema;
+  TCollection_AsciiString myProductName;
 
 };
 
index 73156f80575149a568134d33b4e70d478a5880d9..3e8c03c3f71687611d41fe705b0b507ca1a7ed95 100644 (file)
@@ -26,6 +26,7 @@
 #include <StepBasic_ProductDefinitionFormationWithSpecifiedSource.hxx>
 #include <StepBasic_ProductType.hxx>
 #include <STEPConstruct_Part.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepRepr_ProductDefinitionShape.hxx>
 #include <StepShape_ShapeDefinitionRepresentation.hxx>
 #include <StepShape_ShapeRepresentation.hxx>
@@ -56,10 +57,11 @@ STEPConstruct_Part::STEPConstruct_Part()
 
 void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR,
                                 const Handle(TCollection_HAsciiString)& aName,
-                                const Handle(StepBasic_ApplicationContext)& AC)
+                                const Handle(StepBasic_ApplicationContext)& AC,
+                 Handle(StepData_StepModel)& theStepModel)
 {
   // get current schema
-  Standard_Integer schema = Interface_Static::IVal("write.step.schema");
+  const Standard_Integer schema = theStepModel->InternalParameters.WriteSchema;
   
   // create PC
   Handle(StepBasic_ProductContext) PC;
@@ -142,7 +144,7 @@ void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR
 
   // and an associated PRPC
   Handle(TCollection_HAsciiString) PRPCName;
-  switch (Interface_Static::IVal("write.step.schema")) {
+  switch (theStepModel->InternalParameters.WriteSchema) {
   default:
   case 1: 
     myPRPC = new StepBasic_ProductType; 
index 534a3759420135b92b602fee7634d9221743b311..3d4352350d40dbe17cb5fed773dbe610a616072d 100644 (file)
@@ -31,6 +31,7 @@ class StepBasic_ProductDefinitionContext;
 class StepBasic_Product;
 class StepBasic_ProductDefinitionFormation;
 class StepBasic_ProductDefinition;
+class StepData_StepModel;
 class StepRepr_ProductDefinitionShape;
 
 
@@ -47,7 +48,10 @@ public:
   
   Standard_EXPORT STEPConstruct_Part();
   
-  Standard_EXPORT void MakeSDR (const Handle(StepShape_ShapeRepresentation)& aShape, const Handle(TCollection_HAsciiString)& aName, const Handle(StepBasic_ApplicationContext)& AC);
+  Standard_EXPORT void MakeSDR (const Handle(StepShape_ShapeRepresentation)& aShape,
+                                const Handle(TCollection_HAsciiString)& aName,
+                                const Handle(StepBasic_ApplicationContext)& AC,
+                                Handle(StepData_StepModel)& theStepModel);
   
   Standard_EXPORT void ReadSDR (const Handle(StepShape_ShapeDefinitionRepresentation)& aShape);
   
index 09c0efcabb5998b4c5be53055d247c25c95c1301..f1cfe0c4176f2e66ee36d669c14ae6125c1fc836 100644 (file)
@@ -228,7 +228,8 @@ Handle(StepVisual_StyledItem) STEPConstruct_Styles::AddStyle (const TopoDS_Shape
 //=======================================================================
 
 Standard_Boolean STEPConstruct_Styles::CreateMDGPR (const Handle(StepRepr_RepresentationContext) &Context,
-                                                    Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& Repr)
+                                                    Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& Repr,
+                                                    Handle(StepData_StepModel)& theStepModel)
 {
   if ( myStyles.Extent() <1 ) return Standard_False;
   
@@ -246,7 +247,7 @@ Standard_Boolean STEPConstruct_Styles::CreateMDGPR (const Handle(StepRepr_Repres
 //   Model()->AddWithRefs ( Repr ); add into the model upper
 
   // for AP203, add subschema name
-  if ( Interface_Static::IVal("write.step.schema") ==3 ) {
+  if ( theStepModel->InternalParameters.WriteSchema == 3 ) {
     APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
     Handle(TCollection_HAsciiString) subSchema = 
       new TCollection_HAsciiString ( "SHAPE_APPEARANCE_LAYER_MIM" );
index 5fc2cd6c865ca02a879cf0f453e97bb8fd11b42c..21a878bef6180a2c6e47cc7276792fa00af3fb94 100644 (file)
@@ -96,7 +96,9 @@ public:
   
   //! Create MDGPR, fill it with all the styles previously defined,
   //! and add it to the model
-  Standard_EXPORT Standard_Boolean CreateMDGPR (const Handle(StepRepr_RepresentationContext)& Context, Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& MDGPR);
+  Standard_EXPORT Standard_Boolean CreateMDGPR (const Handle(StepRepr_RepresentationContext)& Context,
+                                                Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& MDGPR,
+                                                Handle(StepData_StepModel)& theStepModel);
   
   //! Create MDGPR, fill it with all the styles previously defined,
   //! and add it to the model
index 57a5fb485c560bb5cd4454cfc02e13b5ab854daa..15d28b728c9c67392b2014de93bd17d4ff6170a5 100644 (file)
@@ -35,6 +35,7 @@
 #include <StepBasic_SiUnitAndVolumeUnit.hxx>
 #include <STEPConstruct_UnitContext.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
 #include <StepRepr_GlobalUncertaintyAssignedContext.hxx>
 #include <StepRepr_GlobalUnitAssignedContext.hxx>
@@ -64,6 +65,7 @@ STEPConstruct_UnitContext::STEPConstruct_UnitContext()
 //=======================================================================
 
 void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d,
+                                     const Handle(StepData_StepModel)& theModel,
                                      const StepData_Factors& theLocalFactors)
 {
   done = Standard_True;
@@ -82,7 +84,7 @@ void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d,
   Standard_Boolean hasPref = Standard_True;
   StepBasic_SiPrefix siPref = StepBasic_spMilli;
   Standard_Real aScale = 1.;
-  switch (Interface_Static::IVal("write.step.unit"))
+  switch (theModel->InternalParameters.WriteUnit)
   {
     case  1: uName = "INCH"; aScale = 25.4; break;
     default:
index 40a1bd5e2e6b0de74632048b214592690521586c..c463ab42e7560ae0746fcf8d281b67b60ed244e5 100644 (file)
@@ -25,6 +25,7 @@
 #include <Standard_CString.hxx>
 #include <StepBasic_SiPrefix.hxx>
 class StepData_Factors;
+class StepData_StepModel;
 class StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx;
 class StepRepr_GlobalUnitAssignedContext;
 class StepBasic_NamedUnit;
@@ -47,6 +48,7 @@ public:
   //! Creates new context (units are MM and radians,
   //! uncertainty equal to Tol3d)
   Standard_EXPORT void Init (const Standard_Real Tol3d,
+                             const Handle(StepData_StepModel)& theModel,
                              const StepData_Factors& theLocalFactors);
   
   //! Returns True if Init was called successfully
index 558b97dc637ad1d7bdaf4d9c98c827d04119d5c8..10f0c336414131f27fc15c00a618c448a270b361 100644 (file)
@@ -346,9 +346,11 @@ Standard_Boolean STEPConstruct_ValidationProps::AddProp (const StepRepr_Characte
   // record SDR in order to have it written to the file
   Model()->AddWithRefs ( PrDR );
 
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(Model());
+
   // for AP203, add subschema name
-  if ( Interface_Static::IVal("write.step.schema") ==3 ) {
-    APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
+  if ( aStepModel->InternalParameters.WriteSchema ==3 ) {
+    APIHeaderSection_MakeHeader mkHdr ( aStepModel );
     Handle(TCollection_HAsciiString) subSchema = 
       new TCollection_HAsciiString ( "GEOMETRIC_VALIDATION_PROPERTIES_MIM" );
     mkHdr.AddSchemaIdentifier ( subSchema );
index 952054f702b1d861fed39b4d63e1b8fe8344d296..c09230589535710e38ba4afd35f10829e89aae3a 100644 (file)
@@ -211,9 +211,10 @@ namespace {
 // Purpose : Empty constructor
 // ============================================================================
 
-STEPControl_ActorRead::STEPControl_ActorRead()
+STEPControl_ActorRead::STEPControl_ActorRead(const Handle(Interface_InterfaceModel)& theModel)
 : myPrecision(0.0),
-  myMaxTol(0.0)
+  myMaxTol(0.0),
+  myModel(theModel)
 {
 }
 
@@ -231,8 +232,13 @@ Standard_Boolean  STEPControl_ActorRead::Recognize
 
   if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) return Standard_True;
 
-  TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
-  if(!aProdMode.IsEqual("ON"))
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(myModel);
+  if (aStepModel.IsNull())
+  {
+    return false;
+  }
+  bool aProdMode = aStepModel->InternalParameters.ReadProductMode;
+  if(!aProdMode)
     if(start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) return Standard_True;
 
   DeclareAndCast(StepShape_ShapeRepresentation,sr,start);
@@ -244,7 +250,7 @@ Standard_Boolean  STEPControl_ActorRead::Recognize
     return Standard_False;
   }
 
-  const Standard_Boolean aCanReadTessGeom = (Interface_Static::IVal("read.step.tessellated") != 0);
+  const Standard_Boolean aCanReadTessGeom = aStepModel->InternalParameters.ReadTessellated != 0;
 
   if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))) return Standard_True;
   if (start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))) return Standard_True;
@@ -327,7 +333,7 @@ Handle(Transfer_Binder)  STEPControl_ActorRead::Transfer
     }
   }
   // [END] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
-  Standard_Boolean aTrsfUse = (Interface_Static::IVal("read.step.root.transformation") == 1);
+  Standard_Boolean aTrsfUse = (aStepModel->InternalParameters.ReadRootTransformation == 1);
   return TransferShape(start, TP, aLocalFactors, Standard_True, aTrsfUse, theProgress);
 }
 
@@ -431,10 +437,12 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
                    Handle(TColStd_HSequenceOfTransient)& listSDRAspect,
                    const Handle(Transfer_TransientProcess)& TP)
 {
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
+
   // Flag indicating preferred shape representation type, to be chosen if 
   // several different representations are attached to the same shape
   Standard_Integer delta = 100;
-  Standard_Integer ICS = Interface_Static::IVal("read.step.shape.repr");
+  Standard_Integer ICS = aStepModel->InternalParameters.ReadShapeRepr;
   Standard_Integer nbSDR0 = listSDR->Length();
   
   // Iterate by entities referring PDS
@@ -534,17 +542,19 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
       continue;
     }
   }
+
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
   
   // Flag indicating whether SDRs associated with the product`s main SDR
   // by SRRs (which correspond to hybrid model representation in AP203 since 1998) 
   // should be taken into account 
-  Standard_Integer readSRR = Interface_Static::IVal("read.step.shape.relationship");
+  Standard_Integer readSRR = aStepModel->InternalParameters.ReadRelationship;
   
-  Standard_Integer readConstructiveGeomRR = Interface_Static::IVal("read.step.constructivegeom.relationship");
+  Standard_Integer readConstructiveGeomRR = aStepModel->InternalParameters.ReadConstrRelation;
   // Flag indicating whether SDRs associated with the product`s main SDR
   // by SAs (which correspond to hybrid model representation in AP203 before 1998) 
   // should be taken into account 
-  Standard_Integer readSA = Interface_Static::IVal("read.step.shape.aspect");
+  Standard_Integer readSA = aStepModel->InternalParameters.ReadShapeAspect;
   if ( ! readSA ) 
     listSDRAspect->Clear();  
     
@@ -558,7 +568,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
   // possibly attached directly to intermediate assemblies (1)
   // Special mode (4) is used to translate shape attached to this product only,
   // ignoring sub-assemblies if any
-  Standard_Integer readAssembly = Interface_Static::IVal("read.step.assembly.level");
+  Standard_Integer readAssembly = aStepModel->InternalParameters.ReadAssemblyLevel;
   if ( readAssembly ==3 || ( readAssembly ==2 && listNAUO->Length() >0 ) ) 
     listSDR->Clear();
   else if ( readAssembly == 4 )
@@ -824,6 +834,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
 {
   NM_DETECTED = Standard_False;
   Handle(TransferBRep_ShapeBinder) shbinder;
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
   if(!Recognize(sr))
     return shbinder;
   isBound = Standard_False;
@@ -848,7 +859,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
   Standard_Integer nsh = 0;
 
   // [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("read.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode = aStepModel->InternalParameters.ReadNonmanifold != 0;
   Standard_Boolean isManifold = Standard_True;
   if ( isNMMode && sr->IsKind(STANDARD_TYPE(StepShape_NonManifoldSurfaceShapeRepresentation)) ) {
     isManifold = Standard_False;
@@ -860,7 +871,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
   } 
   // Special processing for I-DEAS STP case (ssv; 15.11.2010)
   else {
-    Standard_Integer isIDeasMode = Interface_Static::IVal("read.step.ideas");
+    Standard_Integer isIDeasMode = aStepModel->InternalParameters.ReadIdeas;
     if (isNMMode && myNMTool.IsIDEASCase() && isIDeasMode) {
       isManifold = Standard_False;
       NM_DETECTED = Standard_True;
@@ -1412,7 +1423,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
          << start->DynamicType()->Name() << std::endl;
   chrono.Start();
 #endif
-  
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
   //:S4136
   StepData_Factors aLocalFactors = theLocalFactors;
   Handle(StepRepr_Representation) oldSRContext = mySRContext;
@@ -1420,7 +1431,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
     Handle(StepRepr_Representation) context = FindContext ( start, TP );
     if ( context.IsNull() ) {
       TP->AddWarning ( start, "Entity with no unit context; default units taken" );
-      ResetUnits(aLocalFactors);
+      ResetUnits(aStepModel, aLocalFactors);
     }
     else PrepareUnits ( context, TP, aLocalFactors);
   }
@@ -1429,8 +1440,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
 
   // Start progress scope (no need to check if progress exists -- it is safe)
   Message_ProgressScope aPS(theProgress, "Transfer stage", isManifold ? 2 : 1);
-
-  const Standard_Boolean aReadTessellatedWhenNoBRepOnly = (Interface_Static::IVal("read.step.tessellated") == 2);
+  const Standard_Boolean aReadTessellatedWhenNoBRepOnly = (aStepModel->InternalParameters.ReadTessellated == 2);
   Standard_Boolean aHasGeom = Standard_True;
   try {
     OCC_CATCH_SIGNALS
@@ -1631,11 +1641,12 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
     myTF.Init(fs, myTool, dummyNMTool, theLocalFactors);
     Handle(StepRepr_Representation) oldSRContext = mySRContext;
     StepData_Factors aLocalFactors = theLocalFactors;
+    Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
     if (mySRContext.IsNull()) { // if no context, try to find it (ex: r0701_ug.stp #4790)
       Handle(StepRepr_Representation) context = FindContext(fs, TP);
       if (context.IsNull()) {
         TP->AddWarning(fs, "Entity with no unit context; default units taken");
-        ResetUnits(aLocalFactors);
+        ResetUnits(aStepModel, aLocalFactors);
       }
       else PrepareUnits(context, TP, aLocalFactors);
     }
@@ -1695,13 +1706,13 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
 #endif
   
   Handle(TransferBRep_ShapeBinder) shbinder;
-  
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
 
   // Product Definition Entities
   // They should be treated with Design Manager
    // case ShapeDefinitionRepresentation if ProductMode != ON
-  TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
-  if(!aProdMode.IsEqual("ON") && 
+  bool aProdMode = aStepModel->InternalParameters.ReadProductMode;
+  if(!aProdMode && 
      start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) 
     shbinder = OldWay(start,TP, theProgress);
   //skl
@@ -1773,10 +1784,10 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
                                          StepData_Factors& theLocalFactors)
 {
   mySRContext = rep;
-  
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(TP->Model());
   Standard_Integer stat1, stat2 = 0;  // sera alimente par STEPControl_Unit
   if (rep.IsNull()) {
-    ResetUnits(theLocalFactors);
+    ResetUnits(aModel, theLocalFactors);
     return;
   }
   
@@ -1784,7 +1795,7 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
   Handle(StepRepr_RepresentationContext) theRepCont = rep->ContextOfItems();
   if (theRepCont.IsNull()) {
     TP->AddWarning(rep,"Bad RepresentationContext, default unit taken");
-    ResetUnits(theLocalFactors);
+    ResetUnits(aModel, theLocalFactors);
     return;
   }
 
@@ -1815,13 +1826,13 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
     aTol    = theGRCAGAUC->GlobalUncertaintyAssignedContext();
   }
 
-
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
   // ----------------------------------------------------
   // Decoding and Setting the Values
   // ----------------------------------------------------
   if (!theGUAC.IsNull()) {
     stat1 = myUnit.ComputeFactors(theGUAC, theLocalFactors);
-    Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
+    Standard_Integer anglemode = aStepModel->InternalParameters.AngleUnit;
     Standard_Real angleFactor = ( anglemode == 0 ? myUnit.PlaneAngleFactor() :
                                  anglemode == 1 ? 1. : M_PI/180. );
     theLocalFactors.InitializeFactors(myUnit.LengthFactor(),
@@ -1836,15 +1847,15 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
   }
 
 //  myPrecision = Precision::Confusion();
-  if (Interface_Static::IVal("read.precision.mode") == 1)  //:i1 gka S4136 05.04.99
-    myPrecision = Interface_Static::RVal("read.precision.val");
+  if (aStepModel->InternalParameters.ReadPrecisionMode == 1)  //:i1 gka S4136 05.04.99
+    myPrecision = aStepModel->InternalParameters.ReadPrecisionVal;
   else if (myUnit.HasUncertainty())
     myPrecision = myUnit.Uncertainty() * myUnit.LengthFactor();
   else {
     TP->AddWarning(theRepCont,"No Length Uncertainty, value of read.precision.val is taken");
-    myPrecision = Interface_Static::RVal("read.precision.val");
+    myPrecision = aStepModel->InternalParameters.ReadPrecisionVal;
   }
-  myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
+  myMaxTol = Max ( myPrecision, aStepModel->InternalParameters.ReadMaxPrecisionVal );
   // Assign uncertainty
 #ifdef TRANSLOG
   if (TP->TraceLevel() > 1) 
@@ -1857,11 +1868,11 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
 //purpose  : 
 //=======================================================================
 
-void  STEPControl_ActorRead::ResetUnits (StepData_Factors& theLocalFactors)
+void  STEPControl_ActorRead::ResetUnits (Handle(StepData_StepModel)& theModel, StepData_Factors& theLocalFactors)
 {
   theLocalFactors.InitializeFactors ( 1, 1, 1 );
-  myPrecision = Interface_Static::RVal("read.precision.val");
-  myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
+  myPrecision = theModel->InternalParameters.ReadPrecisionVal;
+  myMaxTol = Max ( myPrecision, theModel->InternalParameters.ReadMaxPrecisionVal );
 }
 
 //=======================================================================
@@ -2071,3 +2082,12 @@ void STEPControl_ActorRead::computeIDEASClosings(const TopoDS_Compound& comp,
       shellClosingsMap.Add(shellA, closingShells);
   }
 }
+
+//=======================================================================
+// Method  : SetModel
+// Purpose :
+//=======================================================================
+void STEPControl_ActorRead::SetModel(const Handle(Interface_InterfaceModel)& theModel)
+{
+  myModel = theModel;
+}
index 7ca5e805165515ec84b9016088720b7dcd15af0a..66b7a13f52694cf91aec29fb967196a9508dddd6 100644 (file)
@@ -26,6 +26,7 @@
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <Message_ProgressRange.hxx>
+#include <Interface_InterfaceModel.hxx>
 
 class StepRepr_Representation;
 class Standard_Transient;
@@ -47,6 +48,7 @@ class TopoDS_Shell;
 class TopoDS_Compound;
 class StepRepr_ConstructiveGeometryRepresentationRelationship;
 class StepData_Factors;
+class StepData_StepModel;
 
 
 class STEPControl_ActorRead;
@@ -62,8 +64,7 @@ class STEPControl_ActorRead : public Transfer_ActorOfTransientProcess
 
 public:
 
-
-  Standard_EXPORT STEPControl_ActorRead();
+  Standard_EXPORT STEPControl_ActorRead(const Handle(Interface_InterfaceModel)& theModel);
 
   Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
 
@@ -88,7 +89,11 @@ public:
 
   //! reset units and tolerances context to default
   //! (mm, radians, read.precision.val, etc.)
-  Standard_EXPORT void ResetUnits(StepData_Factors& theLocalFactors);
+  Standard_EXPORT void ResetUnits(Handle(StepData_StepModel)& theModel,
+                                  StepData_Factors& theLocalFactors);
+
+  //! Set model
+  Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& theModel);
 
   //! Computes transformation defined by two axis placements (in MAPPED_ITEM
   //! or ITEM_DEFINED_TRANSFORMATION) taking into account their
@@ -205,7 +210,7 @@ private:
   Standard_Real myPrecision;
   Standard_Real myMaxTol;
   Handle(StepRepr_Representation) mySRContext;
-
+  Handle(Interface_InterfaceModel) myModel;
 
 };
 
index b96d0d8e4268ac42dfe83b19fcc29f3869325026..f3256d0146c103474279987bb2f54efb85cdd550 100644 (file)
@@ -545,12 +545,12 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
   }
   Standard_Real aLFactor = model->WriteLengthUnit();
   aLFactor /= model->LocalLengthUnit();
-  Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
+  const Standard_Integer anglemode = model->InternalParameters.AngleUnit;
   StepData_Factors aLocalFactors;
   aLocalFactors.InitializeFactors(aLFactor, (anglemode <= 1 ? 1. : M_PI / 180.), 1.);
   // create SDR
   STEPConstruct_Part SDRTool;
-  SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
+  SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), model);
   Handle(StepShape_ShapeDefinitionRepresentation) sdr = SDRTool.SDRValue();
   // transfer shape
 
@@ -575,18 +575,18 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
 
 //==========================================
 
-static Standard_Real UsedTolerance (const Standard_Real mytoler, 
-                                   const TopoDS_Shape& theShape)
+static Standard_Real UsedTolerance (Handle(StepData_StepModel)& theStepModel,
+                                    const Standard_Real mytoler, 
+                                    const TopoDS_Shape& theShape)
 {
 
   //    COMPUTING 3D TOLERANCE
   //    Either from Session, or Computed (Least,Average, or Greatest)
   //    Then given to TopoDSToStep_Tool
-
   Standard_Real Tol = mytoler;
-  Standard_Integer tolmod = Interface_Static::IVal("write.precision.mode");
+  Standard_Integer tolmod = theStepModel->InternalParameters.WritePrecisionMode;
   if (Tol <= 0 && tolmod == 2) Tol =
-    Interface_Static::RVal("write.precision.val");
+    theStepModel->InternalParameters.WritePrecisionVal;
   if (Tol <= 0) {
     ShapeAnalysis_ShapeTolerance stu;
     Tol = stu.Tolerance (theShape,tolmod);
@@ -605,11 +605,12 @@ static Standard_Real UsedTolerance (const Standard_Real mytoler,
 // if GroupMode is >1 downgrades all compounds having single subshape to that 
 // subshape
 
-Standard_Boolean STEPControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const
+Standard_Boolean STEPControl_ActorWrite::IsAssembly (const Handle(StepData_StepModel)& theModel,
+                                                     TopoDS_Shape &S) const
 {
   if ( ! GroupMode() || S.ShapeType() != TopAbs_COMPOUND ) return Standard_False;
   // PTV 16.09.2002  OCC725 for storing compound of vertices
-  if (Interface_Static::IVal("write.step.vertex.mode") == 0) {//bug 23950
+  if (theModel->InternalParameters.WriteVertexMode == 0) {//bug 23950
     if (S.ShapeType() == TopAbs_COMPOUND ) {
       Standard_Boolean IsOnlyVertices = Standard_True;
       TopoDS_Iterator anItr( S );
@@ -630,7 +631,7 @@ Standard_Boolean STEPControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const
   it.Next();
   if ( it.More() ) return Standard_True;
   S = shape;
-  return IsAssembly ( S );
+  return IsAssembly ( theModel, S );
 }
 
 //=======================================================================
@@ -669,7 +670,8 @@ static Standard_Boolean transferVertex (const Handle(Transfer_FinderProcess)& FP
 {
   Standard_Boolean IsDone = Standard_False;
   MoniTool_DataMapOfShapeTransient aMap;
-  TopoDSToStep_Tool    aTool(aMap, Standard_True);
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  TopoDSToStep_Tool    aTool(aMap, Standard_True, aStepModel->InternalParameters.WriteSurfaceCurMode);
   TopoDSToStep_MakeStepVertex aMkVrtx ( TopoDS::Vertex(aShVrtx), aTool, FP, theLocalFactors );
   
   if (!aMkVrtx.IsDone())
@@ -701,6 +703,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
   STEPControl_StepModelType mymode = Mode();
   Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start);
   Handle(Transfer_Binder) binder;
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
 
   // Indicates whether to use an existing NMSSR to write items to (ss; 13.11.2010)
   Standard_Boolean useExistingNMSSR = Standard_False;
@@ -724,13 +727,13 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
   }
 
   // MODE ASSEMBLY : if Compound, (sub-)assembly
-  if ( IsAssembly(theShape) )
+  if ( IsAssembly(aStepModel, theShape) )
     return TransferCompound(start, SDR0, FP, theLocalFactors, theProgress);
 
   Message_ProgressScope aPSRoot(theProgress, NULL, 2);
 
   // [BEGIN] Separate manifold topology from non-manifold in group mode 0 (ssv; 18.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode = aStepModel->InternalParameters.WriteNonmanifold != 0;
   Handle(Transfer_Binder) aNMBinder;
   if (isNMMode && !GroupMode() && theShape.ShapeType() == TopAbs_COMPOUND) {
     TopoDS_Compound aNMCompound;
@@ -823,7 +826,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
         sdr = SDR0;
       else {
         STEPConstruct_Part SDRTool;
-        SDRTool.MakeSDR( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
+        SDRTool.MakeSDR( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), aStepModel );
         sdr = SDRTool.SDRValue();
       }
 
@@ -854,7 +857,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
   Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
 
   Standard_Boolean isSeparateVertices =
-    Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
+    aStepModel->InternalParameters.WriteVertexMode == 0;//bug 23950
   // PTV 16.09.2002 OCC725 separate shape from solo vertices.
   Standard_Boolean isOnlyVertices = Standard_False;
   if (theShape.ShapeType() == TopAbs_COMPOUND && isSeparateVertices)
@@ -957,7 +960,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
   //    COMPUTING 3D TOLERANCE
   //    Either from Session, or Computed (Least,Average, or Greatest)
   //    Then given to TopoDSToStep_Tool
-  Standard_Real Tol = UsedTolerance (mytoler,theShape);
+  Standard_Real Tol = UsedTolerance (aStepModel, mytoler,theShape);
   
   // Create a STEP-Entity for each TopoDS_Shape  
   // according to the current StepModelMode
@@ -999,7 +1002,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
 
     if (hasGeometry(aShape)) 
     {
-      Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
+      Standard_Real maxTol = aStepModel->InternalParameters.ReadMaxPrecisionVal;
 
       aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
         "write.step.resource.name",
@@ -1323,7 +1326,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
       GetCasted(StepRepr_RepresentationItem, ItemSeq->Value(rep));
     items->SetValue(rep,repit);
   }
-  Standard_Integer ap = Interface_Static::IVal("write.step.schema");
+  Standard_Integer ap = aStepModel->InternalParameters.WriteSchema;
   Transfer_SequenceOfBinder aSeqBindRelation;
   if(ap == 3 && nbs > 1) {
     Standard_Integer j = 1;
@@ -1353,7 +1356,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
       repr1->SetValue(2,items->Value(j));
       ShapeRepr1->SetItems(repr1);
       STEPConstruct_UnitContext mk1;
-      mk1.Init(Tol, theLocalFactors);
+      mk1.Init(Tol, aStepModel, theLocalFactors);
       ShapeRepr1->SetContextOfItems(mk1.Value());  // la tolerance, voir au debut
       ShapeRepr1->SetName (new TCollection_HAsciiString(""));
       
@@ -1390,7 +1393,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
       Handle(StepShape_ShapeRepresentation) shapeTessRepr = new StepVisual_TessellatedShapeRepresentation;
       shapeTessRepr->SetItems(itemsTess);
       STEPConstruct_UnitContext mk1;
-      mk1.Init(Tol, theLocalFactors);
+      mk1.Init(Tol, aStepModel, theLocalFactors);
       shapeTessRepr->SetContextOfItems(mk1.Value());
       shapeTessRepr->SetName(new TCollection_HAsciiString(""));
 
@@ -1413,7 +1416,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
 
   // init representation
   STEPConstruct_UnitContext mk;
-  mk.Init(Tol, theLocalFactors);
+  mk.Init(Tol, aStepModel, theLocalFactors);
   shapeRep->SetContextOfItems(mk.Value());  // la tolerance, voir au debut
   shapeRep->SetName (new TCollection_HAsciiString(""));
 
@@ -1459,8 +1462,10 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
   if (mapper.IsNull()) return binder;
   TopoDS_Shape theShape = mapper->Value();
 
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+
   // Inspect non-manifold topology case (ssv; 10.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode = aStepModel->InternalParameters.WriteNonmanifold != 0;
   Standard_Boolean isManifold;
   if (isNMMode)
     isManifold = IsManifoldShape(theShape);
@@ -1472,7 +1477,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
   // Prepare a collection for non-manifold group of shapes
   Handle(TopTools_HSequenceOfShape) NonManifoldGroup = new TopTools_HSequenceOfShape();
   Standard_Boolean isSeparateVertices = 
-    (Interface_Static::IVal("write.step.vertex.mode") == 0);//bug 23950
+    (aStepModel->InternalParameters.WriteVertexMode == 0);//bug 23950
   // PTV OCC725 17.09.2002 -- begin --
   Standard_Integer nbFreeVrtx = 0;
   TopoDS_Compound aCompOfVrtx;
@@ -1560,9 +1565,9 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
   for (Standard_Integer rep = 1; rep <= nsub; rep++)
     items->SetValue(rep,GetCasted(StepRepr_RepresentationItem, ItemSeq->Value(rep)));
   shapeRep->SetItems(items);
-  Standard_Real Tol = UsedTolerance (mytoler,theShape);
+  Standard_Real Tol = UsedTolerance (aStepModel, mytoler,theShape);
   STEPConstruct_UnitContext mk;
-  mk.Init(Tol, theLocalFactors);
+  mk.Init(Tol, aStepModel, theLocalFactors);
   shapeRep->SetContextOfItems(mk.Value());  // la tolerance, voir au debut
   shapeRep->SetName (new TCollection_HAsciiString(""));
 
@@ -1612,14 +1617,15 @@ Handle(Transfer_Binder)  STEPControl_ActorWrite::TransferSubShape
   Handle(Transfer_Binder) resbind = FP->Find(mapper);
   Handle(StepShape_ShapeDefinitionRepresentation) sdr;
 //  Handle(StepShape_ShapeRepresentation) resultat;
-  STEPConstruct_Part SDRTool;  
+  STEPConstruct_Part SDRTool;
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
 
   // Already SDR and SR available : take them as are
   Standard_Boolean iasdr = FP->GetTypedTransient
     (resbind,STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation),sdr);
   if ( iasdr ) SDRTool.ReadSDR ( sdr ); 
   else { 
-    SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
+    SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), aStepModel );
     sdr = SDRTool.SDRValue();
   }
 //  resultat = GetCasted(StepShape_ShapeRepresentation,sdr->UsedRepresentation());
index 960abaadef49bc259f6e38897241d1d791668f3f..5cf5aca20e2b956c27067a9e7165be60c8af8b0d 100644 (file)
@@ -96,7 +96,8 @@ public:
   //! Default implementation uses flag GroupMode and analyses
   //! the shape itself
   //! NOTE: this method can modify shape
-  Standard_EXPORT virtual Standard_Boolean IsAssembly (TopoDS_Shape& S) const;
+  Standard_EXPORT virtual Standard_Boolean IsAssembly (const Handle(StepData_StepModel)& theModel,
+                                                       TopoDS_Shape& S) const;
 
 
 
index 87737b0aaf1aa1d9397d33f969cf7bab03e63192..2b45463e6abd5cd13f96c9d43e8729adc9907b1a 100644 (file)
@@ -23,6 +23,7 @@
 #include <IFSelect_SignCounter.hxx>
 #include <Interface_Macros.hxx>
 #include <Interface_Static.hxx>
+#include <MoniTool_Macros.hxx>
 #include <RWHeaderSection.hxx>
 #include <RWStepAP214.hxx>
 #include <Standard_Type.hxx>
@@ -35,6 +36,8 @@
 #include <STEPEdit.hxx>
 #include <STEPEdit_EditContext.hxx>
 #include <STEPEdit_EditSDR.hxx>
+#include <STEPControl_ActorRead.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepSelect_WorkLibrary.hxx>
 #include <STEPSelections_SelectAssembly.hxx>
 #include <STEPSelections_SelectDerived.hxx>
@@ -323,14 +326,12 @@ STEPControl_Controller::STEPControl_Controller ()
   aMutex.Unlock();
 
   Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite;
-  ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
   myAdaptorWrite = ActWrite;
 
   Handle(StepSelect_WorkLibrary) swl = new StepSelect_WorkLibrary;
   swl->SetDumpLabel(1);
   myAdaptorLibrary  = swl;
   myAdaptorProtocol = STEPEdit::Protocol();
-  myAdaptorRead     = new STEPControl_ActorRead;  // par ex pour Recognize
 
   SetModeWrite (0,4);
   SetModeWriteHelp (0,"As Is");
@@ -405,6 +406,20 @@ Handle(Interface_InterfaceModel)  STEPControl_Controller::NewModel () const
   return STEPEdit::NewModel();
 }
 
+//=======================================================================
+//function : ActorRead
+//purpose  : 
+//=======================================================================
+Handle(Transfer_ActorOfTransientProcess) STEPControl_Controller::ActorRead(const Handle(Interface_InterfaceModel)& theModel) const
+{
+  DeclareAndCast(STEPControl_ActorRead, anAdap, myAdaptorRead);
+  if (anAdap.IsNull()) {
+    anAdap = new STEPControl_ActorRead(theModel);
+    anAdap->SetModel(theModel);
+  }
+  return anAdap;
+}
+
 //  ####    PROVISOIRE ???   ####
 
 IFSelect_ReturnStatus  STEPControl_Controller::TransferWriteShape
@@ -419,7 +434,7 @@ IFSelect_ReturnStatus  STEPControl_Controller::TransferWriteShape
     Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite);
 //    A PRESENT ON PASSE PAR LE PROFILE
   if (!ActWrite.IsNull()) 
-    ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
+    ActWrite->SetGroupMode (Handle(StepData_StepModel)::DownCast(model)->InternalParameters.WriteAssembly);
 
   return XSControl_Controller::TransferWriteShape(shape, FP, model, modeshape, theProgress);
 }
index 83e897b31c4adf71b09d4638ffded760e719f691..f61f9b540f6a3fd3c63b07f0a87147fb75eb2c06 100644 (file)
@@ -46,7 +46,10 @@ public:
   //! Creates a new empty Model ready to receive data of the Norm.
   //! It is taken from STEP Template Model
   Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
-  
+
+  //! Returns the Actor for Read attached to the pair (norm,appli)
+  Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) ActorRead(const Handle(Interface_InterfaceModel)& theModel) const Standard_OVERRIDE;
+
   Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS) Standard_OVERRIDE;
   
   //! Takes one Shape and transfers it to the InterfaceModel
index 01d992421d4ef087c2f31680d89ff5725c34e8aa..a35346360d9660a19bfb87a9cb4b6e6b3a8e8580 100644 (file)
 // commercial license or contractual agreement.
 
 
+#include <IFSelect_WorkLibrary.hxx>
 #include <Interface_EntityIterator.hxx>
 #include <Interface_Graph.hxx>
 #include <Interface_Static.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
 #include <StepBasic_ApplicationContext.hxx>
 #include <StepBasic_ConversionBasedUnit.hxx>
 #include <StepBasic_DocumentProductEquivalence.hxx>
@@ -93,6 +96,150 @@ Handle(StepData_StepModel) STEPControl_Reader::StepModel () const
   return Handle(StepData_StepModel)::DownCast(Model());
 }
 
+//=======================================================================
+//function : ReadFile
+//purpose  : 
+//=======================================================================
+IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filename)
+{
+  Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
+  Handle(Interface_Protocol) aProtocol = WS()->Protocol();
+  if (aLibrary.IsNull()) return IFSelect_RetVoid;
+  if (aProtocol.IsNull()) return IFSelect_RetVoid;
+  Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
+  aStepModel->InternalParameters.InitFromStatic();
+  aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
+  IFSelect_ReturnStatus status = IFSelect_RetVoid;
+  try {
+    OCC_CATCH_SIGNALS
+      Standard_Integer stat = aLibrary->ReadFile(filename, aStepModel, aProtocol);
+    if (stat == 0) status = IFSelect_RetDone;
+    else if (stat < 0) status = IFSelect_RetError;
+    else status = IFSelect_RetFail;
+  }
+  catch (Standard_Failure const& anException) {
+    Message_Messenger::StreamBuffer sout = Message::SendInfo();
+    sout << "    ****    Interruption ReadFile par Exception :   ****\n";
+    sout << anException.GetMessageString();
+    sout << "\n    Abandon" << std::endl;
+    status = IFSelect_RetFail;
+  }
+  if (status != IFSelect_RetDone) return status;
+  WS()->SetModel(aStepModel);
+  WS()->SetLoadedFile(filename);
+  WS()->InitTransferReader(4);
+  return status;
+}
+
+//=======================================================================
+//function : ReadFile
+//purpose  : 
+//=======================================================================
+IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filename,
+                                                   const StepData_ConfParameters& theParams)
+{
+  Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
+  Handle(Interface_Protocol) aProtocol = WS()->Protocol();
+  if (aLibrary.IsNull()) return IFSelect_RetVoid;
+  if (aProtocol.IsNull()) return IFSelect_RetVoid;
+  Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
+  aStepModel->InternalParameters = theParams;
+  aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
+  IFSelect_ReturnStatus status = IFSelect_RetVoid;
+  try {
+    OCC_CATCH_SIGNALS
+      Standard_Integer stat = aLibrary->ReadFile(filename, aStepModel, aProtocol);
+    if (stat == 0) status = IFSelect_RetDone;
+    else if (stat < 0) status = IFSelect_RetError;
+    else status = IFSelect_RetFail;
+  }
+  catch (Standard_Failure const& anException) {
+    Message_Messenger::StreamBuffer sout = Message::SendInfo();
+    sout << "    ****    Interruption ReadFile par Exception :   ****\n";
+    sout << anException.GetMessageString();
+    sout << "\n    Abandon" << std::endl;
+    status = IFSelect_RetFail;
+  }
+  if (status != IFSelect_RetDone) return status;
+  WS()->SetModel(aStepModel);
+  WS()->SetLoadedFile(filename);
+  WS()->InitTransferReader(4);
+  return status;
+}
+
+//=======================================================================
+//function : ReadStream
+//purpose  : 
+//=======================================================================
+IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString theName,
+                                                     std::istream& theIStream)
+{
+  Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
+  Handle(Interface_Protocol) aProtocol = WS()->Protocol();
+  if (aLibrary.IsNull()) return IFSelect_RetVoid;
+  if (aProtocol.IsNull()) return IFSelect_RetVoid;
+  Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
+  aStepModel->InternalParameters.InitFromStatic();
+  aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
+  IFSelect_ReturnStatus status = IFSelect_RetVoid;
+  try {
+    OCC_CATCH_SIGNALS
+      Standard_Integer stat = aLibrary->ReadStream(theName, theIStream, aStepModel, aProtocol);
+    if (stat == 0) status = IFSelect_RetDone;
+    else if (stat < 0) status = IFSelect_RetError;
+    else status = IFSelect_RetFail;
+  }
+  catch (Standard_Failure const& anException) {
+    Message_Messenger::StreamBuffer sout = Message::SendInfo();
+    sout << "    ****    Interruption ReadFile par Exception :   ****\n";
+    sout << anException.GetMessageString();
+    sout << "\n    Abandon" << std::endl;
+    status = IFSelect_RetFail;
+  }
+  if (status != IFSelect_RetDone) return status;
+  WS()->SetModel(aStepModel);
+  WS()->SetLoadedFile(theName);
+  WS()->InitTransferReader(4);
+  return status;
+}
+
+//=======================================================================
+//function : ReadStream
+//purpose  : 
+//=======================================================================
+IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString theName,
+                                                     const StepData_ConfParameters& theParams,
+                                                     std::istream& theIStream)
+{
+  Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
+  Handle(Interface_Protocol) aProtocol = WS()->Protocol();
+  if (aLibrary.IsNull()) return IFSelect_RetVoid;
+  if (aProtocol.IsNull()) return IFSelect_RetVoid;
+  Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
+  aStepModel->InternalParameters = theParams;
+  aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
+  IFSelect_ReturnStatus status = IFSelect_RetVoid;
+  try {
+    OCC_CATCH_SIGNALS
+      Standard_Integer stat = aLibrary->ReadStream(theName, theIStream, aStepModel, aProtocol);
+    if (stat == 0) status = IFSelect_RetDone;
+    else if (stat < 0) status = IFSelect_RetError;
+    else status = IFSelect_RetFail;
+  }
+  catch (Standard_Failure const& anException) {
+    Message_Messenger::StreamBuffer sout = Message::SendInfo();
+    sout << "    ****    Interruption ReadFile par Exception :   ****\n";
+    sout << anException.GetMessageString();
+    sout << "\n    Abandon" << std::endl;
+    status = IFSelect_RetFail;
+  }
+  if (status != IFSelect_RetDone) return status;
+  WS()->SetModel(aStepModel);
+  WS()->SetLoadedFile(theName);
+  WS()->InitTransferReader(4);
+  return status;
+}
+
 //=======================================================================
 //function : TransferRoot
 //purpose  : 
@@ -114,11 +261,12 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
   if (therootsta) return theroots.Length();
   therootsta = Standard_True;
 
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(WS()->Model());
   //theroots.Clear();
   Standard_Integer nb = Model()->NbEntities();
   for (Standard_Integer i = 1; i <= nb; i ++) {
     Handle(Standard_Transient) ent = Model()->Value(i);
-    if (Interface_Static::IVal("read.step.all.shapes") == 1) {
+    if (aStepModel->InternalParameters.ReadAllShapes == 1) {
       // Special case to read invalid shape_representation without links to shapes.
       if (ent->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
         Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent);
@@ -178,8 +326,9 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
       }
       // determinate roots used ProductDefinitionContext
       if(IsRoot) {
-        const char *str1 = Interface_Static::CVal("read.step.product.context");
-        Standard_Integer ICS = Interface_Static::IVal("read.step.product.context");
+        StepData_ConfParameters::ReadMode_ProductContext aProdContMode = aStepModel->InternalParameters.ReadProductContext;
+        TCollection_AsciiString str1 = aStepModel->InternalParameters.GetString(aProdContMode);
+        Standard_Integer ICS = aStepModel->InternalParameters.ReadProductContext;
         if(ICS>1) {
           subs = graph.Shareds(PD);
           for(subs.Start(); subs.More(); subs.Next()) {
@@ -188,7 +337,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
             if (PDC.IsNull()) continue;
             const char *str2 = PDC->LifeCycleStage()->String().ToCString();
             const char *str3 = PDC->Name()->String().ToCString();
-            if( !( strcasecmp(str1,str2)==0 || strcasecmp(str1,str3)==0 ) )
+            if( !( strcasecmp(str1.ToCString(),str2)==0 || strcasecmp(str1.ToCString(),str3) == 0))
               IsRoot=Standard_False;
           }
         }
@@ -212,8 +361,8 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
         WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent);
       }
     }
-    TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
-    if(!aProdMode.IsEqual("ON")) {
+    bool aProdMode = aStepModel->InternalParameters.ReadProductMode;
+    if(!aProdMode) {
       if(ent->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
         Standard_Boolean IsRoot = Standard_True;
         Handle(StepShape_ShapeDefinitionRepresentation) SDR =
@@ -440,6 +589,10 @@ void STEPControl_Reader::FileUnits( TColStd_SequenceOfAsciiString& theUnitLength
 //=======================================================================
 void STEPControl_Reader::SetSystemLengthUnit(const Standard_Real theLengthUnit)
 {
+  if (StepModel().IsNull())
+  {
+    return;
+  }
   StepModel()->SetLocalLengthUnit(theLengthUnit);
 }
 
@@ -449,6 +602,10 @@ void STEPControl_Reader::SetSystemLengthUnit(const Standard_Real theLengthUnit)
 //=======================================================================
 Standard_Real STEPControl_Reader::SystemLengthUnit() const
 {
+  if (StepModel().IsNull())
+  {
+    return 1.;
+  }
   return StepModel()->LocalLengthUnit();
 }
 
index 5973caa5176c4e4ccfd460f433070599827bce04..86550b9737b2ba611cb6473baa3c01b889ba4a91 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <XSControl_Reader.hxx>
 #include <Standard_Integer.hxx>
+#include <StepData_ConfParameters.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_Array1OfAsciiString.hxx>
 #include <TColStd_Array1OfReal.hxx>
@@ -83,6 +84,24 @@ public:
   //! Returns the model as a StepModel.
   //! It can then be consulted (header, product)
   Standard_EXPORT Handle(StepData_StepModel) StepModel() const;
+
+  //! Loads a file and returns the read status
+  //! Zero for a Model which compies with the Controller
+  Standard_EXPORT virtual IFSelect_ReturnStatus ReadFile(const Standard_CString filename) Standard_OVERRIDE;
+
+  //! Loads a file from stream and returns the read status
+  Standard_EXPORT virtual IFSelect_ReturnStatus ReadStream(const Standard_CString theName,
+                                                           std::istream& theIStream) Standard_OVERRIDE;
+
+  //! 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);
+
+  //! Loads a file from stream and returns the read status
+  Standard_EXPORT IFSelect_ReturnStatus ReadStream(const Standard_CString theName,
+                                                   const StepData_ConfParameters& theParams,
+                                                   std::istream& theIStream);
   
   //! Transfers a root given its rank in the list of candidate roots
   //! Default is the first one
@@ -99,10 +118,12 @@ public:
   //! found in file
   Standard_EXPORT void FileUnits (TColStd_SequenceOfAsciiString& theUnitLengthNames, TColStd_SequenceOfAsciiString& theUnitAngleNames, TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
 
-  //! Sets system length unit used by transfer process
+  //! Sets system length unit used by transfer process.
+  //! Performs only if a model is not NULL
   Standard_EXPORT void SetSystemLengthUnit(const Standard_Real theLengthUnit);
 
-  //! Returns system length unit used by transfer process
+  //! Returns system length unit used by transfer process.
+  //! Performs only if a model is not NULL
   Standard_EXPORT Standard_Real SystemLengthUnit() const;
 
 
index 96756267ecef40b98ea084f916dbcd9ea9fb88c3..e16cb584c3429481cbf9b09e64f0dec3f87d9d62 100644 (file)
@@ -17,6 +17,7 @@
 #include <Interface_Macros.hxx>
 #include <STEPControl_ActorWrite.hxx>
 #include <STEPControl_Controller.hxx>
+#include <StepData_ConfParameters.hxx>
 #include <StepData_StepModel.hxx>
 #include <StepData_Protocol.hxx>
 #include <StepData_StepWriter.hxx>
@@ -127,6 +128,21 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
    const STEPControl_StepModelType mode,
    const Standard_Boolean compgraph,
    const Message_ProgressRange& theProgress)
+{
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(thesession->Model());
+  if (!aStepModel.IsNull())
+  {
+    aStepModel->InternalParameters.InitFromStatic();
+  }
+  return Transfer(sh, mode, aStepModel->InternalParameters, compgraph, theProgress);
+}
+
+IFSelect_ReturnStatus STEPControl_Writer::Transfer
+  (const TopoDS_Shape& sh,
+  const STEPControl_StepModelType mode,
+  const StepData_ConfParameters& theParams,
+  const Standard_Boolean compgraph,
+  const Message_ProgressRange& theProgress)
 {
   Standard_Integer mws = -1;
   switch (mode) {
@@ -144,6 +160,13 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
     XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
     Model()->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
   }
+  if (!thesession->Model().IsNull())
+  {
+    Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters = theParams;
+  }
+  Handle(STEPControl_ActorWrite) ActWrite =
+    Handle(STEPControl_ActorWrite)::DownCast(WS()->NormAdaptor()->ActorWrite());
+  ActWrite->SetGroupMode(Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters.WriteAssembly);
   return thesession->TransferWriteShape(sh, compgraph, theProgress);
 }
 
index d179c0f7222b418cd9fdeaeed9cb7134ee23f2f8..312a6fb0fc83bb0b9b930636cf62efa9ea9b1b66 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <Standard_Real.hxx>
 #include <IFSelect_ReturnStatus.hxx>
+#include <StepData_ConfParameters.hxx>
 #include <STEPControl_StepModelType.hxx>
 #include <Standard_Integer.hxx>
 #include <Message_ProgressRange.hxx>
@@ -89,6 +90,14 @@ public:
                     const Standard_Boolean compgraph = Standard_True,
                     const Message_ProgressRange& theProgress = Message_ProgressRange());
 
+  //! Translates shape sh to a STEP entity
+  Standard_EXPORT IFSelect_ReturnStatus Transfer
+                   (const TopoDS_Shape& sh,
+                    const STEPControl_StepModelType mode,
+                    const StepData_ConfParameters& theParams,
+                    const Standard_Boolean compgraph = Standard_True,
+                    const Message_ProgressRange& theProgress = Message_ProgressRange());
+
   //! Writes a STEP model in the file identified by filename.
   Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString theFileName);
 
index 65edda095b4903513c577b64e240f07d0f21748d..f1de2437c0ac1e3f82b191d90681bd7f09f08b32 100644 (file)
@@ -1,6 +1,8 @@
 StepData.cxx
 StepData.hxx
 StepData_Array1OfField.hxx
+StepData_ConfParameters.cxx
+StepData_ConfParameters.hxx
 StepData_DefaultGeneral.cxx
 StepData_DefaultGeneral.hxx
 StepData_Described.cxx
diff --git a/src/StepData/StepData_ConfParameters.cxx b/src/StepData/StepData_ConfParameters.cxx
new file mode 100644 (file)
index 0000000..d3416d2
--- /dev/null
@@ -0,0 +1,90 @@
+// 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 <Interface_Static.hxx>
+
+#include <StepData_ConfParameters.hxx>
+
+//=======================================================================
+// 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;
+
+  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
new file mode 100644 (file)
index 0000000..1acee3d
--- /dev/null
@@ -0,0 +1,191 @@
+// 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 _StepData_ConfParameters_HeaderFile
+#define _StepData_ConfParameters_HeaderFile
+
+#include <Resource_FormatType.hxx>
+#include <STEPControl_StepModelType.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <UnitsMethods_LengthUnit.hxx>
+
+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
+  ReadMode_BSplineContinuity ReadBSplineContinuity = ReadMode_BSplineContinuity_C1; //<! Manages the continuity of BSpline curves
+  ReadMode_Precision ReadPrecisionMode = ReadMode_Precision_File; //<! Reads the precision mode value
+  double ReadPrecisionVal = 0.0001; //<! ReadMode_Precision for shape construction (if enabled user mode)
+  ReadMode_MaxPrecision ReadMaxPrecisionMode = ReadMode_MaxPrecision_Preferred; //<! Defines the mode of applying the maximum allowed tolerance
+  double ReadMaxPrecisionVal = 1; //<! Defines the maximum allowable tolerance
+  bool ReadSameParamMode = false; //<! Defines the using of BRepLib::SameParameter
+  ReadMode_SurfaceCurve ReadSurfaceCurveMode = ReadMode_SurfaceCurve_Default; //<! Reference for the computation of curves in case of 2D/3D
+  double EncodeRegAngle = 0.57295779513; //<! Continuity which these two faces are connected with at that edge
+  AngleUnitMode AngleUnit = AngleUnitMode_File; //<! Indicates what angle units should be used when a STEP file is read
+
+  // Read
+  TCollection_AsciiString ReadResourceName = "STEP"; //<! Defines the name of the resource file to read
+  TCollection_AsciiString ReadSequence = "FromSTEP"; //<! Defines the name of the sequence of operators to read
+  bool ReadProductMode = true; //<! Defines the approach used for selection of top-level STEP entities for translation, and for recognition of assembly structures
+  ReadMode_ProductContext ReadProductContext = ReadMode_ProductContext_All; //<! When reading AP 209 STEP files, allows selecting either only 'design' or 'analysis', or both types of products for translation
+  ReadMode_ShapeRepr ReadShapeRepr = ReadMode_ShapeRepr_All; //<! Specifies preferred type of representation of the shape of the product
+  RWMode_Tessellated ReadTessellated = RWMode_Tessellated_On; //!< Defines whether tessellated shapes should be translated
+  ReadMode_AssemblyLevel ReadAssemblyLevel = ReadMode_AssemblyLevel_All; //<! Specifies which data should be read for the products found in the STEP file
+  bool ReadRelationship = true; //<! Defines whether shapes associated with the main SHAPE_DEFINITION_REPRESENTATION entity of the product via SHAPE_REPRESENTATIONSHIP_RELATION should be translated
+  bool ReadShapeAspect = true; //<! Defines whether shapes associated with the PRODUCT_DEFINITION_SHAPE entity of the product via SHAPE_ASPECT should be translated
+  bool ReadConstrRelation = false; //<! Flag regulating translation of "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP" entities
+  bool ReadSubshapeNames = false; //<! Indicates whether to read sub-shape names from 'Name' attributes of STEP Representation Items
+  Resource_FormatType ReadCodePage = Resource_FormatType_UTF8; //<! STEP file encoding for names translation
+  bool ReadNonmanifold = false; //<! Defines non-manifold topology reading
+  bool ReadIdeas = false; //<! Defines !I-Deas-like STEP processing
+  bool ReadAllShapes = false; //<! Parameter to read all top level solids and shells
+  bool ReadRootTransformation = true; ///<!/ Mode to variate apply or not transformation placed in the root shape representation
+  bool ReadColor = true; //<! ColorMode is used to indicate read Colors or not
+  bool ReadName = true; //<! NameMode is used to indicate read Name or not
+  bool ReadLayer = true; //<! LayerMode is used to indicate read Layers or not
+  bool ReadProps = true; //<! PropsMode is used to indicate read Validation properties or not
+  
+  // Write
+  WriteMode_PrecisionMode WritePrecisionMode = WriteMode_PrecisionMode_Average; //<! Specifies the mode of writing the resolution value into the STEP file
+  double WritePrecisionVal = 0.0001; //<! Resolution value for an STEP file when WriteMode_PrecisionMode is Greatest
+  WriteMode_Assembly WriteAssembly = WriteMode_Assembly_Off; //<! Writing assembly mode
+  WriteMode_StepSchema WriteSchema = WriteMode_StepSchema_AP214CD; //<! Defines the version of schema used for the output STEP file
+  RWMode_Tessellated WriteTessellated = RWMode_Tessellated_OnNoBRep; //!< Defines whether tessellated shapes should be translated
+  TCollection_AsciiString WriteProductName; //<! Defines the text string that will be used for field 'name' of PRODUCT entities written to the STEP file
+  bool WriteSurfaceCurMode = true; //<! Indicates whether parametric curves (curves in parametric space of surface) should be written into the STEP file
+  UnitsMethods_LengthUnit WriteUnit = UnitsMethods_LengthUnit_Millimeter; //<! Defines a unit in which the STEP file should be written
+  TCollection_AsciiString WriteResourceName = "STEP"; //<! Defines the name of the resource file to write
+  TCollection_AsciiString WriteSequence = "ToSTEP"; //<! Defines the name of the sequence of operators to write
+  WriteMode_VertexMode WriteVertexMode = WriteMode_VertexMode_OneCompound; //<! Indicates which of free vertices writing mode is switch on
+  bool WriteSubshapeNames = false; //<! Indicates whether to write sub-shape names to 'Name' attributes of STEP Representation Items
+  bool WriteColor = true; //<! ColorMode is used to indicate write Colors or not
+  bool WriteNonmanifold = false; //<! Defines non-manifold topology writting
+  bool WriteName = true; //<! NameMode is used to indicate write Name or not
+  bool WriteLayer = true; //<! LayerMode is used to indicate write Layers or not
+  bool WriteProps = true; //<! PropsMode is used to indicate write Validation properties or not
+  STEPControl_StepModelType WriteModelType = STEPControl_AsIs; //<! Gives you the choice of translation mode for an Open CASCADE shape that is being translated to STEP
+};
+
+#endif // _StepData_ConfParameters_HeaderFile
index 7a392dfce99003b512b53df956700313e025e816..d85a128dd65af3341ba6e260357d19d18bd03dad 100644 (file)
 IMPLEMENT_STANDARD_RTTIEXT(StepData_StepModel,Interface_InterfaceModel)
 
 // Entete de fichier : liste d entites
-StepData_StepModel::StepData_StepModel () :mySourceCodePage((Resource_FormatType)Interface_Static::IVal("read.step.codepage")),
+StepData_StepModel::StepData_StepModel () :
   myReadUnitIsInitialized(Standard_False), myWriteUnit (1.)
 {
-  switch (Interface_Static::IVal("write.step.unit"))
+  switch (InternalParameters.WriteUnit)
   {
     case  1: myWriteUnit = 25.4; break;
     case  2: myWriteUnit = 1.; break;
index 8c1dc28ac5744f00f06cb1eeb9e006ec67bed64f..cdf100812e5bf0e1ab2055f05931d93fef3d196b 100644 (file)
@@ -22,6 +22,7 @@
 #include <Interface_InterfaceModel.hxx>
 #include <Resource_FormatType.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_ConfParameters.hxx>
 
 class Standard_Transient;
 class Interface_EntityIterator;
@@ -99,10 +100,10 @@ public:
 
   //! Return the encoding of STEP file for converting names into UNICODE.
   //! Initialized from "read.step.codepage" variable by constructor, which is Resource_UTF8 by default.
-  Resource_FormatType SourceCodePage() const { return mySourceCodePage; }
+  Resource_FormatType SourceCodePage() const { return InternalParameters.ReadCodePage; }
 
   //! Return the encoding of STEP file for converting names into UNICODE.
-  void SetSourceCodePage (Resource_FormatType theCode) { mySourceCodePage = theCode; }
+  void SetSourceCodePage (Resource_FormatType theCode) { InternalParameters.ReadCodePage = theCode; }
 
   //! Sets local length unit using for transfer process
   Standard_EXPORT void SetLocalLengthUnit(const Standard_Real theUnit);
@@ -121,6 +122,10 @@ public:
   //! False - the unit value was not initialized, the default value is used
   Standard_Boolean IsInitializedUnit() const { return myReadUnitIsInitialized; }
 
+public:
+
+  StepData_ConfParameters InternalParameters;
+
   DEFINE_STANDARD_RTTIEXT(StepData_StepModel,Interface_InterfaceModel)
 
 protected:
@@ -133,7 +138,6 @@ private:
 
   Interface_EntityList theheader;
   Handle(TColStd_HArray1OfInteger) theidnums;
-  Resource_FormatType mySourceCodePage;
   Standard_Boolean myReadUnitIsInitialized;
   Standard_Real myWriteUnit;
   Standard_Real myLocalLengthUnit;
index a154c7dee96ae5fc565b4d71f46a1895117c620e..777ac6bf9adec52a9a4d9b722bc1299d2ee8cd3d 100644 (file)
@@ -60,9 +60,7 @@ Standard_Integer  StepSelect_WorkLibrary::ReadFile
 {
   DeclareAndCast(StepData_Protocol,stepro,protocol);
   if (stepro.IsNull()) return 1;
-  Handle(StepData_StepModel) stepmodel  = new StepData_StepModel;
-  model  = stepmodel;
-  Standard_Integer aStatus = StepFile_Read(name, 0, stepmodel, stepro);
+  Standard_Integer aStatus = StepFile_Read(name, 0, Handle(StepData_StepModel)::DownCast(model), stepro);
   return aStatus;
 }
 
@@ -73,9 +71,7 @@ Standard_Integer  StepSelect_WorkLibrary::ReadStream (const Standard_CString the
 {
   DeclareAndCast(StepData_Protocol, stepro, protocol);
   if (stepro.IsNull()) return 1;
-  Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
-  model = stepmodel;
-  Standard_Integer aStatus = StepFile_Read(theName, &theIStream, stepmodel, stepro);
+  Standard_Integer aStatus = StepFile_Read(theName, &theIStream, Handle(StepData_StepModel)::DownCast(model), stepro);
   return aStatus;
 }
 
index 9d1db3d618016aa8914bdd255fe724ddddd7f50d..aabf96b097258adb2121e55d78236fec494e6434 100644 (file)
@@ -39,6 +39,7 @@
 #include <StdFail_NotDone.hxx>
 #include <STEPControl_ActorRead.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_CompositeCurve.hxx>
 #include <StepGeom_Curve.hxx>
 #include <StepGeom_CurveBoundedSurface.hxx>
 #include <TransferBRep.hxx>
 
 #include <stdio.h>
-static void ResetPreci (const TopoDS_Shape& S, Standard_Real maxtol)
+static void ResetPreci (Handle(StepData_StepModel)& theStepModel,
+                        const TopoDS_Shape& S, Standard_Real maxtol)
 {
   //:S4136
-  Standard_Integer modetol = Interface_Static::IVal("read.maxprecision.mode");
+  Standard_Integer modetol = theStepModel->InternalParameters.ReadMaxPrecisionMode;
   if (modetol) {
     ShapeFix_ShapeTolerance STU;
     STU.LimitTolerance (S,Precision::Confusion(),maxtol);
@@ -120,6 +122,7 @@ void StepToTopoDS_Builder::Init(const Handle(StepShape_ManifoldSolidBrep)& theMa
                                 const Message_ProgressRange& theProgress)
 {
   Message_Messenger::StreamBuffer sout = theTP->Messenger()->SendInfo();
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(theTP->Model());
   // Initialisation of the Tool
 
   StepToTopoDS_Tool         aTool;
@@ -168,7 +171,7 @@ void StepToTopoDS_Builder::Init(const Handle(StepShape_ManifoldSolidBrep)& theMa
     sout << "                        - C2 : " << aTool.C2Cur2() << std::endl;
   }
 
-  ResetPreci (aSolid, MaxTol());
+  ResetPreci (aStepModel, aSolid, MaxTol());
 }
 
 // ============================================================================
@@ -258,7 +261,9 @@ void StepToTopoDS_Builder::Init(const Handle(StepShape_BrepWithVoids)& theBRepWi
     sout << "                        - C2 : " << aTool.C2Cur2() << std::endl;
   }
 
-  ResetPreci (aSolid, MaxTol());
+//:S4136  ShapeFix::SameParameter (S,Standard_False);
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(theTP->Model());
+  ResetPreci (aStepModel, aSolid, MaxTol());
 }
 
 // ============================================================================
@@ -460,8 +465,9 @@ void StepToTopoDS_Builder::Init
   }
 
 //:S4136  ShapeFix::SameParameter (S,Standard_False);
-  ResetPreci (S, MaxTol());
-  ResetPreci (Shl, MaxTol()); //skl
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
+  ResetPreci (aStepModel, S, MaxTol());
+  ResetPreci (aStepModel, Shl, MaxTol()); //skl
 }
 
 // ============================================================================
@@ -522,7 +528,8 @@ void StepToTopoDS_Builder::Init (const Handle(StepShape_EdgeBasedWireframeModel)
   myError  = ( myResult.IsNull() ? StepToTopoDS_BuilderDone : StepToTopoDS_BuilderOther );
   done     = ! myResult.IsNull();
 
-  ResetPreci (myResult, MaxTol());
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
+  ResetPreci (aStepModel, myResult, MaxTol());
 }
 
 // ============================================================================
@@ -585,7 +592,8 @@ void StepToTopoDS_Builder::Init (const Handle(StepShape_FaceBasedSurfaceModel)&
   myError  = ( myResult.IsNull() ? StepToTopoDS_BuilderDone : StepToTopoDS_BuilderOther );
   done     = ! myResult.IsNull();
 
-  ResetPreci (myResult, MaxTol());
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
+  ResetPreci (aStepModel, myResult, MaxTol());
 }
 
 
index cf44ab9f5a640e1078190be1dc4b0604fa697664..f0a3dfb2e15b5b09d26339cdf67380b959f23301 100644 (file)
@@ -111,8 +111,10 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
   Standard_Boolean SurfMode = ( ! S.IsNull() && ! Surf.IsNull() );
   Standard_Boolean isClosed = Standard_False;
 
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
+
   if ( SurfMode ) {
-    Standard_Integer modepcurve = Interface_Static::IVal("read.surfacecurve.mode");
+    Standard_Integer modepcurve = aStepModel->InternalParameters.ReadSurfaceCurveMode;
     if ( modepcurve ==-3 ) SurfMode = Standard_False;
   }
   
index 66c12dc8954d6a82c139941d17581bae7c85ed3c..e9d5c4784393d13ffcf7db56ff51059d71b2405a 100644 (file)
@@ -44,6 +44,7 @@
 #include <ShapeFix_EdgeProjAux.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_Pcurve.hxx>
 #include <StepGeom_Surface.hxx>
 #include <StepGeom_SurfaceCurve.hxx>
@@ -217,11 +218,12 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
     done     = Standard_True;
     return;
   }
-  Standard_Integer modepcurve = Interface_Static::IVal("read.surfacecurve.mode");
-  //  0,1 : suivre le code,  2 : ne prendre que pcurve,  3 : ne prendre que C3D
 
   BRep_Builder B;
   Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
+  Standard_Integer modepcurve = aStepModel->InternalParameters.ReadSurfaceCurveMode;
+  //  0,1 : suivre le code,  2 : ne prendre que pcurve,  3 : ne prendre que C3D
 
   Standard_Real preci = Precision();
   TopoDS_Wire   W;
index cb4ae8c235ddae4d367c40e2aca73acaecee9996..b9d1a243272f18343ca608f788b830c2491047d1 100644 (file)
@@ -21,6 +21,7 @@
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_BrepWithVoids.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_HArray1OfOrientedClosedShell.hxx>
@@ -71,7 +72,8 @@ TopoDSToStep_MakeBrepWithVoids::
   Handle(StepShape_HArray1OfOrientedClosedShell)  aVoids;
   TColStd_SequenceOfTransient                     aTessShells;
 
-  const Standard_Integer aWriteTessGeom = Interface_Static::IVal("write.step.tessellated");
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  const Standard_Integer aWriteTessGeom = aStepModel->InternalParameters.WriteTessellated;
 
   try 
   {
@@ -83,7 +85,7 @@ TopoDSToStep_MakeBrepWithVoids::
   }
 
   TopoDSToStep_Builder StepB;
-  TopoDSToStep_Tool    aTool;
+  TopoDSToStep_Tool    aTool(aStepModel);
 
   Standard_Integer nbshapes = 0;
   for (It.Initialize(aSolid); It.More(); It.Next())
@@ -99,7 +101,7 @@ TopoDSToStep_MakeBrepWithVoids::
         CurrentShell.Reverse();
       //:d7 abv 16 Mar 98: try to treat 'open' shells as closed since flag 
       // IsClosed() is often incorrect (taken from MakeManifoldSolid(Solid))
-      aTool.Init(aMap, Standard_False);
+      aTool.Init(aMap, Standard_False, aStepModel->InternalParameters.WriteSurfaceCurMode);
       StepB.Init(CurrentShell, aTool, FP, aWriteTessGeom, theLocalFactors, aPS.Next());
       TopoDSToStep::AddResult(FP, aTool);
       if (StepB.IsDone()) 
index a068be1546dcc484001f0e8e4def021ed27c1c27..6add10078b366450da9f56505693ca382314d2a9 100644 (file)
@@ -20,6 +20,7 @@
 #include <Message_ProgressScope.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_FacetedBrep.hxx>
 #include <StepShape_TopologicalRepresentationItem.hxx>
@@ -48,10 +49,10 @@ TopoDSToStep_MakeFacetedBrep::
   if (aShell.Closed()) {
     Handle(StepShape_TopologicalRepresentationItem) aItem;
     MoniTool_DataMapOfShapeTransient aMap;
+    Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+    const Standard_Integer aWriteTessGeom = aStepModel->InternalParameters.WriteTessellated;
 
-    const Standard_Integer aWriteTessGeom = Interface_Static::IVal("write.step.tessellated");
-
-    TopoDSToStep_Tool    aTool(aMap, Standard_True);
+    TopoDSToStep_Tool    aTool(aMap, Standard_True, aStepModel->InternalParameters.WriteSurfaceCurMode);
     TopoDSToStep_Builder StepB(aShell, aTool, FP, aWriteTessGeom, theLocalFactors, theProgress);
     if (theProgress.UserBreak())
       return;
@@ -103,10 +104,10 @@ TopoDSToStep_MakeFacetedBrep::
     if (aOuterShell.Closed()) {
       Handle(StepShape_TopologicalRepresentationItem) aItem;
       MoniTool_DataMapOfShapeTransient aMap;
+      Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+      const Standard_Integer aWriteTessGeom = aStepModel->InternalParameters.WriteTessellated;
 
-      const Standard_Integer aWriteTessGeom = Interface_Static::IVal("write.step.tessellated");
-
-      TopoDSToStep_Tool    aTool(aMap, Standard_True);
+      TopoDSToStep_Tool    aTool(aMap, Standard_True, aStepModel->InternalParameters.WriteSurfaceCurMode);
       TopoDSToStep_Builder StepB(aOuterShell, aTool, FP, aWriteTessGeom, theLocalFactors, theProgress);
       if (theProgress.UserBreak())
         return;
index 837fb8e73216ec38035b1b345364a7d8af03d195..25124d93c427248b1ac5aaf05a0af204780f5298 100644 (file)
@@ -20,6 +20,7 @@
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
 #include <StepShape_HArray1OfOrientedClosedShell.hxx>
@@ -65,8 +66,9 @@ TopoDSToStep_MakeFacetedBrepAndBrepWithVoids::
 
   aOutShell = BRepClass3d::OuterShell(aSolid);
 
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
   TopoDSToStep_Builder StepB;
-  TopoDSToStep_Tool    aTool;
+  TopoDSToStep_Tool    aTool(aStepModel);
 
   if (!aOutShell.IsNull()) {
     Standard_Integer nbshapes = 0;
@@ -81,7 +83,7 @@ TopoDSToStep_MakeFacetedBrepAndBrepWithVoids::
         TopoDS_Shell CurrentShell = TopoDS::Shell(It.Value());
         if (It.Value().Closed()) {
 
-          aTool.Init(aMap, Standard_False);
+          aTool.Init(aMap, Standard_False, aStepModel->InternalParameters.WriteSurfaceCurMode);
           StepB.Init(CurrentShell, aTool, FP, Standard_False, theLocalFactors, aRange);
           TopoDSToStep::AddResult(FP, aTool);
 
index dd4a7f5b6c12d77a0c974f7dff42627da6a6da1d..cc33b4b851e9ee05b874b2ad64916b9c042a3640 100644 (file)
@@ -18,6 +18,7 @@
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_GeometricCurveSet.hxx>
 #include <StepShape_GeometricSetSelect.hxx>
 #include <StepShape_HArray1OfGeometricSetSelect.hxx>
@@ -39,7 +40,8 @@ TopoDSToStep_MakeGeometricCurveSet::TopoDSToStep_MakeGeometricCurveSet(
   done = Standard_False;
   Handle(TColStd_HSequenceOfTransient)  itemList;
   MoniTool_DataMapOfShapeTransient      aMap;
-  TopoDSToStep_Tool                aTool (aMap, Standard_False);
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  TopoDSToStep_Tool                aTool (aMap, Standard_False, aStepModel->InternalParameters.WriteSurfaceCurMode);
   TopoDSToStep_WireframeBuilder    wirefB (aShape, aTool, theLocalFactors);
   TopoDSToStep::AddResult ( FP, aTool );
 
index 7a932e38a6fc0ed2405cf6bccacd8e5b02e206de..4c4604a05e2f40c38b88b53e013b51c048eed102 100644 (file)
@@ -20,6 +20,7 @@
 #include <Message_ProgressScope.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_HArray1OfFace.hxx>
 #include <StepShape_ManifoldSolidBrep.hxx>
@@ -46,9 +47,9 @@ MakeManifoldSolidBrep(const TopoDS_Shell& aShell,
   Handle(StepVisual_TessellatedItem) aTessItem;
 
   MoniTool_DataMapOfShapeTransient aMap;
-  TopoDSToStep_Tool aTool(aMap, Standard_False);
-
-  const Standard_Integer aWriteTessGeom = Interface_Static::IVal("write.step.tessellated");
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  TopoDSToStep_Tool aTool(aMap, Standard_False, aStepModel->InternalParameters.WriteSurfaceCurMode);
+  const Standard_Integer aWriteTessGeom = aStepModel->InternalParameters.WriteTessellated;
 
   TopoDSToStep_Builder StepB(aShell, aTool, FP, aWriteTessGeom, theLocalFactors, theProgress);
   if (theProgress.UserBreak())
index 1987fc52a62114a57d0809997bc758aca5b17820..be09e594884ae42a7491ee4f5e3a1bd0a6995ac4 100644 (file)
@@ -20,6 +20,7 @@
 #include <Message_ProgressScope.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_ConnectedFaceSet.hxx>
 #include <StepShape_FaceSurface.hxx>
@@ -58,8 +59,9 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
   done = Standard_False;
   MoniTool_DataMapOfShapeTransient aMap;
 
-  Standard_Integer aWriteTessGeom = Interface_Static::IVal("write.step.tessellated");
-  const Standard_Integer aWriteTessSchema = Interface_Static::IVal("write.step.schema");
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  Standard_Integer aWriteTessGeom = aStepModel->InternalParameters.WriteTessellated;
+  const Standard_Integer aWriteTessSchema = aStepModel->InternalParameters.WriteSchema;
   if (aWriteTessSchema != 5)
   {
     aWriteTessGeom = 0;
@@ -68,7 +70,7 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
     FP->AddWarning(anErrShape, " Tessellation can not be exported into not AP242");
   }
 
-  TopoDSToStep_Tool    aTool(aMap, Standard_False);
+  TopoDSToStep_Tool    aTool(aMap, Standard_False, aStepModel->InternalParameters.WriteSurfaceCurMode);
   TopoDSToStep_Builder StepB(aFace, aTool, FP, aWriteTessGeom, theLocalFactors, theProgress);
   if (theProgress.UserBreak())
     return;
@@ -125,8 +127,9 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
   Handle(StepShape_ClosedShell)                   aClosedShell;
   MoniTool_DataMapOfShapeTransient                aMap;
 
-  Standard_Integer aWriteTessGeom = Interface_Static::IVal("write.step.tessellated");
-  const Standard_Integer aWriteTessSchema = Interface_Static::IVal("write.step.schema");
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  Standard_Integer aWriteTessGeom = aStepModel->InternalParameters.WriteTessellated;
+  const Standard_Integer aWriteTessSchema = aStepModel->InternalParameters.WriteSchema;
   if (aWriteTessSchema != 5)
   {
     aWriteTessGeom = 0;
@@ -135,7 +138,7 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
     FP->AddWarning(anErrShape, " Tessellation can not be exported into not AP242");
   }
 
-  TopoDSToStep_Tool    aTool(aMap, Standard_False);
+  TopoDSToStep_Tool    aTool(aMap, Standard_False, aStepModel->InternalParameters.WriteSurfaceCurMode);
   TopoDSToStep_Builder StepB(aShell, aTool, FP, aWriteTessGeom, theLocalFactors, theProgress);
   if (theProgress.UserBreak())
     return;
@@ -193,8 +196,9 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
   TColStd_SequenceOfTransient      S;
   TColStd_SequenceOfTransient      aTessShells;
 
-  Standard_Integer aWriteTessGeom = Interface_Static::IVal("write.step.tessellated");
-  const Standard_Integer aWriteTessSchema = Interface_Static::IVal("write.step.schema");
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  Standard_Integer aWriteTessGeom = aStepModel->InternalParameters.WriteTessellated;
+  const Standard_Integer aWriteTessSchema = aStepModel->InternalParameters.WriteSchema;
   if (aWriteTessSchema != 5)
   {
     aWriteTessGeom = 0;
@@ -213,7 +217,7 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
     if (It.Value().ShapeType() == TopAbs_SHELL) {
       aShell = TopoDS::Shell(It.Value());
 
-      TopoDSToStep_Tool    aTool(aMap, Standard_False);
+      TopoDSToStep_Tool    aTool(aMap, Standard_False, aStepModel->InternalParameters.WriteSurfaceCurMode);
       TopoDSToStep_Builder StepB(aShell, aTool, FP, aWriteTessGeom, theLocalFactors, aPS.Next());
       TopoDSToStep::AddResult ( FP, aTool );
 
index d133dce90b4beef9124eaf7793997daf85c7366c..dcf86c2ddb73699e26e44f4aa37c87402b461f06 100644 (file)
@@ -30,6 +30,7 @@
 #include <Interface_Static.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepData_Factors.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_Line.hxx>
 #include <StepGeom_SeamCurve.hxx>
 #include <StepGeom_SurfaceCurve.hxx>
@@ -90,7 +91,8 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
   aTool.SetCurrentEdge(aEdge);
 
   // [BEGIN] Processing non-manifold topology (ssv; 11.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode =
+    Handle(StepData_StepModel)::DownCast(FP->Model())->InternalParameters.WriteNonmanifold != 0;
   if (isNMMode) {
     Handle(StepShape_EdgeCurve) anEC;
     Handle(TransferBRep_ShapeMapper) aSTEPMapper = TransferBRep::ShapeMapper(FP, aEdge);
index a85b26016d2fa409d71b5fb09de49fbdca79078e..42fd2a9b90cb19c570aa9a87453bbaf20b1a2e93 100644 (file)
@@ -116,7 +116,8 @@ void TopoDSToStep_MakeStepFace::Init(const TopoDS_Face& aFace,
     new TransferBRep_ShapeMapper(aFace);  // on ne sait jamais
 
   // [BEGIN] Processing non-manifold topology (another approach) (ssv; 10.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode =
+    Handle(StepData_StepModel)::DownCast(FP->Model())->InternalParameters.WriteNonmanifold != 0;
   if (isNMMode) {
     Handle(StepShape_AdvancedFace) anAF;
     Handle(TransferBRep_ShapeMapper) aSTEPMapper = TransferBRep::ShapeMapper(FP, aFace);
index 95fb9561de3b403377fa881217c0434d214cba25..20531b118d01d8f69b6f10792e7a568d4c93067a 100644 (file)
@@ -64,7 +64,8 @@ void TopoDSToStep_MakeStepVertex::Init(const TopoDS_Vertex& aVertex,
   aTool.SetCurrentVertex(aVertex);
 
   // [BEGIN] Processing non-manifold topology (ssv; 11.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode =
+    Handle(StepData_StepModel)::DownCast(FP->Model())->InternalParameters.WriteNonmanifold != 0;
   if (isNMMode) {
     Handle(StepShape_VertexPoint) aVP;
     Handle(TransferBRep_ShapeMapper) aSTEPMapper = TransferBRep::ShapeMapper(FP, aVertex);
index 864b6bc9bf9e627ceaaec921648fb9aff93b87f2..f9cf2b620ec1480d1cac508dd3e49298ddd6f4be 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <BRep_Tool.hxx>
 #include <Interface_Static.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_TopologicalRepresentationItem.hxx>
 #include <TopoDSToStep_Tool.hxx>
 
 //function : TopoDSToStep_Tool
 //purpose  : 
 //=======================================================================
-TopoDSToStep_Tool::TopoDSToStep_Tool()
-     : myFacetedContext(Standard_False), myLowestTol(0.),myReversedSurface (Standard_False)
+TopoDSToStep_Tool::TopoDSToStep_Tool(const Handle(StepData_StepModel)& theModel)
+  : myFacetedContext(Standard_False),
+  myLowestTol(0.),
+  myReversedSurface(Standard_False)
 {
-  myPCurveMode = Interface_Static::IVal("write.surfacecurve.mode");
+  myPCurveMode = theModel->InternalParameters.WriteSurfaceCurMode;
 }
 
 //=======================================================================
@@ -35,10 +38,12 @@ TopoDSToStep_Tool::TopoDSToStep_Tool()
 //purpose  : 
 //=======================================================================
 
-TopoDSToStep_Tool::TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext)
+TopoDSToStep_Tool::TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M,
+                                     const Standard_Boolean FacetedContext,
+                                     Standard_Integer theSurfCurveMode)
      :myLowestTol(0.),myReversedSurface(Standard_False)
 {
-  Init ( M, FacetedContext );
+  Init ( M, FacetedContext, theSurfCurveMode );
 }
 
 //=======================================================================
@@ -46,11 +51,13 @@ TopoDSToStep_Tool::TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M,
 //purpose  : 
 //=======================================================================
 
-void TopoDSToStep_Tool::Init(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext)
+void TopoDSToStep_Tool::Init(const MoniTool_DataMapOfShapeTransient& M,
+                             const Standard_Boolean FacetedContext,
+                             Standard_Integer theSurfCurveMode)
 {
   myDataMap = M;
   myFacetedContext = FacetedContext;
-  myPCurveMode = Interface_Static::IVal("write.surfacecurve.mode");
+  myPCurveMode = theSurfCurveMode;
 }
 
 //=======================================================================
index 11d0e85c2d4ef93143fbd4a9ed6dad9e6abef39a..d48991505d4a6f06e73fd69a971bcf65a24ea765 100644 (file)
@@ -28,6 +28,7 @@
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <Standard_Integer.hxx>
+class StepData_StepModel;
 class TopoDS_Shape;
 class StepShape_TopologicalRepresentationItem;
 
@@ -41,11 +42,15 @@ public:
   DEFINE_STANDARD_ALLOC
 
   
-  Standard_EXPORT TopoDSToStep_Tool();
+  Standard_EXPORT TopoDSToStep_Tool(const Handle(StepData_StepModel)& theModel);
   
-  Standard_EXPORT TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext);
+  Standard_EXPORT TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M,
+                                    const Standard_Boolean FacetedContext,
+                                    Standard_Integer theSurfCurveMode);
   
-  Standard_EXPORT void Init (const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext);
+  Standard_EXPORT void Init (const MoniTool_DataMapOfShapeTransient& M,
+                             const Standard_Boolean FacetedContext,
+                             Standard_Integer theSurfCurveMode);
   
   Standard_EXPORT Standard_Boolean IsBound (const TopoDS_Shape& S);
   
index 99211cd72b23322690a63da4167870e204928ba5..4a8dc06e0a648d45d2bf996f3e17ac7a0b7b9014 100644 (file)
@@ -102,10 +102,10 @@ 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);
+  Standard_EXPORT virtual IFSelect_ReturnStatus ReadFile (const Standard_CString filename);
 
   //! Loads a file from stream and returns the read status
-  Standard_EXPORT IFSelect_ReturnStatus ReadStream(const Standard_CString theName, std::istream& theIStream);
+  Standard_EXPORT virtual IFSelect_ReturnStatus ReadStream(const Standard_CString theName, std::istream& theIStream);
   
   //! Returns the model. It can then be consulted (header, product)
   Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
index d15e01ddd93067ad57fd1e7f4cd7036e45f319be..79b03af1ca316d62543f84e8e48f4e6a6eff1853 100644 (file)
@@ -25,6 +25,7 @@
 #include <Interface_Static.hxx>
 #include <Message.hxx>
 #include <OSD_OpenFile.hxx>
+#include <OSD_Parallel.hxx>
 #include <OSD_Path.hxx>
 #include <STEPCAFControl_Reader.hxx>
 #include <STEPCAFControl_Writer.hxx>
@@ -256,13 +257,13 @@ static Standard_Integer stepread(Draw_Interpretor& theDI,
 
 //=======================================================================
 //function : testreadstep
-//purpose  :
+//purpose  : 
 //=======================================================================
 static Standard_Integer testreadstep(Draw_Interpretor& theDI,
                                      Standard_Integer theNbArgs,
                                      const char** theArgVec)
 {
-  if (theNbArgs < 3 || theNbArgs > 4)
+  if (theNbArgs < 3)
   {
     theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
     theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n";
@@ -270,37 +271,65 @@ static Standard_Integer testreadstep(Draw_Interpretor& theDI,
     return 1;
   }
 
-  Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream"));
-
-  STEPControl_Reader Reader;
-  Standard_CString filename = theArgVec[1];
-  IFSelect_ReturnStatus readstat;
-  if (useStream)
+  Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[theNbArgs - 1], "-stream"));
+  Standard_CString aShName = useStream ? theArgVec[theNbArgs - 2] : theArgVec[theNbArgs - 1];
+  Standard_Integer aSize = useStream ? (theNbArgs - 3) : (theNbArgs - 2);
+  NCollection_Array1<TopoDS_Shape> aShapes(0, aSize);
+  NCollection_Array1<TCollection_AsciiString> aFileNames(0, aSize);
+  NCollection_DataMap<TCollection_AsciiString, TopoDS_Shape> aShapesMap;
+  for (int anInd = 1; anInd <= aSize; ++anInd)
   {
-    std::ifstream aStream;
-    OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary);
-    TCollection_AsciiString aFolder, aFileNameShort;
-    OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort);
-    readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream);
+    aFileNames[anInd - 1] = theArgVec[anInd];
   }
-  else
-  {
-    readstat = Reader.ReadFile(filename);
-  }
-  theDI << "Status from reading STEP file " << filename << " : ";
-  switch (readstat)
+  STEPControl_Controller::Init();
+  XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
+  IFSelect_ReturnStatus aReadStat;
+  StepData_ConfParameters aParameters;
+  aParameters.InitFromStatic();
+  int aNbSubShape = 0;
+  OSD_Parallel::For
+  (
+    0, aSize,
+    [&](const Standard_Integer theIndex)
+    {
+      STEPControl_Reader aReader;
+      aReader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
+      if (useStream)
+      {
+        std::ifstream aStream;
+        OSD_OpenStream(aStream, aFileNames[theIndex].ToCString(), std::ios::in | std::ios::binary);
+        TCollection_AsciiString aFolder, aFileNameShort;
+        OSD_Path::FolderAndFileFromPath(aFileNames[theIndex].ToCString(), aFolder, aFileNameShort);
+        aReadStat = aReader.ReadStream(aFileNameShort.ToCString(), aParameters, aStream);
+      }
+      else
+      {
+        aReadStat = aReader.ReadFile(aFileNames[theIndex].ToCString(), aParameters);
+      }
+      if (aReadStat == IFSelect_RetDone)
+      {
+        aReader.TransferRoots();
+        aShapes[theIndex] = aReader.OneShape();
+        TCollection_AsciiString aName(aShName);
+        if (aSize > 1)
+        {
+          aName += theIndex;
+        }
+        aShapesMap.Bind(aName, aShapes[theIndex]);
+        aNbSubShape += aReader.NbShapes();
+      }
+      else
+      {
+        theDI << "Error: Problem with reading shape by file: " << "[" << aFileNames[theIndex] << "]";
+      }
+    }
+  );
+  NCollection_DataMap<TCollection_AsciiString, TopoDS_Shape>::Iterator anIt(aShapesMap);
+  for (; anIt.More(); anIt.Next())
   {
-    case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
-    case IFSelect_RetDone: { theDI << "file read\n";    break; }
-    case IFSelect_RetError: { theDI << "file not found\n";   return 1; }
-    case IFSelect_RetFail: { theDI << "error during read\n";  return 1; }
-    default: { theDI << "failure\n";   return 1; }
+    DBRep::Set(anIt.Key().ToCString(), anIt.Value());
   }
-  Reader.SetSystemLengthUnit(XSDRAW::GetLengthUnit());
-  Reader.TransferRoots();
-  TopoDS_Shape shape = Reader.OneShape();
-  DBRep::Set(theArgVec[2], shape);
-  theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n";
+  theDI << "Count of shapes produced : " << aNbSubShape << "\n";
   return 0;
 }
 
@@ -437,79 +466,75 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI,
 }
 
 //=======================================================================
-//function : testwrite
-//purpose  :
+//function : testwritestep
+//purpose  : 
 //=======================================================================
 static Standard_Integer testwrite(Draw_Interpretor& theDI,
                                   Standard_Integer theNbArgs,
                                   const char** theArgVec)
 {
-  TCollection_AsciiString aFilePath;
-  TopoDS_Shape aShape;
-  bool toTestStream = false;
-  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
-  {
-    TCollection_AsciiString anArgCase(theArgVec[anArgIter]);
-    anArgCase.LowerCase();
-    if (anArgCase == "-stream")
-    {
-      toTestStream = true;
-    }
-    else if (aFilePath.IsEmpty())
-    {
-      aFilePath = theArgVec[anArgIter];
-    }
-    else if (aShape.IsNull())
-    {
-      aShape = DBRep::Get(theArgVec[anArgIter]);
-      if (aShape.IsNull())
-      {
-        theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape\n";
-        return 1;
-      }
-    }
-    else
-    {
-      theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
-      return 1;
-    }
-  }
-  if (aShape.IsNull())
+  if (theNbArgs < 3)
   {
-    theDI << "Syntax error: wrong number of arguments\n";
+    theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n";
+    theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n";
+    theDI << " Option -stream forces usage of API accepting stream\n";
     return 1;
   }
 
-  STEPControl_Writer aWriter;
-  IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs);
-  if (aStat != IFSelect_RetDone)
+  Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[theNbArgs - 1], "-stream"));
+  Standard_CString aShName = useStream ? theArgVec[theNbArgs - 2] : theArgVec[theNbArgs - 1];
+  Standard_Integer aSize = useStream ? (theNbArgs - 3) : (theNbArgs - 2);
+  NCollection_Array1<TCollection_AsciiString> aFileNames(0, aSize);
+  NCollection_DataMap<TCollection_AsciiString, TopoDS_Shape> aShapesMap;
+  for (int anInd = 1; anInd <= aSize; ++anInd)
   {
-    theDI << "Error on transferring shape\n";
+    aFileNames[anInd - 1] = theArgVec[anInd];
+  }
+  TopoDS_Shape aShape = DBRep::Get(aShName);
+  if (aShape.IsNull())
+  {
+    theDI << "Syntax error: wrong number of arguments";
     return 1;
   }
 
-  if (toTestStream)
-  {
-    std::ofstream aStream;
-    OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary);
-    aStat = aWriter.WriteStream(aStream);
-    aStream.close();
-    if (!aStream.good()
-        && aStat == IFSelect_RetDone)
+  StepData_ConfParameters aParameters;
+  aParameters.InitFromStatic();
+
+  OSD_Parallel::For
+  (
+    0, aSize,
+    [&](const Standard_Integer theIndex)
     {
-      aStat = IFSelect_RetFail;
+      STEPControl_Writer aWriter;
+      if (aWriter.Transfer(aShape, STEPControl_AsIs, aParameters) != IFSelect_RetDone)
+      {
+        theDI << "Error: Can't transfer input shape";
+        return;
+      }
+      IFSelect_ReturnStatus aStat = IFSelect_RetDone;
+      if (useStream)
+      {
+        std::ofstream aStream;
+        OSD_OpenStream(aStream, aFileNames[theIndex], std::ios::out | std::ios::binary);
+        if (!aStream.good())
+        {
+          theDI << "Error: Problem with opening stream by file: " << "[" << aFileNames[theIndex] << "]";
+          return;
+        }
+        aStat = aWriter.WriteStream(aStream);
+      }
+      else
+      {
+        aStat = aWriter.Write(aFileNames[theIndex].ToCString());
+      }
+        if (aStat != IFSelect_RetDone)
+        {
+          theDI << "Error on writing file: " << "[" << aFileNames[theIndex] << "]";
+          return;
+        }
     }
-  }
-  else
-  {
-    aStat = aWriter.Write(aFilePath.ToCString());
-  }
-  if (aStat != IFSelect_RetDone)
-  {
-    theDI << "Error on writing file\n";
-    return 1;
-  }
-  theDI << "File Is Written\n";
+  );
+  theDI << "File(s) are Written";
   return 0;
 }
 
@@ -1011,10 +1036,10 @@ void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
 
   const char* aGroup = "DE: STEP";  // Step transfer file commands
   theDI.Add("stepwrite", "stepwrite mode[0-4 afsmw] shape", __FILE__, stepwrite, aGroup);
-  theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]",
+  theDI.Add("testwritestep", "testwritestep [file_1.stp ... file_n.stp] shape [-stream]",
             __FILE__, testwrite, aGroup);
   theDI.Add("stepread", "stepread  [file] [f or r (type of model full or reduced)]", __FILE__, stepread, aGroup);
-  theDI.Add("testreadstep", "testreadstep file shape [-stream]", __FILE__, testreadstep, aGroup);
+  theDI.Add("testreadstep", "testreadstep [file_1 ... file_n] shape [-stream]", __FILE__, testreadstep, aGroup);
   theDI.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, aGroup);
   theDI.Add("countexpected", "TEST", __FILE__, countexpected, aGroup);
   theDI.Add("dumpassembly", "TEST", __FILE__, dumpassembly, aGroup);