mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0033483: Data Exchange - Static_Interface local instance for the model
StepData_StepParameters class created and used instead of Interface_Static
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -17,11 +17,13 @@
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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,12 +116,24 @@ 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
|
||||
//! Returns Null handle if no external files are read
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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,18 +92,52 @@ 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());
|
||||
|
||||
//! Mehod to writing sequence of root assemblies or part of the file specified by use by one label
|
||||
Standard_EXPORT Standard_Boolean Transfer(const TDF_LabelSequence& theLabelSeq,
|
||||
const STEPControl_StepModelType theMode = STEPControl_AsIs,
|
||||
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; };
|
||||
|
Reference in New Issue
Block a user