1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0032821: DEWrapper - Implementation of a common toolkit for importing and exporting CAD files

Implementing DE_Wrapper and its formats
This commit is contained in:
atychini
2022-02-16 13:22:23 +03:00
committed by afokin
parent b1970c8a47
commit 6d1a049be7
141 changed files with 12406 additions and 277 deletions

View File

@@ -1,5 +1,7 @@
STEPCAFControl_ActorWrite.cxx
STEPCAFControl_ActorWrite.hxx
STEPCAFControl_ConfigurationNode.cxx
STEPCAFControl_ConfigurationNode.hxx
STEPCAFControl_Controller.cxx
STEPCAFControl_Controller.hxx
STEPCAFControl_DataMapIteratorOfDataMapOfLabelExternFile.hxx
@@ -17,9 +19,11 @@ STEPCAFControl_DataMapOfShapeSDR.hxx
STEPCAFControl_ExternFile.cxx
STEPCAFControl_ExternFile.hxx
STEPCAFControl_ExternFile.lxx
STEPCAFControl_GDTProperty.hxx
STEPCAFControl_GDTProperty.cxx
STEPCAFControl_Provider.cxx
STEPCAFControl_Provider.hxx
STEPCAFControl_Reader.cxx
STEPCAFControl_Reader.hxx
STEPCAFControl_Writer.cxx
STEPCAFControl_Writer.hxx
STEPCAFControl_GDTProperty.hxx
STEPCAFControl_GDTProperty.cxx

View File

