Open CASCADE Technology
6.7.0
|
|
This manual is intended to provide technical documentation on the Open CASCADE Technology (OCCT) STEP processor and to help Open CASCADE Technology users with the use of the STEP processor (to read and write STEP files). STEP files conforming to AP 214, AP 203 and partially AP 209 can be read. STEP files that are produced by this interface conform to STEP AP 214 or AP 203, according to the user option.
Only geometrical, topological STEP entities (shapes) and assembly structures are translated by the basic translator described in sections 2 to 6. Data that cannot be translated on this level are also loaded from a STEP file and can be translated later. XDE STEP translator (see section 7 Reading from and writing to XDE) translates names, colors, layers, validation properties and other data associated with shapes and assemblies into XDE document.
File translation is performed in the programming mode, via C++ calls.
For testing the STEP component in DRAW Test Harness, a set of commands for reading and writing STEP files and analysis of relevant data are provided by the TKXSDRAW plugin.
You can translate a STEP file into an OCCT shape in the following steps:
The ProSTEP Round Table Agreement Log (version July 1998), item 21, defines two alternatives for the implementation of assembly structure representations: using mapped_item entities and using representation_relationship_with_transformation entities. Both these alternative representations are recognized and processed at reading. On writing, the second alternative is always employed.
Handling of assemblies is implemented in two separate levels: firstly STEP assembly structures are translated into OCCT shapes, and secondly the OCCT shape representing the assembly is converted into any data structure intended for representing assemblies (for example, OCAF).
The first part of this document describes the basic STEP translator implementing translation of the first level, i.e. translation to OCCT Shapes. On this level, the acyclic graph representing the assembly structure in a STEP file is mapped into the structure of nested TopoDS_Compounds in Open CASCADE Technology. The (sub)assemblies become (sub)compounds containing shapes which are the results of translating components of that (sub)assembly. The sharing of components of assemblies is preserved as Open CASCADE Technology sharing of subshapes in compounds.
The attributive information attached to assembly components in a STEP file (such as names and descriptions of products, colors, layers etc.) can be translatd after the translation of the shape itself by parsing the STEP model (loaded in memory). Several tools from the package STEPConstruct provide functionalities to read styles (colors), validation properties, product information etc. Implementation of the second level of translation (conversion to XDE data structure) is provided by XDE STEP translator.
Length units, plane angle units and the uncertainty value are taken from shape_representation entities. This data is used in the translation process.
The types of STEP representation entities that are recognized are:
The types of STEP topological entities that can be translated are:
The types of STEP geometrical entities that can be translated are:
For further information see 2.4 Mapping STEP entities to Open CASCADE Technology shapes.
Before performing any other operation you have to load the file with:
Loading the file only memorizes the data, it does not translate it.
This step is not obligatory. Check the loaded file with:
Error messages are displayed if there are invalid or incomplete STEP entities, giving you the information on the cause of error.
If failsonly is true only fail messages are displayed. All messages are displayed if failsonly is false. Your analysis of the file can be either message-oriented or entity-oriented. Choose your preference with:
Where xxx can be one of the following:
The following parameters can be used to translate a STEP file into an OCCT shape.
If you give a value that is not within the range of possible values it will simply be ignored.
Defines which precision value will be used during translation (see section 2.5 below for details on precision and tolerances).
Read this parameter with:
Modify this parameter with:
Default value is File (0).
User defined precision value. This parameter gives the precision for shape construction when the read.precision.mode parameter value is 1. By default it is 0.0001, but can be any real positive (non null) value.
This value is a basic value of tolerance in the processor. The value is in millimeters, independently of the length unit defined in the STEP file.
Read this parameter with:
Modify this parameter with:
By default this value is 0.0001.
The value given to this parameter is a basic value for ShapeHealing algorithms and the processor. It does its best to reach it. Under certain circumstances, the value you give may not be attached to all of the entities concerned at the end of processing. STEP-to-OpenCASCADE translation does not improve the quality of the geometry in the original STEP file. This means that the value you enter may be impossible to attach to all shapes with the given quality of the geometry in the STEP file.
Defines the maximum allowed tolerance (in mm) of the shape. It should be not less than the basic value of tolerance set in the processor (either the uncertainty from the file or read.precision.val). Actually, the maximum between read.maxprecision.val and the basis tolerance is used to define the maximum allowed tolerance.
Read this parameter with:
Modify this parameter with:
Default value is 1. Note that maximum tolerance even explicitly defined by the user may be insufficient to ensure the validity of the shape (if real geometry is of bad quality). Therefore the user is provided with an additional parameter, which allows him to choose: either he prefers to ensure the shape validity or he rigidly sets the value of maximum tolerance. In the first case there is a possibility that the tolerance will not have any upper limit, in the second case the shape may be invalid.
Defines the mode of applying the maximum allowed tolerance. Its possible values are:
Read this parameter with:
Modify this parameter with:
Default value is 0 ("Preferred").
defines the use of BRepLib::SameParameter. Its possible values are:
Read this parameter with:
Modify this parameter with:
Default value is 0 (;Off;).
a preference for the computation of curves in an entity which has both 2D and 3D representation. Each TopoDS_Edge in TopoDS_Face must have a 3D and 2D curve that references the surface.
If both 2D and 3D representation of the entity are present, the computation of these curves depends on the following values of parameter:
Read this parameter with:
Modify this parameter with:
Default value is (0).
This parameter is used for call to BRepLib::EncodeRegularity() function which is called for the shape read from an IGES or a STEP file at the end of translation process. This function sets the regularity flag of the edge in the shell when this edge is shared by two faces. This flag shows the continuity these two faces are connected with at that edge. Read this parameter with:
Modify this parameter with:
Default value is 0.01.
This parameter is obsolete (it was required in the past for STEP files with a badly encoded angle unit). It indicates what angle units should be used when a STEP file is read: the units from file (default), or forced RADIANS or DEGREES.
Default value is File
These two parameters define the name of the resource file and the name of the sequence of operators (defined in that file) for Shape Processing, which is automatically performed by the STEP translator. Shape Processing is a user-configurable step, which is performed after translation and consists in applying a set of operators to a resulting shape. This is a very powerful tool allowing customizing the shape and adapting it to the needs of a receiving application. By default the sequence consists of a single operator ShapeFix - that is how Shape Healing is called from the STEP translator.
Please find an example of the resource file for STEP (which defines parameters corresponding to the sequence applied by default, i.e. if the resource file is not found) in the Open CASCADE Technology installation, by the path CASROOT%/src/XSTEPResource/STEP.
In order for the STEP translator to use that file, you have to define the CSF_STEPDefaults environment variable, which should point to the directory where the resource file resides. Note that if you change parameter read.step.resource.name, you will change the name of the resource file and the environment variable correspondingly.
Default values:
This parameter is obsolete (the parameter xstep.cascade.unit should be used instead when necessary). If it is set to 'M', the shape is scaled 0.001 times (as if it were in meters) after translation from IGES or STEP. Default value is MM.
This parameter defines units to which a shape should be converted when translated from IGES or STEP to CASCADE. Normally it is MM; only those applications that work internally in units other than MM should use this parameter.
Default value is MM.
Defines the approach used for selection of top-level STEP entities for translation, and for recognition of assembly structures
Read this parameter with:
Modify this parameter with:
Default value is 1 (ON).
Note that the following parameters have effect only if read.step.product.mode is ON.
When reading AP 209 STEP files, allows selecting either only ‘design’ or ‘analysis’, or both types of products for translation
Note that in AP 203 and AP214 files all products should be marked as ‘design’, so if this mode is set to ‘analysis’, nothing will be read.
Read this parameter with:
Modify this parameter with:
Default value is 1 (all).
Specifies preferred type of representation of the shape of the product, in case if a STEP file contains more than one representation (i.e. multiple PRODUCT_DEFINITION_SHAPE entities) for a single product
When this option is not equal to 1, for products with multiple representations the representation having a type closest to the selected one in this list will be translated.
Read this parameter with:
Modify this parameter with:
Default value is 1 (All).
Specifies which data should be read for the products found in the STEP file:
Read this parameter with:
Modify this parameter with:
Default value is 1 (All).
Defines whether shapes associated with the main SHAPE_DEFINITION_REPRESENTATION entity of the product via SHAPE_REPRESENTATIONSHIP_RELATION should be translated. This kind of association is used for the representation of hybrid models (i.e. models whose shape is composed of different types of representations) in AP 203 files since 1998, but it can be also used to associate auxiliary data with the product. This parameter allows to avoid translation of such auxiliary data.
Read this parameter with:
Modify this parameter with:
Default value is 1 (ON).
Defines whether shapes associated with the PRODUCT_DEFINITION_SHAPE entity of the product via SHAPE_ASPECT should be translated. This kind of association was used for the representation of hybrid models (i.e. models whose shape is composed of different types of representations) in AP 203 files before 1998, but it is also used to associate auxiliary information with the sub-shapes of the part. Though STEP translator tries to recognize such cases correctly, this parameter may be useful to avoid unconditionally translation of shapes associated via SHAPE_ASPECT entities.
Read this parameter with:
Modify this parameter with:
Default value is 1 (ON).
Perform the translation according to what you want to translate. You can choose either root entities (all or selected by the number of root), or select any entity by its number in the STEP file. There is a limited set of types of entities that can be used as starting entities for translation. Only the following entities are recognized as transferable:
The following methods are used for translation:
Each successful translation operation outputs one shape. A series of translations gives a set of shapes.
Each time you invoke TransferOne(), TransferRoot() or TransferList(), their results are accumulated and the counter of results increases. You can clear the results with:
between two translation operations, if you do not, the results from the next translation will be added to the accumulation.
TransferRoots() operations automatically clear all existing results before they start.
If several individual translations follow each other, the results give a list that can be purged with reader.ClearShapes(), which erases the existing results.
Each time you invoke Transfer or TransferRoots(), you can display the related messages with the help of:
This check concerns the last invocation of Transfer or TransferRoots() only.
There are three selection possibilities. You can select:
Transferring the whole file means transferring all root entities. The number of roots can be evaluated when the file is loaded:
A list of entities can be formed by invoking STEP214Control_Reader::GiveList (this is a method of the parent class).
Here is a simple example of how a list is translated:
The result is a TColStd_HSequenceOfTransient. You can either translate a list entity by entity or all at once. An entity-by-entity operation lets you check each individual entity translated.
nbtrans gives the number of items in the list that produced a shape.
There is a number of predefined operators that can be used. They are:
You can select an entity either by its rank or by its handle (an entity’s handle can be obtained by invoking the StepData_StepModel::Entity function).
Use method StepData_StepModel::NextNumberForLabel to find its rank with the following:
Translate an entity specified by its rank:
ent is the entity. The argument is a Handle(Standard_Transient).
Tables given in this paragraph show the mapping of STEP entities to OCCT objects. Only topological and geometrical STEP entities and entities defining assembly structures are described in this paragraph. For a full list of STEP entities please refer to Appendix A.
Not all entities defining the assembly structure in the STEP file are translated to OCCT shapes, but they are used to identify the relationships between assemblies and their components. Since the graph of ‘natural’ dependencies of entities based on direct references between them does not include the references from assemblies to their components, these dependencies are introduced in addition to the former ones. This is made basing on the analysis of the following entities describing the structure of the assembly.
STEP entity type | CASCADE shape | Comments |
---|---|---|
product_definition | A TopoDS_Compound for assemblies, a CASCADE shape corresponding to the component type of for components, | Each assembly or component has its own product_definition. It is used as a starting point for translation when read.step.product.mode is ON. |
product_definition_shape | This entity provides a link between product_definition and corresponding shape_definition_representation, or between next_assembly_usage_occurence and corresponding context_dependent_shape_representation. | |
shape_definition_representation | A TopoDS_Compound for assemblies, a CASCADE shape corresponding to the component type for components. | Each assembly or component has its own shape_definition_representation. The graph of dependencies is modified in such a way that shape_definition_representations of all components of the assembly are referred by the shape_definition_representation of the assembly. |
next_assembly_usage_occurence | This entity defines a relationship between the assembly and its component. It is used to introduce (in the dependencies graph) the links between shape_definition_representation of the assembly and shape_definition_representations and context_dependent_shape_representations of all its components. | |
mapped_item | TopoDS_Shape | This entity defines a mapping of the assembly component into the shape_representation of the assembly. The result of translation is a CASCADE shape translated from the component, to which transformation defined by the mapped_item is applied. |
context_dependent_shape_representation | TopoDS_Shape | This entity is associated with the next_assembly_usage_occurence entity and defines a placement of the component in the assembly. The graph of dependencies is modified so that each context_dependent_shape_representation* is referred by shape_definition_representation of the corresponding assembly. |
shape_representation_relationship_with_transformation | This entity is associated with context_dependent_shape_representation and defines a transformation necessary to apply to the component in order to locate it in its place in the assembly. | |
item_defined_transformation | This entity defines a transformation operator used by shape_representation_relationship_with_transformation or mapped_item entity | |
cartesian_transformation_operator | This entity defines a transformation operator used by shape_representation_relationship_with_transformation or mapped_item entity |
STEP entity type | CASCADE shape | Comments |
---|---|---|
Solid Models | ||
brep_with_voids | TopoDS_Solid | |
faceted_brep | TopoDS_Solid | |
manifold_solid_brep | TopoDS_Solid | |
Surface Models | ||
shell_based_surface_model | TopoDS_Compound | shell_based_surface_model is translated into one or more TopoDS_Shell grouped in a TopoDS_Compound |
geometric_set | TopoDS_Compound | TopoDS_Compound contains only TopoDS_Faces, TopoDS_Wires, TopoDS_Edges and/or TopoDS_Vertices. |
Wireframe Models | ||
geometric_curve_set | TopoDS_Compound | TopoDS_Compound contains only TopoDS_Wires, TopoDS_Edges and/or TopoDS_Vertices. |
Topology | STEP entity type | CASCADE shape | Comments |
---|---|---|---|
Vertices | vertex_point | TopoDS_Vertex | |
Edges | oriented_edge | TopoDS_Edge | |
edge_curve | TopoDS_Edge | ||
Loops | face_bound | TopoDS_Wire | |
face_outer_bound | TopoDS_Wire | ||
edge_loop | TopoDS_Wire | ||
poly_loop | TopoDS_Wire | Each segment of poly_loop is translated into TopoDS_Edge with support of Geom_Line | |
vertex_loop | TopoDS_Wire | Resulting TopoDS_Wire contains only one degenerated TopoDS_Edge | |
Faces | face_surface | TopoDS_Face | |
advanced_face | TopoDS_Face | ||
Shells | connected_face_set | TopoDS_Shell | |
oriented_closed_shell | TopoDS_Shell | ||
closed_shell | TopoDS_Shell | ||
open_shell | TopoDS_Shell |
3D STEP entities are translated into geometrical objects from the Geom package while 2D entities are translated into objects from the Geom2d package.
Geometry | STEP entity type | CASCADE object | Comments |
---|---|---|---|
Points | cartesian_point | Geom_CartesianPoint, Geom2d_CartesianPoint | |
Directions | direction | Geom_Direction, Geom2d_Direction | |
Vectors | vector | Geom_VectorWithMagnitude, Geom2d_VectorWithMagnitude | |
Placements | axis1_placement | Geom_Axis1Placement | |
axis2_placement_2d | Geom2d_AxisPlacement | ||
axis2_placement_3d | Geom_Axis2Placement | ||
Curves | circle | Geom_Circle, Geom2d_Circle, Geom2d_BsplineCurve | Circle is translated into Geom2d_BSplineCurve when it references the surface of revolution (spherical surface, conical surface, etc.) |
ellipse | Geom_Ellipse, Geom2d_Ellipse, Geom2d_BsplineCurve | Ellipse is translated into Geom2d_BSplineCurve when it references the surface of revolution (spherical surface, conical surface, etc.) | |
hyperbola | Geom_Hyperbola, Geom2d_Hyperbola | ||
line | Geom_Line, Geom2d_Line | ||
parabola | Geom_Parabola, Geom2d_Parabola | ||
pcurve | Geom2d_Curve | Pcurve in edge | |
curve_replica | Geom_Curve or Geom2d_Curve | Depending on the type of the base curve | |
offset_curve_3d | Geom_OffsetCurve | ||
trimmed_curve | Geom_TrimmedCurve or Geom2d_BsplineCurve | Only trimmed_curves trimmed by parameters are translated. All trimmed_curves are converted to Geom2d_BSplineCurve. | |
b_spline_curve | Geom_BsplineCurve or Geom2d_BsplineCurve | ||
b_spline_curve_with_knots | Geom_BsplineCurve or Geom2d_BsplineCurve | ||
bezier_curve | Geom_BsplineCurve or Geom2d_BsplineCurve | ||
rational_b_spline_curve | Geom_BsplineCurve or Geom2d_BsplineCurve | ||
uniform_curve | Geom_BsplineCurve or Geom2d_BsplineCurve | ||
quasi_ uniform_curve | Geom_BsplineCurve or Geom2d_BsplineCurve | ||
surface_curve | TopoDS_Edge | surface_curve defines geometrical support of an edge and its pcurves. | |
seam_curve | TopoDS_Edge | The same as surface_curve | |
composite_curve_segment | TopoDS_Edge | as a segment of composite_curve | |
composite_curve | TopoDS_Wire | ||
composite_curve_on_surface | TopoDS_Wire | ||
boundary_curve | TopoDS_Wire | ||
Surfaces | b_spline_surface | Geom_BsplineSurface | |
b_spline_surface_with_knots | Geom_BsplineSurface | ||
bezier_surface | Geom_BSplineSurface | ||
conical_surface | Geom_ConicalSurface | ||
cylindrical_surface | Geom_CylindricalSurface | ||
offset_surface | Geom_OffsetSurface | ||
surface_replica | Geom_Surface | Depending on the type of basis surface | |
plane | Geom_Plane | ||
rational_b_spline_surface | Geom_BSplineSurface | ||
rectangular_trimmed_surface | Geom_RectangularTrimmedSurface | ||
spherical_surface | Geom_SphericalSurface | ||
surface_of_linear_extrusion | Geom_SurfaceOfLinearExtrusion | ||
surface_of_revolution | Geom_SurfaceOfRevolution | ||
toroidal_surface | Geom_ToroidalSurface | ||
degenerate_toroidal_surface | Geom_ToroidalSurface | ||
uniform_surface | Geom_BSplineSurface | ||
quasi_uniform_surface | Geom_BSplineSurface | ||
rectangular_composite_surface | TopoDS_Compound | Contains TopoDS_Faces | |
curve_bounded_surface | TopoDS_Face |
During the STEP = OCCT translation several parameters are used as tolerances and precisions for different algorithms. Some of them are computed from other tolerances using specific functions.
In the STEP processor, the basic value of tolerance is set in method STEPControl_ActorRead::Transfer() to either value of uncertainty in shape_representation in STEP file (if parameter read.precision.mode is 0), or to a value of parameter read.precision.val (if read.precision.mode is 1 or if the uncertainty is not attached to the current entity in the STEP file).
Translation starts from one entity translated as a root. STEPControl_ActorRead::Transfer(), function which performs the translation creates an object of the type StepToTopoDS_Builder, which is intended to translate topology.
This object gets the initial tolerance value that is equal to read.precision.val or the uncertainty from shape_representation. During the translation of the entity, new objects of types StepToTopoDS_Translate... are created for translating sub-entities. All of them use the same tolerances as a StepToTopoDS_Builder object.
Let us follow the evolution of tolerances during the translation of STEP entities into an OCCT shape.
If the starting STEP entity is a geometric_curve_set all the edges and vertices are constructed with Precision::Confusion().
If the starting STEP entity is not a geometric_curve_set the sub-shapes of the resulting shape have the following tolerance:
So, the final tolerance of sub-shapes shows the real local geometry of shapes (distance between vertices of adjacent edges, deviation of a 3D curve of an edge and its parametric curves and so on) and may be less or greater than the basic value of tolerance in the STEP processor.
Geometrical entities are translated by classes StepToGeom_Make... Methods of these classes translate STEP geometrical entities into OCCT geometrical objects. Since these objects are not BRep objects, they do not have tolerances. Tolerance is used only as precision for detecting bad cases (such as points coincidence).
STEP topological entities are translated into OCCT shapes by use of classes from package StepToTopoDS.
Although in a STEP file the uncertainty value is assigned to shape_representation entities and this value is applied to all entities in this shape_representation, OCCT shapes are produced with different tolerances. As a rule, updating the tolerance is fulfilled according to the local geometry of shapes (distance between vertices of adjacent edges, deviation of edge's 3D curve and its parametric curves and so on) and may be either less or greater than the uncertainty value assigned to the entity.
The following default tolerances are used when creating shapes and how they are updated during translation.
This method is intended for detecting and fixing self-intersecting edges and intersections of adjacent edges in a wire. It fixes self-intersections by cutting edges at the intersection point and/or by increasing the tolerance of the vertex (so that the vertex comprises the point of intersection). There is a maximum tolerance that can be set by this method transmitted as a parameter, currently is read.maxprecision.value.
When a self-intersection of one edge is found, it is fixed by one of the two methods:
The method producing a smaller tolerance is selected.
When an intersection of two adjacent edges is detected, edges are cut at that point. Tolerance of the common vertex of these edges is increased in order to comprise both the intersection point and the old position.
This method can increase the tolerance of the vertex up to a value of read.maxprecision.value.
This method is intended to detect gaps between pcurves of adjacent edges (with the precision of surface UVResolution computed from tolerance of a corresponding vertex) and to fix these gaps either by increasing the tolerance of the vertex, or by inserting a new degenerated edge (straight in parametric space).
If it is possible to compensate a gap by increasing the tolerance of the vertex to a value of less than the initial value of tolerance, the tolerance of the vertex is increased. Else, if the vertex is placed in a degenerated point then a degenerated edge is inserted.
This method is intended to force two adjacent edges in the wire to share the same vertex. This method can increase the tolerance of the vertex. The maximal value of tolerance is read.maxprecision.value.
The following diagram illustrates the structure of calls in reading STEP. The highlighted classes are intended to translate geometry
You can translate OCCT shapes into STEP entities in the following steps: 1.initialize the process, 2.set the translation parameters, 3.perform the shape translation, 4.write the output file.
You can translate several shapes before writing a file. All these translations output a separate shape_representation entity in STEP file.
The user-defined option (parameter write.step.schema) is provided to define which version of schema (AP214 CD or DIS, or AP203) is used for the output STEP file.
There are two families of OCCT objects that can be translated:
The shapes organized in a structure of nested compounds can be translated either as simple compound shapes, or into the assembly structure, depending on the parameter write.step.assembly, which is described below.
The assembly structure placed in the produced STEP file corresponds to the structure described in the ProSTEP Agreement Log (item 21) as the second alternative (assembly structure through representation_relationship / item_defined_transformation). To represent an assembly it uses entities of the representation_relationship_with_transformation type. Transformation operators used for locating assembly components are represented by item_defined_transformation entities. If mode ;write.step.assembly; is set to the values ON or Auto then an OCC shape consisting of nested compounds will be written as an assembly, otherwise it will be written as separate solids.
Please see also Mapping OCCT shapes to STEP entities
Before performing any other operation you have to create a writer object:
The following parameters are used for the OCCT-to-STEP translation.
writes the precision value.
Read this parameter with:
Standard_Integer ic = Interface_Static::IVal("write.precision.mode"); Modify this parameter with:
Default value is 0.
a user-defined precision value. This parameter gives the uncertainty for STEP entities constructed from OCCT shapes when the write.precision.mode parameter value is 1.
This value is stored in shape_representation in a STEP file as an uncertainty.
Read this parameter with:
Modify this parameter with:
Default value is 0.0001.
writing assembly mode.
Read this parameter with:
Modify this parameter with:
Default value is 0.
defines the version of schema used for the output STEP file:
Read this parameter with:
Modify this parameter with:
Default value is 1 (;CD;). For the parameter write.step.schema to take effect, method STEPControl_Writer::Model(Standard_True) should be called after changing this parameter (corresponding command in DRAW is newmodel).
Defines the text string that will be used for field ‘name’ of PRODUCT entities written to the STEP file.
Default value: OCCT STEP translator (current OCCT version number).
This parameter indicates whether parametric curves (curves in parametric space of surface) should be written into the STEP file. This parameter can be set to Off in order to minimize the size of the resulting STEP file.
Read this parameter with:
Modify this parameter with:
Default value is On.
Defines a unit in which the STEP file should be written. If set to unit other than MM, the model is converted to these units during the translation.
Default value is MM.
These two parameters define the name of the resource file and the name of the sequence of operators (defined in that file) for Shape Processing, which is automatically performed by the STEP translator before translating a shape to a STEP file. Shape Processing is a user-configurable step, which is performed before the translation and consists in applying a set of operators to a resulting shape. This is a very powerful tool allowing customizing the shape and adapting it to the needs of a receiving application. By default the sequence consists of two operators: SplitCommonVertex and DirectFaces, which convert some geometry and topological constructs valid in Open CASCADE Technology but not in STEP to equivalent definitions conforming to STEP format.
See description of parameter read.step.resource.name above for more details on using resource files.
Default values:
An OCCT shape can be translated to STEP using one of the following models (shape_representations):
The enumeration **TEPControl_StepModelType* is intended to define a particular transferring model. The following values of enumeration are allowed:
The following list shows which shapes can be translated in which mode:
If TopoDS_Compound contains any other types besides the ones mentioned in the table, these sub-shapes will be ignored.
In case if an OCCT shape cannot be translated according to its mode the result of translation is void.
Write the STEP file with:
to give the file name.
Only STEP entities that have a corresponding OCCT object and mapping of assembly structures are described in this paragraph. For a full list of STEP entities please refer to Appendix A.
The assembly structures are written to the STEP file if parameter write.step.assembly is 1 or 2. Each TopoDS_Compound is written as an assembly with subshapes of that compound being components of the assembly. The structure of nested compounds is translated to the structure of nested assemblies. Shared subshapes are translated into shared components of assemblies. Shapes that are not compounds are translated into subtypes of shape_representation according to their type (see the next subchapter for details).
A set of STEP entities describing general product information is written to the STEP file together with the entities describing the product geometry, topology and assembly structure. Most of these entities are attached to the entities being subtypes of shape_representation, but some of them are created only one per STEP file.
The table below describes STEP entities, which are created when the assembly structure and product information are written to the STEP file, and shows how many of these entities are created. Note that the appearance of some of these entities depends on the version of the schema (AP214, CD, DIS or IS, or AP203).
CASCADE shape | STEP entity | Comments |
---|---|---|
application_protocol_definition | One per STEP file, defines the application protocol used (depends on the schema version) | |
application_context | One per STEP file, defines the application generating the file (AP214 or AP203) | |
TopoDS_Compound | shape_representation | Empty shape_representation describing the assembly. The components of that assembly are written as subtypes of shape_representation and are included to the assembly using next_assembly_usage_occurence entities. |
TopoDS_Shape | subtypes of shape_representation | Depending on the shape type, see the tables below for mapping details |
next_assembly_usage_occurence | Describes the instance of component in the assembly by referring corresponding product_definitions. If the same component is included in the assembly several times (for example, with different locations), several next_assembly_usage_occurences are created. | |
context_dependent_shape_representation | Describes the placement of a component in the assembly. One context_dependent_shape_representation corresponds to each next_assembly_usage_occurence entity. | |
shape_representation_relationship_with_transformation | Together with the context_dependent_shape_representation describes the location of a component in the assembly. | |
item_defined_transformation | Defines a transformation used for the location of a component in the assembly. Is referred by shape_representation_relationship_with_transformation. | |
shape_definition_representation | One per shape_representation. | |
product_definition_shape | One per shape_definition_representation and context_dependent_shape_representation | |
product_definition | Defines a product, one per shape_definition_representation | |
product_definition_formation | One per product_definition. All product_definition_formations in the STEP file have unique names. | |
Product | One per product_definition_formation. All products in the STEP file have unique names. | |
product_type (CD) or product_related_product_category (DIS,IS) | One per product | |
Mechanical_context (CD) or product_context (DIS,IS) | One per product. | |
product_definition_context | One per product_definition. |
CASCADE shape | STEP entity | Comments |
---|---|---|
TopoDS_Compound | geometric_curve_set | If the write mode is STEP214Control_GeometricCurveSet only 3D curves of the edges found in TopoDS_Compound and all its subshapes are translated |
manifold_solid_brep | If the write mode is STEP214Control_AsIs and TopoDS_Compound consists only of TopoDS_Solids. | |
shell_based_surface_model | If the write mode is STEP214Control_AsIs and TopoDS_Compound consists of TopoDS_Solids, TopoDS_Shells and TopoDS_Faces. | |
geometric_curve_set | If the write mode is STEP214Control_AsIs and TopoDS_Compound contains TopoDS_Wires, TopoDS_Edges, TopoDS_Vertices. If the write mode is not STEP214Control_AsIs or STEP214Control_GeometricCurveSet, TopoDS_Solids, TopoDS_Shells and TopoDS_Faces are translated according to this table. | |
TopoDS_Solid | manifold_solid_brep | If the write mode is STEP214Control_AsIs or STEP214Control_ManifoldSolidBrep and CASCADE TopoDS_Solid has no voids. |
faceted_brep | If the write mode is STEP214Control_FacetedBrep. | |
brep_with_voids | If the write mode is STEP214Control_AsIs or STEP214Control_ManifoldSolidBrep and CASCADE TopoDS_Solid has voids. | |
shell_based_surface_model | If the write mode is STEP214Control_ShellBasedSurfaceModel. | |
geometric_curve_set | If the write mode is STEP214Control_GeometricCurveSet. Only 3D curves of the edges are translated. | |
TopoDS_Shell in a TopoDS_Solid | closed_shell | If TopoDS_Shell is closed shell. |
TopoDS_Shell | manifold_solid_brep | If the write mode is STEP214Control_ManifoldSolidBrep. |
shell_based_surface_model | If the write mode is STEP214Control_AsIs or STEP214Control_ShellBasedSurfaceModel. | |
geometric_curve_set | If the write mode is STEP214Control_GeometricCurveSet. Only 3D curves of the edges are translated. | |
TopoDS_Face | advanced_face | |
TopoDS_Wire in a TopoDS_Face | face_bound | The resulting face_bound contains poly_loop if write mode is faceted_brep or edge_loop if it is not. |
TopoDS_Wire | geometric_curve_set | If the write mode is STEP214Control_GeometricCurveSet. Only 3D curves of the edges are translated. |
TopoDS_Edge | oriented_edge | |
TopoDS_Vertex | vertex_point |
Geometry | CASCADE object | STEP entity | Comments |
---|---|---|---|
Points | Geom_CartesianPoint, Geom2d_CartesianPoint | cartesian_point | |
TColgp_Array1OfPnt, TColgp_Array1OfPnt2d | polyline | ||
Placements | Geom_Axis1Plasement, Geom2d_AxisPlacement | axis1_placement | |
Geom_Axis2Placement | axis2_placement_3d | ||
Directions | Geom_Direction, Geom2d_Direction | direction | |
Vectors | Geom_Vector, Geom2d_Vector | vector | |
Curves | Geom_Circle | circle | |
Geom2d_Circle | circle, rational_b_spline_curve | ||
Geom_Ellipse | Ellipse | ||
Geom2d_Ellipse | Ellipse, rational_b_spline_curve | ||
Geom_Hyperbola, Geom2d_Hyperbola | Hyperbola | ||
Geom_Parabola, Geom2d_Parabola | Parabola | ||
Geom_BSplineCurve | b_spline_curve_with_knots or rational_b_spline_curve | rational_b_spline_curve is produced if Geom_BsplineCurve is a rational BSpline | |
Geom2d_BSplineCurve | b_spline_curve_with_knots or rational_b_spline_curve | rational_b_spline_curve is produced if Geom2d_BsplineCurve is a rational BSpline | |
Geom_BezierCurve | b_spline_curve_with_knots | ||
Geom_Line or Geom2d_Line | Line | ||
Surfaces | Geom_Plane | Plane | |
Geom_OffsetSurface | offset_surface | ||
Geom_ConicalSurface | conical_surface | ||
Geom_CylindricalSurface | cylindrical_surface | ||
Geom_OffsetSurface | offset_surface | ||
Geom_RectangularTrimmedSurface | rectangular_trimmed_surface | ||
Geom_SphericalSurface | spherical_surface | ||
Geom_SurfaceOfLinear Extrusion | surface_of_linear_extrusion | ||
Geom_SurfaceOf Revolution | surface_of_revolution | ||
Geom_ToroidalSurface | toroidal_surface or degenerate_toroidal_surface | degenerate_toroidal_surface is produced if the minor radius is greater then the major one | |
Geom_BezierSurface | b_spline_surface_with_knots | ||
Geom_BsplineSurface | b_spline_surface_with_knots or rational_b_spline_surface | rational_b_spline_surface is produced if Geom_BSplineSurface is a rational Bspline |
There are four possible values for the uncertainty when writing a STEP file:
The chosen value of the uncertainty is the final value that will be written into the STEP file. See parameter write.precision.mode.
The following diagram illustrates the structure of calls in writing STEP. The highlighted classes are intended to translate geometry.
To perform data loading from a STEP file and to translate this data it is necessary to create correspondence between the EXPRESS schema and the structure of CDL classes. There are two possibilities to organize such correspondence: the so-called early binding and late binding.
The STEP processor is based on early binding principles. It means that specific classes for each EXPRESS type have been created with the help of an automatic tool from the EXPRESS schema. There are two CDL classes for each EXPRESS type. The first class (named the representing class) represents the STEP entity in memory. The second one (RW - class) is intended to perform the initialization of the representing class and to output data to an intermediate structure to be written in a STEP file.
EXPRESS schema allows multiple inheritance. Entities that are built on the basis of multiple inheritance are called complex entities. Multiple inheritance is not available in CDL. EXPRESS enables any type of complex entities that can be inherited from any EXPRESS type. In the manner of early binding it is not possible to create a CDL class for any possible complex type. Thus, only widespread complex entities have corresponding representing classes and RW-classes that are created manually beforehand.
Physical file reading consists of the following steps: 1.Loading a STEP file and syntactic analysis of its contents 2.Mapping STEP entities to the array of strings 3.Creating empty OCCT objects representing STEP entities 4.Initializing OCCT objects 5.Building a references graph
In the first phase, a STEP file is syntactically checked and loaded in memory as a sequence of strings.
Syntactic check is performed on the basis of rules defined in step.lex and step.yacc files. Files step.lex and step.yacc are located in the StepFile nocdlpack development unit. These files describe text encoding of STEP data structure (for additional information see ISO 10303 Part 21). The step.lex file describes the lexical structure of the STEP file. It describes identifiers, numbers, delimiters, etc. The step.yacc file describes the syntactic structure of the file, such as entities, parameters, and headers.
These files have been created only once and need to be updated only when norm ISO 10303-21 is changed.
For each entity specified by its rank number the arrays storing its identifier, STEP type and parameters are filled.
For each STEP entity an empty OCCT object representing this entity is created. A map of correspondence between entity rank and OCCT object is created and filled out. If a STEP entity is not recognized by the STEP processor then the StepData_UndefinedEntity object is created.
Each OCCT object (including StepData_UndefinedEntity) is initialized by its parameters with the help of the appropriate RW - class. If some entity has another entity as its parameter, the object that represents the latter entity will be initialized immediately. All initialized objects are put into a special map to avoid repeated initialization.
The final phase is building a graph of references between entities. For each entity its RW-class is used to find entities referenced by this entity. Back references are built on the basis of direct references. In addition to explicit references defined in the STEP entities some additional (implicit) references are created for entities representing assembly structures (links from assemblies to their components).
If it is necessary to read and translate a new entity by the STEP processor the Reader and Actor scope should be enhanced. Note that some actions to be made for adding a new type are different for simple and complex types. The following steps should be taken:
Physical file writing consists of the following steps:
If it is necessary to write and translate an OCCT shape into a new entity by the STEP processor the Writer and Actor scope should be enhanced.
For a description of steps, which should be taken for adding a new entity type to the STEP processor, see Physical file reading. Then, enhance the STEPControl_ActorWrite class i.e. methods Recognize() and Transfer(), or other classes from TopoDSToStep, to translate the OCCT shape into a new STEP entity.
TKXSDRAW toolkit provides commands for testing XSTEP interfaces interactively in the DRAW environment. It provides an additional set of DRAW commands specific for data exchange tasks, which allows loading and writing data files and an analysis of the resulting data structures and shapes.
This section is divided into five parts. Two of them deal with reading and writing a STEP file and are specific for the STEP processor. The first and the forth parts describe some general tools for setting parameters and analyzing the data. Most of them are independent of the norm being tested. Additionally, a table of mentioned DRAW commands is provided.
In the description of commands, square brackets ([]) are used to indicate optional parameters. Parameters given in the angle brackets (<>) and sharps (#) are to be substituted by an appropriate value. When several exclusive variants are possible, a vertical dash (|) is used.
A set of parameters for importing and exporting STEP data is defined in the XSTEP resource file. In XSDRAW, these parameters can be viewed or changed using the command
Command param with no arguments gives a list of all parameters with their values. When the argument parameter_name is specified, information about this parameter is printed (current value and short description).
The third argument is used to set a new value of the given parameter. The result of the setting is printed immediately.
During all interface operations, the protocol of the process (fail and warning messages, mapping of loaded entities into OCCT shapes etc.) can be output to the trace file. Two parameters are defined in the DRAW session: trace level (integer value from 0 to 9, default is 0), and trace file (default is standard output).
Command xtrace is intended to view and change these parameters:
For a description of parameters used in reading a STEP file refer to Setting the translation parameters section.
For reading a STEP file, the following parameters are defined (see above, the command param):
Description | Name | Values | Meaning |
---|---|---|---|
Precision for input entities | read.precision.mode | 0 or 1 | If 0 (File), precision of the input STEP file will be used for the loaded shapes; If 1 (Session), the following parameter will be used as the precision value. |
read.precision.val | real | Value of precision (used if the previous parameter is 1) | |
Surface curves | read.surfacecurve.mode | 0 or 3 | Defines a preferable way of representing surface curves (2d or 3d representation). If 0, no preference. |
Maximal tolerance | read.maxprecision.mode | 0 or 1 | If 1, maximum tolerance is used as a rigid limit If 0, maximum tolerance is used as a limit but can be exceeded by some algorithms. |
read.maxprecision.val | real | Value of maximum precision |
It is possible either only to load a STEP file into memory (i.e. fill the InterfaceModel with data from the file), or to read it (i.e. load and convert all entities to OCCT shapes). Loading is done by the command
Once the file is loaded, it is possible to investigate the structure of the loaded data. To find out how you do it, look in the beginning of the analysis subsection. Reading a STEP file is done by the command
Here a dot can be used instead of a filename if the file is already loaded by xload or stepread. The optional selection (see below for a description of selections) specifies a set of entities to be translated. If an asterisk `*' is given, all transferable roots are translated. If a selection is not given, the user is prompted to define a scope of transfer interactively:
N | Mode | Description |
---|---|---|
0 | End | Finish transfer and exit stepread |
1 | root with rank 1 | Transfer first root |
2 | root by its rank | Transfer root specified by its rank |
3 | One entity | Transfer entity with a number provided by the user |
4 | Selection | Transfer only entities contained in selection |
During the STEP translation, a map of correspondence between STEP entities and OCCT shapes is created.
To get information on the result of translation of a given STEP entity use the command Draw:> tpent #.
To create an OCCT shape, corresponding to a STEP entity, use the command Draw:> tpdraw #. To get the number of a STEP entity, corresponding to an OCCT shape, use the command Draw:> fromshape <shape_name>.
To clear the map of correspondences between STEP entities and OCCT shapes use the command Draw:> tpclear.
The procedure of analysis of data import can be divided into two stages: 1.to check the file contents, 2.to estimate the translation results (conversion and validated ratios).
General statistics on the loaded data can be obtained by using the command Draw:> data <symbol> Information printed by this command depends on the symbol specified:
There is a set of special objects, which can be used to operate with a loaded model. They can be of the following types:
A list of these objects defined in the current session can be printed in DRAW by command Draw:> listitems.
Command Draw:> givelist <selection_name> prints a list of a subset of loaded entities defined by the <selection> argument:
The command listtypes gives a list of entity types, which were encountered in the last loaded file (with a number of STEP entities of each type).
The list cannot be shown for all entities but for a subset of them. This subset is defined by an optional selection argument (for the list of possible values for STEP, see the table above).
Two commands are used to calculate statistics on the entities in the model:
The former only prints a count of entities while the latter also gives a list of them.
The optional selection argument, if specified, defines a subset of entities, which are to be taken into account. The first argument should be one of the currently defined counters:
Entities in the STEP file are numbered in the succeeding order. An entity can be identified either by its number or by its label. Label is the letter # followed by the rank.
Information about product names, next_assembly_usage_occurence, shape_definition_representation, context_dependent_shape_representation or mapped_item entities that are involved into the assembly structure will be printed.
All the following commands are available only after data is converted into OCCT shapes (i.e. after command 214read).
Command Draw:> tpstat [*|?]<symbol> [<selection>] is provided to get all statistics on the last transfer, including a list of transferred entities with mapping from STEP to OCCT types, as well as fail and warning messages. The parameter <symbol> defines what information will be printed:
The sign * before parameters n, s, b, t, r makes it work on all entities (not only on roots).
The sign ? before n, s, b, t limits the scope of information to invalid entities.
Optional argument <selection> can limit the action of the command to the selection, not to all entities.
To get help, run this command without arguments.
The command Draw:> tpstat *1 gives statistics on the result of translation of different types of entities (taking check messages into account) and calculates summary translation ratios.
To get information on OCCT shape contents use command Draw:> statshape <shape_name> . It outputs the number of each kind of shapes (vertex, edge, wire, etc.) in the shape and some geometrical data (number of C0 surfaces, curves, indirect surfaces, etc.).
The number of faces is returned as a number of references. To obtain the number of single instances, the standard command (from TTOPOLOGY executable) nbshapes can be used.
To analyze the internal validity of the shape, use command Draw:> checkbrep <shape_name> <expurged_shape_name>. It checks shape geometry and topology for different cases of inconsistency, like self-intersecting wires or wrong orientation of trimming contours. If an error is found, it copies bad parts of the shape with the names expurged_subshape_name _# and generates an appropriate message. If possible this command also tries to find STEP entities the OCCT shape was produced from.
<expurged_shape_name> will contain the original shape without invalid subshapes. To get information on tolerances of the shape use command Draw:> tolerance <shape_name> [<min> [<max>] [<symbol>]] . It outputs maximum, average and minimum values of tolerances for each kind of subshapes having tolerances and for the whole shape in general.
When specifying min and max arguments this command saves shapes with tolerances in the range [min, max] with names shape_name_... and gives their total number.
<Symbol> is used for specifying the kind of sub-shapes to analyze:
For writing shapes to a STEP file, the following parameters are defined (see above, the command param):
Description | Name | Values | Meaning |
---|---|---|---|
Uncertainty for resulting entities | Write.precision.mode | -1, 0, 1 or 2 | If -1 the uncertainty value is set to the minimal tolerance of CASCADE subshapes. If 0 the uncertainty value is set to the average tolerance of CASCADE subshapes. If 1 the uncertainty value is set to the maximal tolerance of CASCADE subshapes. If 2 the uncertainty value is set to write.precision.val |
Value of uncertainty | Write.precision.val | real | Value of uncertainty (used if previous parameter is 2). |
Several shapes can be written in one file. To start writing a new file, enter command Draw:> newmodel. Actually, command newmodel will clear the InterfaceModel to empty it, and the next command will convert the specified shape to STEP entities and add them to the InterfaceModel:
The following modes are available :
After a successful translation, if file_name parameter is not specified, the procedure asks you whether to write a STEP model in the file or not:
It is necessary to call command newmodel to perform a new translation of the next OCCT shape.
The STEPCAFControl package (TKXDESTEP toolkit) provides tools to read and write STEP files to and from XDE format (see XDE User’s Guide).
In addition to the translation of shapes implemented in basic translator, it provides the following:
Before performing any other operation, you must load a STEP file with:
Loading the file only memorizes the data, it does not translate it.
This step is not obligatory. See a description of this step in section Checking the STEP file.
See a description of this step in section Setting the translation parameters.
In addition, the following parameters can be set for XDE translation of attributes:
The following function performs a translation of the whole document:
where doc is a variable which contains a handle to the output document and should have a type Handle(TDocStd_Document).
Here is how to initialize the process:
The following parameters can be set for a translation of attributes to STEP:
You can perform the translation of document by calling the function:
where doc is a variable, which contains a handle to the input document for transferring and should have a type Handle(TDocStd_Document).
Write a STEP file with:
or
where S is OStream.