@@ -0,0 +1,573 @@
// Copyright (c) 2022 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 <STEPCAFControl_ConfigurationNode.hxx>
#include <DE_ConfigurationContext.hxx>
#include <NCollection_Buffer.hxx>
#include <STEPCAFControl_Provider.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ConfigurationNode)
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
//=======================================================================
// function : STEPCAFControl_ConfigurationNode
// purpose :
//=======================================================================
STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
//=======================================================================
// function : STEPCAFControl_ConfigurationNode
// purpose :
//=======================================================================
STEPCAFControl_ConfigurationNode::STEPCAFControl_ConfigurationNode(const Handle(STEPCAFControl_ConfigurationNode)& theNode)
:DE_ConfigurationNode(theNode),
InternalParameters(theNode->InternalParameters)
{
UpdateLoad();
}
//=======================================================================
// function : Load
// purpose :
//=======================================================================
bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
{
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
InternalParameters.ReadBSplineContinuity = (ReadMode_BSplineContinuity)
theResource->IntegerVal("read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, aScope);
InternalParameters.ReadPrecisionMode = (ReadMode_Precision)
theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope);
InternalParameters.ReadPrecisionVal =
theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope);
InternalParameters.ReadMaxPrecisionMode = (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)
theResource->IntegerVal("read.surfacecurve.mode", InternalParameters.ReadSurfaceCurveMode, aScope);
InternalParameters.EncodeRegAngle =
theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope);
InternalParameters.AngleUnit = (AngleUnitMode)
theResource->IntegerVal("angleunit.mode", InternalParameters.AngleUnit, aScope);
InternalParameters.ReadResourceName =
theResource->StringVal("read.resource.name", InternalParameters.ReadResourceName, aScope);
InternalParameters.ReadSequence =
theResource->StringVal("read.sequence", InternalParameters.ReadSequence, aScope);
InternalParameters.ReadProductMode =
theResource->BooleanVal("read.product.mode", InternalParameters.ReadProductMode, aScope);
InternalParameters.ReadProductContext = (ReadMode_ProductContext)
theResource->IntegerVal("read.product.context", InternalParameters.ReadProductContext, aScope);
InternalParameters.ReadShapeRepr = (ReadMode_ShapeRepr)
theResource->IntegerVal("read.shape.repr", InternalParameters.ReadShapeRepr, aScope);
InternalParameters.ReadTessellated = (RWMode_Tessellated)
theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope);
InternalParameters.ReadAssemblyLevel = (ReadMode_AssemblyLevel)
theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope);
InternalParameters.ReadRelationship =
theResource->BooleanVal("read.shape.relationship", InternalParameters.ReadRelationship, aScope);
InternalParameters.ReadShapeAspect =
theResource->BooleanVal("read.shape.aspect", InternalParameters.ReadShapeAspect, aScope);
InternalParameters.ReadConstrRelation =
theResource->BooleanVal("read.constructivegeom.relationship", InternalParameters.ReadConstrRelation, aScope);
InternalParameters.ReadSubshapeNames =
theResource->BooleanVal("read.stepcaf.subshapes.name", InternalParameters.ReadSubshapeNames, aScope);
InternalParameters.ReadCodePage = (Resource_FormatType)
theResource->IntegerVal("read.codepage", InternalParameters.ReadCodePage, aScope);
InternalParameters.ReadNonmanifold =
theResource->BooleanVal("read.nonmanifold", InternalParameters.ReadNonmanifold, aScope);
InternalParameters.ReadIdeas =
theResource->BooleanVal("read.ideas", InternalParameters.ReadIdeas, aScope);
InternalParameters.ReadAllShapes =
theResource->BooleanVal("read.all.shapes", InternalParameters.ReadAllShapes, aScope);
InternalParameters.ReadRootTransformation =
theResource->BooleanVal("read.root.transformation", InternalParameters.ReadRootTransformation, aScope);
InternalParameters.ReadColor =
theResource->BooleanVal("read.color", InternalParameters.ReadColor, aScope);
InternalParameters.ReadName =
theResource->BooleanVal("read.name", InternalParameters.ReadName, aScope);
InternalParameters.ReadLayer =
theResource->BooleanVal("read.layer", InternalParameters.ReadLayer, aScope);
InternalParameters.ReadProps =
theResource->BooleanVal("read.props", InternalParameters.ReadProps, aScope);
InternalParameters.WritePrecisionMode = (WriteMode_PrecisionMode)
theResource->IntegerVal("write.precision.mode", InternalParameters.WritePrecisionMode, aScope);
InternalParameters.WritePrecisionVal =
theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope);
InternalParameters.WriteAssembly = (WriteMode_Assembly)
theResource->IntegerVal("write.assembly", InternalParameters.WriteAssembly, aScope);
InternalParameters.WriteSchema = (WriteMode_StepSchema)
theResource->IntegerVal("write.schema", InternalParameters.WriteSchema, aScope);
InternalParameters.WriteTessellated = (RWMode_Tessellated)
theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope);
InternalParameters.WriteProductName =
theResource->StringVal("write.product.name", InternalParameters.WriteProductName, aScope);
InternalParameters.WriteSurfaceCurMode =
theResource->BooleanVal("write.surfacecurve.mode", InternalParameters.WriteSurfaceCurMode, aScope);
InternalParameters.WriteUnit = (UnitsMethods_LengthUnit)
theResource->IntegerVal("write.unit", InternalParameters.WriteUnit, aScope);
InternalParameters.WriteResourceName =
theResource->StringVal("write.resource.name", InternalParameters.WriteResourceName, aScope);
InternalParameters.WriteSequence =
theResource->StringVal("write.sequence", InternalParameters.WriteSequence, aScope);
InternalParameters.WriteVertexMode = (WriteMode_VertexMode)
theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope);
InternalParameters.WriteSubshapeNames =
theResource->BooleanVal("write.stepcaf.subshapes.name", InternalParameters.WriteSubshapeNames, aScope);
InternalParameters.WriteColor =
theResource->BooleanVal("write.color", InternalParameters.WriteColor, aScope);
InternalParameters.WriteName =
theResource->BooleanVal("write.name", InternalParameters.WriteName, aScope);
InternalParameters.WriteLayer =
theResource->BooleanVal("write.layer", InternalParameters.WriteLayer, aScope);
InternalParameters.WriteProps =
theResource->BooleanVal("write.props", InternalParameters.WriteProps, aScope);
InternalParameters.WriteModelType = (STEPControl_StepModelType)
theResource->IntegerVal("write.model.type", InternalParameters.WriteModelType, aScope);
return true;
}
//=======================================================================
// function : Save
// purpose :
//=======================================================================
TCollection_AsciiString STEPCAFControl_ConfigurationNode::Save() const
{
TCollection_AsciiString aResult;
aResult += "!*****************************************************************************\n";
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
aResult += "!\n";
aResult += "!Common parameters:\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Manages the continuity of BSpline curves (IGES entities 106, 112 and 126) ";
aResult += "after translation to Open CASCADE Technology\n";
aResult += "!Default value: 1. Available values: 0, 1, 2\n";
aResult += aScope + "read.iges.bspline.continuity :\t " + InternalParameters.ReadBSplineContinuity + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Reads the precision mode value\n";
aResult += "!Default value: \"File\"(0). Available values: \"File\"(0), \"User\"(1)\n";
aResult += aScope + "read.precision.mode :\t " + InternalParameters.ReadPrecisionMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!This parameter gives the precision for shape construction when the ";
aResult += "read.precision.mode parameter value is 1\n";
aResult += "!Default value: 0.0001. Available values: any real positive (non null) value\n";
aResult += aScope + "read.precision.val :\t " + InternalParameters.ReadPrecisionVal + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode of applying the maximum allowed tolerance\n";
aResult += "!Default value: \"Preferred\"(0). Available values: \"Preferred\"(0), \"Forced\"(1)\n";
aResult += aScope + "read.maxprecision.mode :\t " + InternalParameters.ReadMaxPrecisionMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the maximum allowable tolerance (in internal units, which are specified in xstep.cascade.unit)";
aResult += " of the shape\n";
aResult += "!Default value: 1. Available values: any real positive (non null) value\n";
aResult += aScope + "read.maxprecision.val :\t " + InternalParameters.ReadMaxPrecisionVal + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the using of BRepLib::SameParameter\n";
aResult += "!Default value: \"Off\"(0). Available values: \"Off\"(0), \"On\"(1)\n";
aResult += aScope + "read.stdsameparameter.mode :\t " + InternalParameters.ReadSameParamMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Preference for the computation of curves in case of 2D/3D inconsistency in an entity ";
aResult += "which has both 2D and 3D representations.\n";
aResult += "!Default value: \"Default\"(0). Available values: \"Default\"(0), \"2DUse_Preferred\"(2), ";
aResult += "\"2DUse_Forced\"(-2), \"3DUse_Preferred\"(3), \"3DUse_Forced\"(-3)\n";
aResult += aScope + "read.surfacecurve.mode :\t " + InternalParameters.ReadSurfaceCurveMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!This parameter is used within the BRepLib::EncodeRegularity() function ";
aResult += "which is called for a shape read ";
aResult += "from an IGES or a STEP file at the end of translation process.This function sets the regularity flag of";
aResult += " an edge in a shell when this edge is shared by two faces.This flag shows the continuity, ";
aResult += "which these two faces are connected with at that edge.\n";
aResult += "!Default value (in degrees): 0.57295779513. Available values: <double>\n";
aResult += aScope + "read.encoderegularity.angle :\t " + InternalParameters.EncodeRegAngle + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Indicates what angle units should be used when a STEP file is read\n";
aResult += "!Default value: \"File\"(0). Available values: \"File\"(0), \"Rad\"(1), \"Deg\"(2)\n";
aResult += aScope + "angleunit.mode :\t " + InternalParameters.AngleUnit + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Read Parameters:\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the name of the resource file\n";
aResult += "!Default value: \"STEP\". Available values: <string>\n";
aResult += aScope + "read.resource.name :\t " + InternalParameters.ReadResourceName + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines name of the sequence of operators\n";
aResult += "!Default value: \"FromSTEP\". Available values: <string>\n";
aResult += aScope + "read.sequence :\t " + InternalParameters.ReadSequence + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the approach used for selection of top-level STEP entities for translation, ";
aResult += "and for recognition of assembly structures\n";
aResult += "!Default value: 1(\"ON\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.product.mode :\t " + InternalParameters.ReadProductMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!When reading AP 209 STEP files, allows selecting either only 'design' or 'analysis', ";
aResult += "or both types of products for translation\n";
aResult += "!Default value: 1(\"all\"). Available values: 1(\"all\"), 2(\"design\"), 3(\"analysis\")\n";
aResult += aScope + "read.product.context :\t " + InternalParameters.ReadProductContext + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Specifies preferred type of representation of the shape of the product, in case if a STEP file contains";
aResult += " more than one representation(i.e.multiple PRODUCT_DEFINITION_SHAPE entities) for a single product\n";
aResult += "!Default value: 1(\"All\"). Available values: 1(\"All\"), 2(\"ABSR\"), 3(\"MSSR\"), 4(\"GBSSR\"), ";
aResult += "5(\"FBSR\"), 6(\"EBWSR\"), 7(\"GBWSR\")\n";
aResult += aScope + "read.shape.repr :\t " + InternalParameters.ReadShapeRepr + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines whether tessellated shapes should be translated";
aResult += "!Default value: 1(\"On\"). Available values: 0(\"OFF\"), 2(\"OnNoBRep\")\n";
aResult += aScope + "read.tessellated :\t " + InternalParameters.ReadTessellated + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Specifies which data should be read for the products found in the STEP file\n";
aResult += "!Default value: 1(\"All\"). Available values: 1(\"All\"), 2(\"assembly\"),";
aResult += "3(\"structure\"), 4(\"shape\")\n";
aResult += aScope + "read.assembly.level :\t " + InternalParameters.ReadAssemblyLevel + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines whether shapes associated with the main SHAPE_DEFINITION_REPRESENTATION entity";
aResult += "of the product via SHAPE_REPRESENTATIONSHIP_RELATION should be translated\n";
aResult += "!Default value: 1(\"ON\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.shape.relationship :\t " + InternalParameters.ReadRelationship + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines whether shapes associated with the PRODUCT_DEFINITION_SHAPE entity of the product ";
aResult += "via SHAPE_ASPECT should be translated.\n";
aResult += "!Default value: 1(\"ON\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.shape.aspect :\t " + InternalParameters.ReadShapeAspect + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Boolean flag regulating translation of \"CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP\" ";
aResult += "entities that define position of constructive geometry entities contained in ";
aResult += "\"CONSTRUCTIVE_GEOMETRY_REPRESENTATION\" with respect to the main representation of the shape (product).\n";
aResult += "!Default value: 0(\"OFF\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.constructivegeom.relationship :\t " + InternalParameters.ReadConstrRelation + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Indicates whether to read sub-shape names from 'Name' attributes of STEP Representation Items\n";
aResult += "!Default value: 0(\"OFF\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.stepcaf.subshapes.name :\t " + InternalParameters.ReadSubshapeNames + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!STEP file encoding for names translation\n";
aResult += "!Default value: 4(\"UTF8\"). Available values: 0(\"SJIS\"), 1(\"EUC\"), 2(\"NoConversion\"), ";
aResult += "3(\"GB\"), 4(\"UTF8\"), 5(\"SystemLocale\"), 6(\"CP1250\"), 7(\"CP1251\"), 8(\"CP1252\"), ";
aResult += "9(\"CP1253\"), 10(\"CP1254\"), 11(\"CP1255\"), 12(\"CP1256\"), 13(\"CP1257\"), 14(\"CP1258\"), ";
aResult += "15(\"iso8859-1\"), 16(\"iso8859-2\"), 17(\"iso8859-3\"), 18(\"iso8859-4\"), 19(\"iso8859-5\"), ";
aResult += "20(\"iso8859-6\"), 21(\"iso8859-7\"), 22(\"iso8859-8\"), 23(\"iso8859-9\"), 24(\"CP850\")\n";
aResult += aScope + "read.codepage :\t " + InternalParameters.ReadCodePage + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Non-manifold topology reading\n";
aResult += "!Default value: 0(\"OFF\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.nonmanifold :\t " + InternalParameters.ReadNonmanifold + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!I-Deas-like STEP processing\n";
aResult += "!Default value: 0(\"OFF\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.ideas :\t " + InternalParameters.ReadIdeas + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Parameter to read all top level solids and shells\n";
aResult += "!Default value: 0(\"OFF\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.all.shapes :\t " + InternalParameters.ReadAllShapes + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Mode to variate apply or not transformation placed in the root shape representation.\n";
aResult += "!Default value: 1(\"ON\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.root.transformation :\t " + InternalParameters.ReadRootTransformation + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the read.colo parameter which is used to indicate read Colors or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "read.color :\t " + InternalParameters.ReadColor + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the read.name parameter which is used to indicate read Names or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "read.name :\t " + InternalParameters.ReadName + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the read.layer parameter which is used to indicate read Layers or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "read.layer :\t " + InternalParameters.ReadLayer + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the read.props parameter which is used to indicate read Validation properties or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "read.props :\t " + InternalParameters.ReadProps + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Write Parameters:\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Writes the precision value\n";
aResult += "!Default value: \"Average\"(0). Available values: \"Least\"(-1), \"Average\"(0), ";
aResult += "\"Greatest\"(1), \"Session\"(2)\n";
aResult += aScope + "write.precision.mode :\t " + InternalParameters.WritePrecisionMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!A user-defined precision value\n";
aResult += "!Default value: 0.0001. Available values: any real positive (non null) value\n";
aResult += aScope + "write.precision.val :\t " + InternalParameters.WritePrecisionVal + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Writing assembly mode\n";
aResult += "!Default value: 0(\"Off\"). Available values: 0(\"Off\"), 1(\"On\"), 2(\"Auto\")\n";
aResult += aScope + "write.assembly :\t " + InternalParameters.WriteAssembly + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the version of schema used for the output STEP file\n";
aResult += "!Default value: 1 or AP214CD. Available values: 1 or AP214CD, 2 or AP214DIS, 3 or AP203, ";
aResult += "4 or AP214IS, 5 or AP242DIS\n";
aResult += aScope + "write.schema :\t " + InternalParameters.WriteSchema + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines whether tessellated shapes should be translated";
aResult += "!Default value: 2(\"OnNoBRep\"). Available values: 0(\"OFF\"), 1(\"On\")\n";
aResult += aScope + "write.tessellated :\t " + InternalParameters.WriteTessellated + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the text string that will be used for field 'name' of PRODUCT entities written to the STEP file\n";
aResult += "!Default value: OCCT STEP translator (current OCCT version number). Available values: <string>\n";
aResult += aScope + "write.product.name :\t " + InternalParameters.WriteProductName + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!This parameter indicates whether parametric curves should be written into the STEP file\n";
aResult += "!Default value: 1(\"ON\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "write.surfacecurve.mode :\t " + InternalParameters.WriteSurfaceCurMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines a unit in which the STEP file should be written.\n";
aResult += "!Default value: MM(2). Available values: \"INCH\"(1), \"MM\"(2), \"??\"(3), \"FT\"(4), \"MI\"(5), ";
aResult += "\"M\"(6), \"KM\"(7), \"MIL\"(8), \"UM\"(9), \"CM\"(10), \"UIN\"(11)\n";
aResult += aScope + "write.unit :\t " + InternalParameters.WriteUnit + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the name of the resource file\n";
aResult += "!Default value: \"STEP\". Available values: <string>\n";
aResult += aScope + "write.resource.name :\t " + InternalParameters.WriteResourceName + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines name of the sequence of operators\n";
aResult += "!Default value: \"ToSTEP\". Available values: <string>\n";
aResult += aScope + "write.sequence :\t " + InternalParameters.WriteSequence + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!This parameter indicates which of free vertices writing mode is switch on\n";
aResult += "!Default value: 0(\"One Compound\"). Available values: 0(\"One Compound\"), 1(\"Signle Vertex\")\n";
aResult += aScope + "write.vertex.mode :\t " + InternalParameters.WriteVertexMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Indicates whether to write sub-shape names to 'Name' attributes of STEP Representation Items\n";
aResult += "!Default value: 0(\"OFF\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "write.stepcaf.subshapes.name :\t " + InternalParameters.WriteSubshapeNames + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the write.colo parameter which is used to indicate write Colors or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "write.color :\t " + InternalParameters.WriteColor + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the write.name parameter which is used to indicate write Names or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "write.name :\t " + InternalParameters.WriteName + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the write.layer parameter which is used to indicate write Layers or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "write.layer :\t " + InternalParameters.WriteLayer + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the write.props parameter which is used to indicate write Validation properties or not\n";
aResult += "!Default value: +. Available values: \"-\", \"+\"\n";
aResult += aScope + "write.props :\t " + InternalParameters.WriteProps + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up the Model Type which gives you the choice of translation mode for an Open CASCADE shape that ";
aResult += "is being translated to STEP\n";
aResult += "!Default value: 0. Available values: 0, 1, 2, 3, 4\n";
aResult += aScope + "write.model.type :\t " + InternalParameters.WriteModelType + "\n";
aResult += "!\n";
aResult += "!*****************************************************************************\n";
return aResult;
}
//=======================================================================
// function : Copy
// purpose :
//=======================================================================
Handle(DE_ConfigurationNode) STEPCAFControl_ConfigurationNode::Copy() const
{
return new STEPCAFControl_ConfigurationNode(*this);
}
//=======================================================================
// function : BuildProvider
// purpose :
//=======================================================================
Handle(DE_Provider) STEPCAFControl_ConfigurationNode::BuildProvider()
{
return new STEPCAFControl_Provider(this);
}
//=======================================================================
// function : IsImportSupported
// purpose :
//=======================================================================
bool STEPCAFControl_ConfigurationNode::IsImportSupported() const
{
return true;
}
//=======================================================================
// function : IsExportSupported
// purpose :
//=======================================================================
bool STEPCAFControl_ConfigurationNode::IsExportSupported() const
{
return true;
}
//=======================================================================
// function : GetFormat
// purpose :
//=======================================================================
TCollection_AsciiString STEPCAFControl_ConfigurationNode::GetFormat() const
{
return TCollection_AsciiString("STEP");
}
//=======================================================================
// function : GetVendor
// purpose :
//=======================================================================
TCollection_AsciiString STEPCAFControl_ConfigurationNode::GetVendor() const
{
return TCollection_AsciiString("OCC");
}
//=======================================================================
// function : GetExtensions
// purpose :
//=======================================================================
TColStd_ListOfAsciiString STEPCAFControl_ConfigurationNode::GetExtensions() const
{
TColStd_ListOfAsciiString anExt;
anExt.Append("stp");
anExt.Append("step");
anExt.Append("stpz");
return anExt;
}
//=======================================================================
// function : CheckContent
// purpose :
//=======================================================================
bool STEPCAFControl_ConfigurationNode::CheckContent(const Handle(NCollection_Buffer)& theBuffer) const
{
if (theBuffer.IsNull() || theBuffer->Size() < 100)
{
return false;
}
const char* aBytes = (const char*)theBuffer->Data();
if (::strstr(aBytes, "IFC"))
{
return false;
}
if (::strstr(aBytes, "ISO-10303-21"))
{
// Double-check by presence of "FILE_SHEMA" statement
const char* aPtr = ::strstr(aBytes, "FILE_SCHEMA");
if (aPtr)
{
return true;
}
}
return false;
}

View File

@@ -0,0 +1,234 @@
// Copyright (c) 2022 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 _STEPCAFControl_ConfigurationNode_HeaderFile
#define _STEPCAFControl_ConfigurationNode_HeaderFile
#include <DE_ConfigurationNode.hxx>
#include <STEPControl_StepModelType.hxx>
#include <Resource_FormatType.hxx>
#include <UnitsMethods_LengthUnit.hxx>
//! The purpose of this class is to configure the transfer process for STEP format
//! Stores the necessary settings for STEPCAFControl_Provider.
//! Configures and creates special provider to transfer STEP files.
//!
//! Nodes grouped by Vendor name and Format type.
//! The Vendor name is "OCC"
//! The Format type is "STEP"
//! The supported CAD extensions are ".stp", ".step", ".stpz"
//! The import process is supported.
//! The export process is supported.
class STEPCAFControl_ConfigurationNode : public DE_ConfigurationNode
{
DEFINE_STANDARD_RTTIEXT(STEPCAFControl_ConfigurationNode, DE_ConfigurationNode)
public:
//! Initializes all field by default
Standard_EXPORT STEPCAFControl_ConfigurationNode();
//! Copies values of all fields
//! @param[in] theNode object to copy
Standard_EXPORT STEPCAFControl_ConfigurationNode(const Handle(STEPCAFControl_ConfigurationNode)& theNode);
//! Updates values according the resource
//! @param[in] theResource input resource to use
//! @return true if theResource loading has ended correctly
Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource) Standard_OVERRIDE;
//! Writes configuration to the string
//! @return result resource string
Standard_EXPORT virtual TCollection_AsciiString Save() const Standard_OVERRIDE;
//! Copies values of all fields
//! @return new object with the same field values
Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const Standard_OVERRIDE;
//! Creates new provider for the own format
//! @return new created provider
Standard_EXPORT virtual Handle(DE_Provider) BuildProvider() Standard_OVERRIDE;
public:
//! Checks the import supporting
//! @return true if import is supported
Standard_EXPORT virtual bool IsImportSupported() const Standard_OVERRIDE;
//! Checks the export supporting
//! @return true if export is supported
Standard_EXPORT virtual bool IsExportSupported() const Standard_OVERRIDE;
//! Gets CAD format name of associated provider
//! @return provider CAD format
Standard_EXPORT virtual TCollection_AsciiString GetFormat() const Standard_OVERRIDE;
//! Gets provider's vendor name of associated provider
//! @return provider's vendor name
Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
//! Gets list of supported file extensions
//! @return list of extensions
Standard_EXPORT virtual TColStd_ListOfAsciiString GetExtensions() const Standard_OVERRIDE;
//! Checks the file content to verify a format
//! @param[in] theBuffer read stream buffer to check content
//! @return Standard_True if file is supported by a current provider
Standard_EXPORT virtual bool CheckContent(const Handle(NCollection_Buffer)& theBuffer) const Standard_OVERRIDE;
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;
};
#endif // _STEPCAFControl_ConfigurationNode_HeaderFile

View File

@@ -0,0 +1,431 @@
// Copyright (c) 2022 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 <STEPCAFControl_Provider.hxx>
#include <BinXCAFDrivers.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <StepData_StepModel.hxx>
#include <STEPCAFControl_ConfigurationNode.hxx>
#include <STEPCAFControl_Controller.hxx>
#include <STEPCAFControl_Reader.hxx>
#include <STEPCAFControl_Writer.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <UnitsMethods.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_Provider, DE_Provider)
//=======================================================================
// function : STEPCAFControl_Provider
// purpose :
//=======================================================================
STEPCAFControl_Provider::STEPCAFControl_Provider()
{}
//=======================================================================
// function : STEPCAFControl_Provider
// purpose :
//=======================================================================
STEPCAFControl_Provider::STEPCAFControl_Provider(const Handle(DE_ConfigurationNode)& theNode)
: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 :
//=======================================================================
bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
if (theDocument.IsNull())
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: theDocument shouldn't be null";
return false;
}
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
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())
{
aReader.Init(theWS);
}
aReader.SetColorMode(aNode->InternalParameters.ReadColor);
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());
if (aReadStat != IFSelect_RetDone)
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: abandon";
resetStatic();
return false;
}
if (!aReader.Transfer(theDocument, theProgress))
{
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;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
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);
STEPCAFControl_Writer aWriter;
if (!theWS.IsNull())
{
aWriter.Init(theWS);
}
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))
{
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());
switch (aStatus)
{
case IFSelect_RetVoid:
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: No file written";
resetStatic();
return false;;
}
case IFSelect_RetDone:
{
break;
}
default:
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
thePath << "\t: Error on writing file";
resetStatic();
return false;
}
}
resetStatic();
return true;
}
//=======================================================================
// function : Read
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
Handle(XSControl_WorkSession) aWS;
return Read(thePath, theDocument, aWS, theProgress);
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
Handle(XSControl_WorkSession) aWS;
return Write(thePath, theDocument, aWS, theProgress);
}
//=======================================================================
// function : Read
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
(void)theProgress;
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
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());
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;
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(STEPCAFControl_ConfigurationNode)))
{
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
thePath << "\t: Incorrect or empty Configuration Node";
return false;
}
Handle(STEPCAFControl_ConfigurationNode) aNode = Handle(STEPCAFControl_ConfigurationNode)::DownCast(GetNode());
initStatic(aNode);
STEPControl_Writer aWriter;
if(!theWS.IsNull())
{
aWriter.SetWS(theWS);
}
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);
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;
}
//=======================================================================
// function : Read
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
Handle(XSControl_WorkSession) aWS;
return Read(thePath, theShape, aWS, theProgress);
}
//=======================================================================
// function : Write
// purpose :
//=======================================================================
bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
Handle(XSControl_WorkSession) aWS;
return Write(thePath, theShape, aWS, theProgress);
}
//=======================================================================
// function : GetFormat
// purpose :
//=======================================================================
TCollection_AsciiString STEPCAFControl_Provider::GetFormat() const
{
return TCollection_AsciiString("STEP");
}
//=======================================================================
// function : GetVendor
// purpose :
//=======================================================================
TCollection_AsciiString STEPCAFControl_Provider::GetVendor() const
{
return TCollection_AsciiString("OCC");
}

View File

@@ -0,0 +1,151 @@
// Copyright (c) 2022 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 _STEPCAFControl_Provider_HeaderFile
#define _STEPCAFControl_Provider_HeaderFile
#include <DE_Provider.hxx>
#include <STEPCAFControl_ConfigurationNode.hxx>
//! The class to transfer STEP files.
//! Reads and Writes any STEP files into/from OCCT.
//! Each operation needs configuration node.
//!
//! Providers grouped by Vendor name and Format type.
//! The Vendor name is "OCC"
//! The Format type is "STEP"
//! The import process is supported.
//! The export process is supported.
class STEPCAFControl_Provider : public DE_Provider
{
public:
DEFINE_STANDARD_RTTIEXT(STEPCAFControl_Provider, DE_Provider)
public:
//! Default constructor
//! Configure translation process with global configuration
Standard_EXPORT STEPCAFControl_Provider();
//! Configure translation process
//! @param[in] theNode object to copy
Standard_EXPORT STEPCAFControl_Provider(const Handle(DE_ConfigurationNode)& theNode);
public:
//! Reads a CAD file, according internal configuration
//! @param[in] thePath path to the import CAD file
//! @param[out] theDocument document to save result
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
//! @param[out] theDocument document to export
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return true if Write operation has ended correctly
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Reads a CAD file, according internal configuration
//! @param[in] thePath path to the import CAD file
//! @param[out] theDocument document to save result
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
//! @param[out] theDocument document to export
//! @param theProgress[in] progress indicator
//! @return true if Write operation has ended correctly
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Reads a CAD file, according internal configuration
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
//! @param[out] theShape shape to export
//! @param[in] theWS current work session
//! @param theProgress[in] progress indicator
//! @return true if Write operation has ended correctly
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Reads a CAD file, according internal configuration
//! @param[in] thePath path to the import CAD file
//! @param[out] theShape shape to save result
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
//! Writes a CAD file, according internal configuration
//! @param[in] thePath path to the export CAD file
//! @param[out] theShape shape to export
//! @param theProgress[in] progress indicator
//! @return true if Write operation has ended correctly
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
public:
//! Gets CAD format name of associated provider
//! @return provider CAD format
Standard_EXPORT virtual TCollection_AsciiString GetFormat() const Standard_OVERRIDE;
//! Gets provider's vendor name of associated provider
//! @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;
};
#endif // _STEPCAFControl_Provider_HeaderFile

View File

@@ -362,7 +362,7 @@ Standard_Integer STEPCAFControl_Reader::NbRootsForTransfer()
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::TransferOneRoot (const Standard_Integer num,
Handle(TDocStd_Document) &doc,
const Handle(TDocStd_Document) &doc,
const Message_ProgressRange& theProgress)
{
TDF_LabelSequence Lseq;
@@ -375,7 +375,7 @@ Standard_Boolean STEPCAFControl_Reader::TransferOneRoot (const Standard_Integer
//purpose :
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::Transfer (Handle(TDocStd_Document) &doc,
Standard_Boolean STEPCAFControl_Reader::Transfer (const Handle(TDocStd_Document) &doc,
const Message_ProgressRange& theProgress)
{
TDF_LabelSequence Lseq;
@@ -389,7 +389,7 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (Handle(TDocStd_Document) &doc,
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename,
Handle(TDocStd_Document) &doc,
const Handle(TDocStd_Document) &doc,
const Message_ProgressRange& theProgress)
{
if (ReadFile (filename) != IFSelect_RetDone)
@@ -406,7 +406,7 @@ Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString &filename,
Handle(TDocStd_Document) &doc,
const Handle(TDocStd_Document) &doc,
const Message_ProgressRange& theProgress)
{
if ( ReadFile (filename.ToCString()) != IFSelect_RetDone)
@@ -507,7 +507,7 @@ void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theMo
Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
const Standard_Integer nroot,
Handle(TDocStd_Document) &doc,
const Handle(TDocStd_Document) &doc,
TDF_LabelSequence &Lseq,
const Standard_Boolean asOne,
const Message_ProgressRange& theProgress)
@@ -828,7 +828,7 @@ TDF_Label STEPCAFControl_Reader::AddShape(const TopoDS_Shape &S,
Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile (const Standard_CString file,
const Standard_CString fullname,
Handle(TDocStd_Document)& doc,
const Handle(TDocStd_Document)& doc,
const Message_ProgressRange& theProgress)
{
// if the file is already read, associate it with SDR
@@ -935,7 +935,7 @@ static void propagateColorToParts(const Handle(XCAFDoc_ShapeTool)& theSTool,
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSession) &WS,
Handle(TDocStd_Document)& Doc) const
const Handle(TDocStd_Document)& Doc) const
{
STEPConstruct_Styles Styles(WS);
if (!Styles.LoadStyles()) {
@@ -1183,8 +1183,8 @@ TDF_Label STEPCAFControl_Reader::FindInstance(const Handle(StepRepr_NextAssembly
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadNames(const Handle(XSControl_WorkSession) &WS,
Handle(TDocStd_Document)& Doc,
const STEPCAFControl_DataMapOfPDExternFile &PDFileMap) const
const Handle(TDocStd_Document)& Doc,
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const
{
// get starting data
const Handle(Interface_InterfaceModel) &Model = WS->Model();
@@ -1293,8 +1293,8 @@ static TDF_Label GetLabelFromPD(const Handle(StepBasic_ProductDefinition) &PD,
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadValProps(const Handle(XSControl_WorkSession) &WS,
Handle(TDocStd_Document)& Doc,
const STEPCAFControl_DataMapOfPDExternFile &PDFileMap) const
const Handle(TDocStd_Document)& Doc,
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const
{
// get starting data
const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
@@ -1425,7 +1425,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadValProps(const Handle(XSControl_Work
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadLayers(const Handle(XSControl_WorkSession) &WS,
Handle(TDocStd_Document)& Doc) const
const Handle(TDocStd_Document)& Doc) const
{
const Handle(Interface_InterfaceModel) &Model = WS->Model();
const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
@@ -1596,8 +1596,8 @@ static TDF_Label setSHUOintoDoc(const Handle(XSControl_WorkSession) &WS,
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadSHUOs(const Handle(XSControl_WorkSession) &WS,
Handle(TDocStd_Document)& Doc,
const STEPCAFControl_DataMapOfPDExternFile &PDFileMap) const
const Handle(TDocStd_Document)& Doc,
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const
{
// the big part code duplication from ReadColors.
// It is possible to share this code functionality, just to decide how ???
@@ -3890,7 +3890,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSession)& theWS,
Handle(TDocStd_Document)& theDoc)
const Handle(TDocStd_Document)& theDoc)
{
const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
const Interface_Graph& aGraph = theWS->Graph();
@@ -4100,8 +4100,8 @@ static Handle(StepShape_SolidModel) FindSolidForPDS(const Handle(StepRepr_Produc
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_WorkSession) &WS,
Handle(TDocStd_Document)& Doc,
const Handle(TColStd_HSequenceOfTransient) &SeqPDS) const
const Handle(TDocStd_Document)& Doc,
const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const
{
const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
@@ -4323,7 +4323,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
//function : ReadViews
//purpose :
//=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS, Handle(TDocStd_Document)& theDoc) const
Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS, const Handle(TDocStd_Document)& theDoc) const
{
const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());

View File

@@ -86,23 +86,23 @@ public:
//! Returns True if succeeded, and False in case of fail
//! Provided for use like single-file reader
Standard_EXPORT Standard_Boolean TransferOneRoot (const Standard_Integer num,
Handle(TDocStd_Document)& doc,
const Handle(TDocStd_Document)& doc,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Translates currently loaded STEP file into the document
//! Returns True if succeeded, and False in case of fail
//! Provided for use like single-file reader
Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& doc,
Standard_EXPORT Standard_Boolean Transfer (const Handle(TDocStd_Document)& doc,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& filename,
Handle(TDocStd_Document)& doc,
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,
Handle(TDocStd_Document)& doc,
const Handle(TDocStd_Document)& doc,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Returns data on external files
@@ -181,7 +181,7 @@ protected:
//! them into assembly. Fills sequence of produced labels
Standard_EXPORT Standard_Boolean Transfer (STEPControl_Reader& rd,
const Standard_Integer num,
Handle(TDocStd_Document)& doc,
const Handle(TDocStd_Document)& doc,
TDF_LabelSequence& Lseq,
const Standard_Boolean asOne = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -196,42 +196,42 @@ protected:
//! given name
Standard_EXPORT Handle(STEPCAFControl_ExternFile) ReadExternFile (const Standard_CString file,
const Standard_CString fullpath,
Handle(TDocStd_Document)& doc,
const Handle(TDocStd_Document)& doc,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Reads style assignments from STEP model and sets
//! corresponding color assignments in the DECAF document
Standard_EXPORT Standard_Boolean ReadColors
(const Handle(XSControl_WorkSession)& WS,
Handle(TDocStd_Document)& doc) const;
const Handle(TDocStd_Document)& doc) const;
//! Reads names of parts defined in the STEP model and
//! assigns them to corresponding labels in the DECAF document
Standard_EXPORT Standard_Boolean ReadNames (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
Standard_EXPORT Standard_Boolean ReadNames (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
//! Reads validation properties assigned to shapes in the STEP
//! model and assigns them to corresponding labels in the DECAF
//! document
Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
//! Reads layers of parts defined in the STEP model and
//! set reference between shape and layers in the DECAF document
Standard_EXPORT Standard_Boolean ReadLayers (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc) const;
Standard_EXPORT Standard_Boolean ReadLayers (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc) const;
//! Reads SHUO for instances defined in the STEP model and
//! set reference between shape instances from different assemblyes
Standard_EXPORT Standard_Boolean ReadSHUOs (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
Standard_EXPORT Standard_Boolean ReadSHUOs (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
//! Reads D&GT for instances defined in the STEP model and
//! set reference between shape instances from different assemblyes
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc);
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc);
//! Reads materials for instances defined in the STEP model and
//! set reference between shape instances from different assemblyes
Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc, const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const;
Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const;
//! Reads Views for instances defined in the STEP model
Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, Handle(TDocStd_Document)& theDoc) const;
Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, const Handle(TDocStd_Document)& theDoc) const;
//! Populates the sub-Label of the passed TDF Label with shape
//! data associated with the given STEP Representation Item,