0024336: Content of OCCT documentation should be updated. Iter 2
[occt.git] / dox / user_guides / iges / iges.md
CommitLineData
72b7576f 1IGES Support {#user_guides__iges}
2==================
3
e5bd0d98 4@tableofcontents
5
dba69de2 6@section occt_iges_1 Introduction
7
72b7576f 8
72b7576f 9This manual explains how to convert an IGES file to an Open CASCADE Technology (**OCCT**) shape and vice versa. It provides basic documentation on conversion. For advanced information on conversion, see our offerings on our web site at <a href="http://www.opencascade.org/support/training/">www.opencascade.org/support/training/</a>
10
11IGES files up to and including IGES version 5.3 can be read. IGES files that are produced by this interface conform to IGES version 5.3 (Initial Graphics Exchange Specification, IGES 5.3. ANS US PRO/IPO-100-1996).
dba69de2 12
72b7576f 13This manual principally deals with two OCCT classes:
14 * The Reader class, which loads IGES files and translates their contents to OCCT shapes,
15 * The Writer class, which translates OCCT shapes to IGES entities and then writes these entities to IGES files.
dba69de2 16
72b7576f 17File translation is performed in the programming mode, via C++ calls, and the resulting OCCT objects are shapes.
dba69de2 18
72b7576f 19All definitions in IGES version 5.3 are recognized but only 3D geometric entities are translated. When the processor encounters data, which is not translated, it ignores it and writes a message identifying the types of data, which was not handled. This message can be written either to a log file or to screen output.
dba69de2 20
21@section occt_iges_2 Reading IGES
22@subsection occt_iges_2_1 Procedure
72b7576f 23You can translate an IGES file to an OCCT shape by following the steps below:
24 -# Load the file,
25 -# Check file consistency,
26 -# Set the translation parameters,
27 -# Perform the file translation,
28 -# Fetch the results.
dba69de2 29@subsection occt_iges_2_2 Domain covered
30@subsubsection occt_iges_2_2_1 Translatable entities
72b7576f 31The types of IGES entities, which can be translated, are:
32 * Points
33 * Lines
34 * Curves
35 * Surfaces
36 * B-Rep entities
37 * Structure entities (groups). Each entity in the group outputs a shape. There can be a group of groups.
e5bd0d98 38 * Subfigures. Each entity defined in a sub-figure outputs a shape
72b7576f 39 * Transformation Matrix.
dba69de2 40
41**Note** that all non-millimeter length unit values in the IGES file are converted to millimeters.
42
43@subsubsection occt_iges_2_2_2 Attributes
72b7576f 44Entity attributes in the Directory Entry Section of the IGES file (such as layers, colors and thickness) are translated to Open CASCADE Technology using XDE.
dba69de2 45@subsubsection occt_iges_2_2_3 Administrative data
72b7576f 46Administrative data, in the Global Section of the IGES file (such as the file name, the name of the author, the date and time a model was created or last modified) is not translated to Open CASCADE Technology. Administrative data can, however, be consulted in the IGES file.
47
48
dba69de2 49@subsection occt_iges_2_3 Description of the process
50@subsubsection occt_iges_2_3_1 Loading the IGES file
72b7576f 51Before performing any other operation, you have to load the file using the syntax below.
dba69de2 52~~~~~
72b7576f 53IGESControl_Reader reader;
54IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
dba69de2 55~~~~~
72b7576f 56The loading operation only loads the IGES file into computer memory; it does not translate it.
dba69de2 57
58@subsubsection occt_iges_2_3_2 Checking the IGES file
72b7576f 59This step is not obligatory. Check the loaded file with:
dba69de2 60~~~~~
72b7576f 61Standard_Boolean ok = reader.Check(Standard_True);
dba69de2 62~~~~~
72b7576f 63The variable “ok is True” is returned if no fail message was found; “ok is False” is returned if there was at least one fail message.
dba69de2 64~~~~~
72b7576f 65reader.PrintCheckLoad (failsonly, mode);
dba69de2 66~~~~~
72b7576f 67Error messages are displayed if there are invalid or incomplete IGES entities, giving you information on the cause of the error.
dba69de2 68~~~~~
72b7576f 69Standard_Boolean failsonly = Standard_True or Standard_False;
dba69de2 70~~~~~
72b7576f 71If you give True, you will see fail messages only. If you give False, you will see both fail and warning messages.
dba69de2 72
73Your analysis of the file can be either message-oriented or entity-oriented. Choose your preference with *IFSelect_PrintCount mode = IFSelect_xxx*, where *xxx* can be any of the following:
74* *ItemsByEntity* gives a sequential list of all messages per IGES entity.
75* *CountByItem* gives the number of IGES entities with their types per message.
76* *ShortByItem* gives the number of IGES entities with their types per message and displays rank numbers of the first five IGES entities per message.
77* *ListByItem* gives the number of IGES entities with their type and rank numbers per message.
78* *EntitiesByItem* gives the number of IGES entities with their types, rank numbers and Directory Entry numbers per message.
79
80@subsubsection occt_iges_2_3_3 Setting translation parameters
72b7576f 81The following parameters can be used to translate an IGES file to an OCCT shape. If you give a value that is not within the range of possible values, it will be ignored.
dba69de2 82
72b7576f 83<h4>read.iges.bspline.continuity</h4>
84manages the continuity of BSpline curves (IGES entities 106, 112 and 126) after translation to Open CASCADE Technology (Open CASCADE Technology requires that the curves in a model be at least C1 continuous; no such requirement is made by IGES).
dba69de2 85* 0: no change; the curves are taken as they are in the IGES file. C0 entities of Open CASCADE Technology may be produced.
86* 1: if an IGES BSpline, Spline or CopiousData curve is C0 continuous, it is broken down into pieces of C1 continuous *Geom_BSplineCurve*.
87* 2: This option concerns IGES Spline curves only. IGES Spline curves are broken down into pieces of C2 continuity. If C2 cannot be ensured, the Spline curves will be broken down into pieces of C1 continuity.
88
72b7576f 89Read this parameter with:
dba69de2 90~~~~~
91Standard_Integer ic = Interface_Static::IVal("read.iges.bspline.continuity");
92~~~~~
72b7576f 93Modify this value with:
dba69de2 94~~~~~
95if (!Interface_Static::SetIVal ("read.iges.bspline.continuity",2))
72b7576f 96.. error ..;
dba69de2 97~~~~~
72b7576f 98Default value is 1.
dba69de2 99
100This parameter does not change the continuity of curves that are used in the construction of IGES BRep entities. In this case, the parameter does not influence the continuity of the resulting OCCT curves (it is ignored).
101
102
72b7576f 103<h4>read.precision.mode</h4>
104reads the precision value.
dba69de2 105* File (0) the precision value is read in the IGES file header (default).
106* User (1) the precision value is that of the read.precision.val parameter.
107
72b7576f 108Read this parameter with:
dba69de2 109~~~~~
110Standard_Integer ic = Interface_Static::IVal("read.precision.mode");
111~~~~~
72b7576f 112Modify this value with:
dba69de2 113~~~~~
114if (!Interface_Static::SetIVal ("read.precision.mode",1))
72b7576f 115.. error ..;
dba69de2 116~~~~~
117Default value is *File* (0).
118
72b7576f 119<h4>read.precision.val</h4>
dba69de2 120User 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.
121
72b7576f 122This value is in the measurement unit defined in the IGES file header.
dba69de2 123
72b7576f 124Read this parameter with:
dba69de2 125~~~~~
126Standard_Real rp = Interface_Static::RVal("read.precision.val");
127~~~~~
72b7576f 128Modify this parameter with:
dba69de2 129~~~~~
130if (!Interface_Static::SetRVal ("read.precision.val",0.001))
72b7576f 131.. error ..;
dba69de2 132~~~~~
72b7576f 133Default value is 0.0001.
dba69de2 134
135The value given to this parameter is a target value that is applied to *TopoDS_Vertex, TopoDS_Edge* and *TopoDS_Face* entities. The processor 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. IGES-to-OCCT translation does not improve the quality of the geometry in the original IGES file. This means that the value you enter may be impossible to attain the given quality of geometry in the IGES file.
136
137Value of tolerance used for computation is calculated by multiplying the value of *read.precision.val* and the value of coefficient of transfer from the file units to millimeters.
138
72b7576f 139<h4>read.maxprecision.mode</h4>
140defines the mode of applying the maximum allowed tolerance. Its possible values are:
dba69de2 141
142* *Preferred(0)* maximum tolerance is used as a limit but sometimes it can be exceeded (currently, only for deviation of a 3D curve of an edge from its pcurves and from vertices of such edge) to ensure shape validity;
143* *Forced(1)* maximum tolerance is used as a rigid limit, i.e. it can not be exceeded and, if this happens, tolerance is trimmed to suit the maximum-allowable value.
144
72b7576f 145Read this parameter with:
dba69de2 146~~~~~
147Standard_Integer mv = Interface_Static::IVal("read.maxprecision.mode");
148~~~~~
72b7576f 149Modify this parameter with:
dba69de2 150~~~~~
151if (!Interface_Static::SetIVal ("read.maxprecision.mode",1))
72b7576f 152.. error ..;
dba69de2 153~~~~~
154Default value is *Preferred (0)*.
72b7576f 155
156<h4>read.maxprecision.val</h4>
dba69de2 157defines the maximum allowable tolerance (in mm) of the shape. It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*). Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
72b7576f 158Read this parameter with:
dba69de2 159~~~~~
160Standard_Real rp = Interface_Static::RVal("read.maxprecision.val");
161~~~~~
72b7576f 162Modify this parameter with:
dba69de2 163~~~~~
164if (!Interface_Static::SetRVal ("read.maxprecision.val",0.1))
72b7576f 165.. error ..;
dba69de2 166~~~~~
72b7576f 167Default value is 1.
168
169<h4>read.stdsameparameter.mode</h4>
dba69de2 170defines the using of *BRepLib::SameParameter*. Its possible values are:
171* 0 (Off) - *BRepLib::SameParameter* is not called,
172* 1 (On) - *BRepLib::SameParameter* is called.
173*BRepLib::SameParameter* is used through *ShapeFix_Edge::SameParameter*. It ensures that the resulting edge will have the lowest tolerance taking pcurves either unmodified from the IGES file or modified by *BRepLib::SameParameter*.
72b7576f 174Read this parameter with:
dba69de2 175~~~~~
176Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode");
177~~~~~
72b7576f 178Modify this parameter with:
dba69de2 179~~~~~
180if (!Interface_Static::SetIVal ("read.stdsameparameter.mode",1))
72b7576f 181.. error ..;
dba69de2 182~~~~~
183Deafault value is 0 (Off).
72b7576f 184
185<h4>read.surfacecurve.mode</h4>
186preference for the computation of curves in case of 2D/3D inconsistency in an entity which has both 2D and 3D representations.
dba69de2 187
188Here we are talking about entity types 141 (Boundary), 142 (CurveOnSurface) and 508 (Loop). These are entities representing a contour lying on a surface, which is translated to a *TopoDS_Wire*, formed by *TopoDS_Edges*. Each *TopoDS_Edge* must have a 3D curve and a 2D curve that reference the surface.
189
72b7576f 190The processor also decides to re-compute either the 3D or the 2D curve even if both curves are translated successfully and seem to be correct, in case there is inconsistency between them. The processor considers that there is inconsistency if any of the following conditions is satisfied:
191 * the number of sub-curves in the 2D curve is different from the number of sub-curves in the 3D curve. This can be either due to different numbers of sub-curves given in the IGES file or because of splitting of curves during translation.
dba69de2 192 * 3D or 2D curve is a Circular Arc (entity type 100) starting and ending in the same point (note that this case is incorrect according to the IGES standard).
193
194The parameter *read.surfacecurve.mode* defines which curve (3D or 2D) is used for re-computing the other one:
195* *Default(0)* use the preference flag value in the entity's Parameter Data section. The flag values are:
72b7576f 196 * 0: no preference given,
197 * 1: use 2D for 142 entities and 3D for 141 entities,
198 * 2: use 3D for 142 entities and 2D for 141 entities,
199 * 3: both representations are equally preferred.
dba69de2 200* *2DUse_Preferred (2)* : the 2D is used to rebuild the 3D in case of their inconsistency,
bf62b306 201* *2DUse_Forced (-2)*: the 2D is always used to rebuild the 3D (even if 3D is present in the file),
dba69de2 202* *3DUse_Preferred (3)*: the 3D is used to rebuild the 2D in case of their inconsistency,
203* *3DUse_Forced (-3)*: the 3D is always used to rebuild the 2D (even if 2D is present in the file),
204
205If no preference is defined (if the value of *read.surfacecurve.mode* is *Default* and the value of the preference flag in the entity's Parameter Data section is 0 or 3), an additional analysis is performed.
206
72b7576f 207The 3D representation is preferred to the 2D in two cases:
208 * if 3D and 2D contours in the file have a different number of curves,
209 * if the 2D curve is a Circular Arc (entity type 100) starting and ending in the same point and the 3D one is not.
dba69de2 210
72b7576f 211In any other case, the 2D representation is preferred to the 3D.
212
213If either a 3D or a 2D contour is absent in the file or cannot be translated, then it is re-computed from another contour. If the translation of both 2D and 3D contours fails, the whole curve (type 141 or 142) is not translated. If this curve is used for trimming a face, the face will be translated without this trimming and will have natural restrictions.
dba69de2 214
72b7576f 215Read this parameter with:
dba69de2 216~~~~~
217Standard_Integer ic = Interface_Static::IVal("read.surfacecurve.mode");
218~~~~~
72b7576f 219Modify this value with:
dba69de2 220~~~~~
221if (!Interface_Static::SetIVal ("read.surfacecurve.mode",3))
72b7576f 222.. error ..;
dba69de2 223~~~~~
224Default value is Default (0).
225
72b7576f 226<h4>read.encoderegularity.angle</h4>
dba69de2 227This parameter is used within the *BRepLib::EncodeRegularity()* function which is called for a shape read from an IGES or a STEP file at the end of translation process. This function sets the regularity flag of an edge in a shell when this edge is shared by two faces. This flag shows the continuity, which these two faces are connected with at that edge.
228
72b7576f 229Read this parameter with:
dba69de2 230~~~~~
231Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle");
232~~~~~
72b7576f 233Modify this parameter with:
dba69de2 234~~~~~
235if (!Interface_Static::SetRVal ("read.encoderegularity.angle",0.1))
72b7576f 236.. error ..;
dba69de2 237~~~~~
72b7576f 238Default value is 0.01.
dba69de2 239
72b7576f 240<h4>read.iges.bspline.approxd1.mode</h4>
241This parameter is obsolete (it is rarely used in real practice). If set to True, it affects the translation of bspline curves of degree 1 from IGES: these curves (which geometrically are polylines) are split by duplicated points, and the translator attempts to convert each of the obtained parts to a bspline of a higher continuity.
dba69de2 242
72b7576f 243Read this parameter with:
dba69de2 244~~~~~
245Standard_Real bam = Interface_Static::CVal("read.iges.bspline.approxd1.mode");
246~~~~~
72b7576f 247Modify this parameter with:
dba69de2 248~~~~~
249if (!Interface_Static::SetRVal ("read.encoderegularity.angle","On"))
72b7576f 250.. error ..;
dba69de2 251~~~~~
72b7576f 252Default value is Off.
dba69de2 253
254
255<h4>read.iges.resource.name and read.iges.sequence</h4>
256These 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 IGES translator. The Shape Processing is a user-configurable step, which is performed after the translation and consists in application of a set of operators to a resulting shape. This is a very powerful tool allowing to customize the shape and to adapt it to the needs of a receiving application. By default, the sequence consists of a single operator *ShapeFix* that calls Shape Healing from the IGES translator.
257
258Please find an example of the resource file for IGES (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 <i>%CASROOT%/src/XSTEPResource/IGES</i> .
259
260In order for the IGES translator to use that file, you have to define the environment variable *CSF_IGESDefaults*, which should point to the directory where the resource file resides. Note that if you change parameter *read.iges.resource.name*, you should change the name of the resource file and the name of the environment variable correspondingly. The variable should contain a path to the resource file.
261
262Default values:
263* read.iges.resource.name - IGES,
264* read.iges.sequence - FromIGES.
265
72b7576f 266<h4>read.scale.unit</h4>
dba69de2 267This 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.
268
269Default value is MM.
270
72b7576f 271<h4>xstep.cascade.unit</h4>
dba69de2 272This 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.
273
72b7576f 274Default value is MM.
dba69de2 275
276@subsubsection occt_iges_2_3_4 Selecting entities
277
278A list of entities can be formed by invoking the method *IGESControl_Reader::GiveList*.
279~~~~~
72b7576f 280Handle(TColStd_HSequenceOfTransient) list = reader.GiveList();
dba69de2 281~~~~~
72b7576f 282Several predefined operators can be used to select a list of entities of a specific type.
dba69de2 283To make a selection, you use the method *IGESControl_Reader::GiveList* with the selection type in quotation marks as an argument. You can also make cumulative selections. For example, you would use the following syntax:
2841. Requesting the faces in the file:
285~~~~~
286faces = Reader.GiveList("iges-faces");
287~~~~~
2882. Requesting the visible roots in the file:
289~~~~~
290visibles = Reader.GiveList(iges-visible-roots);
291~~~~~
2923. Requesting the visible faces:
293~~~~~
294visfac = Reader.GiveList(iges-visible-roots,faces);
295~~~~~
72b7576f 296Using a signature, you can define a selection dynamically, filtering the string by means of a criterion. When you request a selection using the method GiveList, you can give either a predefined selection or a selection by signature. You make your selection by signature using the predefined signature followed by your criterion in parentheses as shown in the example below. The syntaxes given are equivalent to each other.
dba69de2 297~~~~~
72b7576f 298faces = Reader.GiveList(“xst-type(SurfaceOfRevolution)”);
299faces = Reader.GiveList(“iges-type(120)”);
dba69de2 300~~~~~
72b7576f 301You can also look for:
302 * values returned by your signature which match your criterion exactly
dba69de2 303~~~~~
72b7576f 304faces = Reader.GiveList(“xst-type(=SurfaceOfRevolution)”);
dba69de2 305~~~~~
72b7576f 306 * values returned by your signature which do not contain your criterion
dba69de2 307~~~~~
72b7576f 308faces = Reader.GiveList(“xst-type(!SurfaceOfRevolution)”);
dba69de2 309~~~~~
72b7576f 310 * values returned by your signature which do not exactly match your criterion.
dba69de2 311~~~~~
72b7576f 312faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”);
dba69de2 313~~~~~
72b7576f 314
315<h4>List of predefined operators that can be used:</h4>
dba69de2 316 * *xst-model-all* - selects all entities.
317 * *xst-model-roots* - selects all roots.
318 * *xst-transferrable-all* - selects all translatable entities.
319 * *xst-transferrable-roots* - selects all translatable roots (default).
320 * *xst-sharing + selection* - selects all entities sharing at least one entity selected by selection.
321 * *xst-shared + selection* - selects all entities shared by at least one entity selected by selection.
322 * *iges-visible-roots* - selects all visible roots, whether translatable or not.
323 * *iges-visible-transf-roots* - selects all visible and translatable roots.
324 * *iges-blanked-roots* - selects all blank roots, whether translatable or not.
325 * *iges-blanked-transf-roots* - selects all blank and translatable roots.
326 * *iges-status-independant* - selects entities whose IGES Subordinate Status = 0.
327 * *iges-bypass-group* Selects all root entities. If a root entity is a group (402/7 or 402/9), the entities in the group are selected.
328 * *iges-bypass-subfigure* Selects all root entities. If a root entity is a subfigure definition (308), the entities in the subfigure definition are selected.
329 * * iges-bypass-group-subfigure* Selects all root entities. If a root entity is a group (402/7 or 402/9) or a subfigure definition (308), the entities in the group and in the subfigure definition are selected.
330 * *iges-curves-3d* - selects 3D curves, whether they are roots or not (e.g. a 3D curve on a surface).
331 * *iges-basic-geom* - selects 3D curves and untrimmed surfaces.
332 * *iges-faces* - selects face-supporting surfaces (trimmed or not).
333 * *iges-surfaces* - selects surfaces not supporting faces (i.e. with natural bounds).
334 * *iges-basic-curves-3d* selects the same entities as iges-curves-3d. Composite Curves are broken down into their components and the components are selected.
335
336@subsubsection occt_iges_2_3_5 Performing the IGES file translation
72b7576f 337Perform translation according to what you want to translate:
dba69de2 3381. Translate an entity identified by its rank with:
339~~~~~
72b7576f 340Standard_Boolean ok = reader.Transfer (rank);
dba69de2 341~~~~~
3422. Translate an entity identified by its handle with:
343~~~~~
72b7576f 344Standard_Boolean ok = reader.TransferEntity (ent);
dba69de2 345~~~~~
3463. Translate a list of entities in one operation with:
347~~~~~
72b7576f 348Standard_Integer nbtrans = reader.TransferList (list);
349reader.IsDone();
dba69de2 350~~~~~
351where *nbtrans* returns the number of items in the list that produced a shape and *reader.IsDone()* indicates whether at least one entity was translated.
3524. Translate a list of entities, entity by entity:
353~~~~~
72b7576f 354Standard_Integer i,nb = list-Length();
dba69de2 355for (i = 1; i = nb; i ++) {
356 Handle(Standard_Transient) ent = list-Value(i);
357 Standard_Boolean OK = reader.TransferEntity (ent);
358}
359~~~~~
3605. Translate the whole file (all entities or only visible entities) with:
361~~~~~
72b7576f 362Standard_Boolean onlyvisible = Standard_True or Standard_False;
363reader.TransferRoots(onlyvisible)
dba69de2 364~~~~~
365
e5bd0d98 366@subsubsection occt_iges_2_3_6 Getting the translation results
72b7576f 367Each successful translation operation outputs one shape. A series of translations gives a series of shapes.
dba69de2 368Each time you invoke *TransferEntity, Transfer* or *Transferlist*, their results are accumulated and NbShapes increases. You can clear the results (Clear function) between two translation operations, if you do not do this, the results from the next translation will be added to the accumulation. *TransferRoots* operations automatically clear all existing results before they start.
369~~~~~
72b7576f 370Standard_Integer nbs = reader.NbShapes();
dba69de2 371~~~~~
72b7576f 372returns the number of shapes recorded in the result.
dba69de2 373~~~~~
72b7576f 374TopoDS_Shape shape = reader.Shape(num);,
dba69de2 375~~~~~
376returns the result *num,* where *num* is an integer between 1 and *NbShapes*.
377~~~~~
72b7576f 378TopoDS_Shape shape = reader.Shape();
dba69de2 379~~~~~
72b7576f 380returns the first result in a translation operation.
dba69de2 381~~~~~
72b7576f 382TopoDS_Shape shape = reader.OneShape();
dba69de2 383~~~~~
72b7576f 384returns all results in a single shape which is:
385 * a null shape if there are no results,
386 * in case of a single result, a shape that is specific to that result,
387 * a compound that lists the results if there are several results.
dba69de2 388~~~~~
72b7576f 389reader.Clear();
dba69de2 390~~~~~
72b7576f 391erases the existing results.
dba69de2 392~~~~~
72b7576f 393reader.PrintTransferInfo (failsonly, mode);
dba69de2 394~~~~~
395displays the messages that appeared during the last invocation of *Transfer* or *TransferRoots*.
396
397If *failsonly* is *IFSelect_FailOnly*, only fail messages will be output, if it is *IFSelect_FailAndWarn*, all messages will be output. Parameter “mode” can have *IFSelect_xxx* values where *xxx* can be:
398* *GeneralCount* - gives general statistics on the transfer (number of translated IGES entities, number of fails and warnings, etc)
399* *CountByItem* - gives the number of IGES entities with their types per message.
400* *ListByItem* - gives the number of IGES entities with their type and DE numbers per message.
401* *ResultCount* - gives the number of resulting OCCT shapes per type.
402* *Mapping* gives mapping between roots of the IGES file and the resulting OCCT shape per IGES and OCCT type.
403
404@subsection occt_iges_2_4 Mapping of IGES entities to Open CASCADE Technology shapes
405
406*NOTE* that IGES entity types that are not given in the following tables are not translatable.
72b7576f 407
dba69de2 408@subsubsection occt_iges_2_4_1 Points
409
e5bd0d98 410| IGES entity type | CASCADE shape | Comments |
411| :---------------- | :------------- | --------- |
412| 116: Point | TopoDS_Vertex | |
dba69de2 413
414@subsubsection occt_iges_2_4_2 Curves
415Curves, which form the 2D of face boundaries, are translated as *Geom2D_Curves* (Geom2D circles, etc.).
416
e5bd0d98 417| IGES entity type | CASCADE shape | Comments |
418| :---------------- | :------------ | :------- |
419| 100: Circular Arc | TopoDS_Edge | The geometrical support is a *Geom_Circle* or a *Geom_TrimmedCurve* (if the arc is not closed). |
420| 102: Composite Curve | TopoDS_Wire | The resulting shape is always a *TopoDS_Wire* that is built from a set of *TopoDS_Edges*. Each *TopoDS_Edge* is connected to the preceding and to the following edge by a common *TopoDS_Vertex*. |
421| 104: Conic Arc | TopoDS_Edge | The geometric support depends on whether the IGES entity's form is 0 (*Geom_Circle*), 1 (*Geom_Ellipse*), 2 (*Geom_Hyperbola*), or 3 (*Geom_Parabola*). A *Geom_TrimmedCurve* is output if the arc is not closed. |
422| 106: Copious Data | TopoDS_Edge or TopoDS_Wire | IGES entity Copious Data (type 106, forms 1-3) is translated just as the IGES entities Linear Path (106/11-13) and the Simple Closed Planar Curve (106/63). Vectors applying to forms other than 11,12 or 63 are ignored. The *Geom_BSplineCurve* (geometrical support) has C0 continuity. If the Copious Data has vectors (DataType = 3) they will be ignored. |
423| 110: Line | TopoDS_Edge | The supporting curve is a *Geom_TrimmedCurve* whose basis curve is a *Geom_Line*. |
424| 112: Parametric Spline Curve | TopoDS_Edge or TopoDS_Wire | The geometric support is a Geom_BsplineCurve. |
425| 126: BSpline Curve | TopoDS_Edge or TopoDS_Wire | |
426| 130: Offset Curve | TopoDS_Edge or TopoDS_Wire | The resulting shape is a *TopoDS_Edge* or a *TopoDS_Wire* (depending on the translation of the basis curve) whose geometrical support is a *Geom_OffsetCurve* built from a basis *Geom_Curve*. Limitation: The IGES Offset Type value must be 1. |
427| 141: Boundary | TopoDS_Wire | Same behavior as for the Curve On Surface (see below). The translation of a non-referenced Boundary IGES entity in a *BoundedSurface* IGES entity outputs a *TopoDS_Edge* or a *TopoDS_Wire* with a *Geom_Curve*. |
428| 142: Curve On Surface | TopoDS_Wire | Each *TopoDS_Edge* is defined by a 3D curve and by a 2D curve that references the surface. |
dba69de2 429
430The type of OCCT shapes (either *TopDS_Edges* or *TopoDS_Wires*) that result from the translation of IGES entities 106, 112 and 126 depends on the continuity of the curve in the IGES file and the value of the *read.iges.bspline.continuity* translation parameter.
431
432@subsubsection occt_iges_2_4_3 Surfaces
e5bd0d98 433Translation of a surface outputs either a *TopoDS_Face* or a *TopoDS_Shell*.
434If a *TopoDS_Face* is output, its geometrical support is a *Geom_Surface* and its outer and inner boundaries (if it has any) are *TopoDS_Wires*.
435
436| IGES entity type | CASCADE shape | Comments |
437| :-------------- | :------------ | :--------- |
668c2575 438| 108: Plane | TopoDS_Face | The geometrical support for the *TopoDS_Face* is a *Geom_Plane* and the orientation of its *TopoDS_Wire* depends on whether it is an outer *TopoDS_Wire* or whether it is a hole. |
439| 114: Parametric Spline Surface | TopoDS_Face | The geometrical support of a *TopoDS_Face* is a *Geom_BSplineSurface*. |
440| 118: Ruled Surface | TopoDS_Face or TopoDS_Shell | The translation of a Ruled Surface outputs a *TopoDS_Face* if the profile curves become *TopoDS_Edges*, or a *TopoDS_Shell* if the profile curves become *TopoDS_Wires*. Limitation: This translation cannot be completed when these two *TopoDS_Wires* are oriented in different directions. |
441| 120: Surface Of Revolution | TopoDS_Face or TopoDS_Shell | The translation of a Surface Of Revolution outputs: a *TopoDS_Face* if the generatrix becomes a *TopoDS_Edge*, a *TopoDS_Shell* if the generatrix becomes a *TopoDS_Wire*. The geometrical support may be: *Geom_CylindricalSurface, Geom_ConicalSurface, Geom_SphericalSurface, Geom_ToroidalSurface* or a *Geom_SurfaceOfRevolution* depending on the result of the CASCADE computation (based on the generatrix type). |
442| 122: Tabulated Cylinder | TopoDS_Face or TopoDS_Shell | The translation outputs a *TopoDS_Face* if the base becomes a *TopoDS_Edge* or a *TopoDS_Shell* if the base becomes a *TopoDS_Wire*. The geometrical support may be *Geom_Plane, Geom_Cylindrical Surface* or a *Geom_SurfaceOfLinearExtrusion* depending on the result of the CASCADE computation (based on the generatrix type). The *Geom_Surface* geometrical support is limited according to the generatrix. |
443| 128: BSpline Surface | TopoDS_Face | The geometrical support of the *TopoDS_Face* is a *Geom_BsplineSurface*. |
444| 140: Offset Surface | TopoDS_Face | The translation of an Offset Surface outputs a *TopoDS_Face* whose geometrical support is a *Geom_OffsetSurface*. Limitations: For OCCT algorithms, the original surface must be C1-continuous so that the *Geom_OffsetSurface* can be created. If the basis surface is not C1-continuous, its translation outputs a *TopoDS_Shell* and only the first *TopoDS_Face* in the *TopoDS_Shell* is offset. |
445| 143: Bounded Surface | TopoDS_Face or TopoDS_Shell | If the basis surface outputs a *TopoDS_Shell* (that has more than one *TopoDS_Face*), the IGES boundaries are not translated. Limitations: If the bounding curves define holes, natural bounds are not created. If the orientation of the contours is wrong, it is not corrected. |
446| 144: Trimmed Surface | TopoDS_Face or TopoDS_Shell | For the needs of interface processing, the basis surface must be a face. Shells are only processed if they are single-face. The contours (wires that are correctly oriented according to the definition of the IGES 142: Curve On Surface entity) are added to the face that is already created. If the orientation of the contours is wrong, it is corrected. |
447| 190: Plane Surface | TopoDS_Face | This type of IGES entity can only be used in BRep entities in place of an IGES 108 type entity. The geometrical support of the face is a *Geom_Plane*. |
dba69de2 448
449
450@subsubsection occt_iges_2_4_4 Boundary Representation Solid Entities
451
668c2575 452| IGES entity type | CASCADE shape | Comments |
453| :---------------- | :------------ | :------- |
454| 186: ManifoldSolid | TopoDS_Solid | |
455| 514: Shell | TopoDS_Shell | |
456| 510: Face | TopoDS_Face | This is the lowest IGES entity in the BRep structure that can be specified as a starting point for translation. |
457| 508: Loop | TopoDS_Wire | |
458| 504: Edge List | | |
459| 502: Vertex List | | |
dba69de2 460
461
462@subsubsection occt_iges_2_4_5 Structure Entities
463
668c2575 464| IGES entity type | CASCADE shape | Comments |
465| :---------------- | :------------ | :------- |
466| 402/1: Associativity Instance: Group with back pointers | TopoDS_Compound | |
467| 402/7: Associativity Instance: Group without back pointers | TopoDS_Compound | |
468| 402/9: Associativity Instance: Single Parent | TopoDS_Face | The translation of a *SingleParent* entity is only performed for 402 form 9 with entities 108/1 and 108/-1. The geometrical support for the *TopoDS_Face* is a *Geom_Plane* with boundaries: the parent plane defines the outer boundary; the child planes define the inner boundaries. |
dba69de2 469
470@subsubsection occt_iges_2_4_6 Subfigures
471
668c2575 472| IGES entity type | CASCADE shape | Comments |
473| :---------------- | :------------ | :------- |
474| 308: Subfigure Definition | TopoDS_Compound | This IGES entity is only translated when there are no Singular Subfigure Instance entities. |
475| 408: Singular Subfigure Instance | TopoDS_Compound | This shape has the Subfigure Definition Compound as its origin and is positioned in space by its translation vector and its scale factor. |
dba69de2 476
477@subsubsection occt_iges_2_4_7 Transformation Matrix
478
668c2575 479| IGES entity type | CASCADE shape | Comments |
480| :--------------- | :------------ | :------- |
481| 124: Transformation Matrix | Geom_Transformation | This entity is never translated alone. It must be included in the definition of another entity. |
dba69de2 482
483
484@subsection occt_iges_2_5 Messages
72b7576f 485Messages are displayed concerning the normal functioning of the processor (transfer, loading, etc.).
486You must declare an include file:
dba69de2 487~~~~~
72b7576f 488#includeInterface_DT.hxx
dba69de2 489~~~~~
490
72b7576f 491You have the choice of the following options for messages:
dba69de2 492~~~~~
72b7576f 493IDT_SetLevel (level);
dba69de2 494~~~~~
72b7576f 495level modifies the level of messages:
496 * 0: no messages
497 * 1: raise and fail messages are displayed, as are messages concerning file access,
498 * 2: warnings are also displayed.
dba69de2 499~~~~~
72b7576f 500IDT_SetFile (“tracefile.log”);
dba69de2 501~~~~~
72b7576f 502prints the messages in a file,
dba69de2 503~~~~~
72b7576f 504IDT_SetStandard();
dba69de2 505~~~~~
72b7576f 506restores screen output.
dba69de2 507
508@subsection occt_iges_2_6 Tolerance management
509@subsubsection occt_iges_2_6_1 Values used for tolerances during reading IGES
510
72b7576f 511During the transfer of IGES to Open CASCADE Technology several parameters are used as tolerances and precisions for different algorithms. Some of them are computed from other using specific functions.
dba69de2 512
72b7576f 513<h4>3D (spatial) tolerances</h4>
dba69de2 514
e5bd0d98 515* Package method *Precision\::Confusion* equal to 10<sup>-7</sup> is used as a minimal distance between points, which are considered distinct.
dba69de2 516* Resolution in the IGES file is defined in the Global section of an IGES file. It is used as a fundamental value of precision during the transfer.
517* User-defined variable *read.precision.val* can be used instead of resolution from the file when parameter *read.precision.mode* is set to 1 ("User").
518* Field *EpsGeom* of the class *IGESToBRep_CurveAndSurface* is a basic precision for translating an IGES object. It is set for each object of class *IGESToBRep_CurveAndSurface* and its derived classes. It is initialized for the root of transfer either by value of resolution from the file or by value of *read.precision.val*, depending on the value of *read.precision.mode* parameter. It is returned by call to method *IGESToBRep_CurvAndSurface::GetEpsGeom*. As this value belongs to measurement units of the IGES file, it is usually multiplied by the coefficient *UnitFactor* (returned by method *IGESToBRep_CurvAndSurface::GetUnitFactor*) to convert it to Open CASCADE Technology units.
519* Field *MaxTol* of the class *IGESToBRep_CurveAndSurface* is used as the maximum tolerance for some algorithms. Currently, it is computed as the maximum between 1 and <i>GetEpsGeom*GetUnitFactor</i>. This field is returned by method *IGESToBRep_CurvAndSurface::GetMaxTol*.
520
72b7576f 521<h4>2D (parametric) tolerances</h4>
dba69de2 522
e5bd0d98 523* Package method *Precision\::PConfusion* equal to <i> 0.01*Precision\::Confusion</i>, i.e. 10<sup>-9</sup>. It is used to compare parametric bounds of curves.
dba69de2 524* Field *EpsCoeff* of the class *IGESToBRep_CurveAndSurface* is a parametric precision for translating an IGES object. It is set for each object of class *IGESToBRep_CurveAndSurface* and its derived classes. Currently, it always has its default value 10<sup>-6</sup>. It is returned by call to method *IGESToBRep_CurvAndSurface::GetEpsCoeff*. This value is used for translating 2d objects (for instance, parametric curves).
525* Methods *UResolution(tolerance3d)* and *VResolution(tolerance3d)* of the class *GeomAdaptor_Surface* or *BRepAdaptor_Surface* return tolerance in parametric space of a surface computed from 3D tolerance. When one tolerance value is to be used for both U and V parametric directions, the maximum or the minimum value of *UResolution* and *VResolution* is used.
526* Methods *Resolution(tolerance3d)* of the class *GeomAdaptor_Curve* or *BRepAdaptor_Curve* return tolerance in the parametric space of a curve computed from 3d tolerance.
527
72b7576f 528<h4>Zero-dimensional tolerances</h4>
dba69de2 529* Field *Epsilon* of the class *IGESToBRep_CurveAndSurface* is set for each object of class *IGESToBRep_CurveAndSurface* and returned by call to method *GetEpsilon*. It is used in comparing angles and converting transformation matrices. In most cases, it is reset to a fixed value (10<sup>-5</sup> - 10<sup>-3</sup>) right before use. The default value is 10<sup>-4</sup>.
530
531@subsubsection occt_iges_2_6_2 Initial setting of tolerances in translating objects
532
533Transfer starts from one entity treated as a root (either the actual root in the IGES file or an entity selected by the user). The function which performs the transfer (that is *IGESToBRep_Actor::Transfer* or *IGESToBRep_Reader::Transfer*) creates an object of the type *IGESToBRep_CurveAndSurface*, which is intended for translating geometry.
534
535This object contains three tolerances: *Epsilon, EpsGeom* and *EpsCoeff*.
536
537Parameter *Epsilon* is set by default to value 10<sup>-4</sup>. In most cases when it is used in the package *IGESToBRep*, it is reset to a fixed value, either 10<sup>-5</sup> or 10<sup>-4</sup> or 10<sup>-3</sup>. It is used as precision when comparing angles and transformation matrices and does not have influence on the tolerance of the resulting shape.
538
539Parameter *EpsGeom* is set right after creating a *IGESToBRep_CurveAndSurface* object to the value of resolution, taken either from the Global section of an IGES file, or from the *XSTEP.readprecision.val* parameter, depending on the value of *XSTEP.readprecision.mode*.
540
541Parameter *EpsCoeff* is set by default to 10<sup>-6</sup> and is not changed.
542
543During the transfer of a shape, new objects of type *IGESToBRep_CurveAndSurface* are created for translating subshapes. All of them have the same tolerances as the root object.
544
545@subsubsection occt_iges_2_6_3 Transfer process
72b7576f 546<h4>Translating into Geometry</h4>
dba69de2 547Geometrical entities are translated by classes *IGESToBRep_BasicCurve* and *IGESToBRep_BasicSurface*. Methods of these classes convert curves and surfaces of an IGES file to Open CASCADE Technology geometry objects: *Geom_Curve, Geom_Surface,* and *Geom_Transformation*.
548
72b7576f 549Since these objects are not BRep objects, they do not have tolerances. Hence, tolerance parameters are used in these classes only as precisions: to detect specific cases (e.g., to distinguish a circle, an ellipse, a parabola and a hyperbola) and to detect bad cases (such as coincident points).
dba69de2 550
72b7576f 551Use of precision parameters is reflected in the following classes:
dba69de2 552* *IGESToBRep_BasicCurve* - all parameters and points are compared with precision *EpsGeom*. All transformations (except *IGESToBRep_BasicCurve::TransferTransformation*) are fulfilled with precision *Epsilon* which is set to 10<sup>-3</sup> (in the *IGESToBRep_BasicCurve::TransferTransformation* the value 10<sup>-5</sup> is used).
553* *IGESToBRep_BasicCurve::TransferBSplineCurve* - all weights of *BSplineCurve* are assumed to be more than *Precision::PConfusion* (else the curve is not translated).
554* *IGESToBRep_BasicSurface* all parameters and points are compared with precision *EpsGeom*. All transformations are fulfilled with precision *Epsilon*, which is set to 10<sup>-3</sup>.
555* *IGESToBRep_BasicSurface::TransferBSplineSurface* - all weights of *BSplineSurface* are assumed to be more than *Precision::PConfusion* (else the surface is not translated).
556
557
72b7576f 558<h4>Translating into Topology</h4>
dba69de2 559
e5bd0d98 560IGES entities represented as topological shapes and geometrical objects are translated into OCCT shapes by use of the classes *IGESToBRep_TopoCurve, IGESToBRep_TopoSurface, IGESToBRep_BRepEntity* and *ShapeFix_Wire*.
561
562Class *IGESToBRep_BRepEntity* is intended for transferring BRep entities (IGES version 5.1) while the two former are used for translating geometry and topology defined in IGES 5.1. Methods from *IGESToBRep_BRepEntity* call methods from *IGESToBRep_TopoCurve* and *IGESToBRep_TopoSurface*, while those call methods from *IGESToBRep_BasicCurve* and *IGESToBRep_BasicSurface* to translate IGES geometry into OCCT geometry.
563
72b7576f 564Although the IGES file contains only one parameter for tolerance in the Global Section, OCCT shapes are produced with different tolerances. As a rule, updating the tolerance is fulfilled according to local distances between shapes (distance between vertices of adjacent edges, deviation of edge’s 3D curve and its parametric curve and so on) and may be less or greater than precision in the file.
e5bd0d98 565
72b7576f 566The following classes show what default tolerances are used when creating shapes and how they are updated during transfer.
e5bd0d98 567
72b7576f 568<h5>Class IGESToBRep_TopoCurve</h5>
e5bd0d98 569
570All methods are in charge of transferring curves from IGES curve entities *(TransferCompositeCurve, Transfer2dCompositeCurve, TransferCurveOnFace, TransferBoundaryOnFace, TransferOffsetCurve, TransferTopoBasicCurve)* if an entity has transformation call to *IGESData_ToolLocation::ConvertLocation* with *Epsilon* value set to 10<sup>-4</sup>.
571 * *IGESToBRep_TopoCurve::TransferPoint* - vertex is constructed from a Point entity with tolerance *EpsGeom*UnitFactor*.
572 * *IGESToBRep_TopoCurve::Transfer2dPoint* - vertex is constructed from a Point entity with tolerance *EpsCoeff*.
573 * *IGESToBRep_TopoCurve::TransferCompositeCurveGeneral* - obtains shapes (edges or wires) from other methods and adds them into the resulting wire. Two adjacent edges of the wire can be connected with tolerance up to *MaxTol*.
574 * *IGESToBRep_TopoCurve::TransferCurveOnFace* and *IGESToBRep_TopoCurve::TransferBoundaryOnFace* build a wire from 3D and 2D representations of a curve on surface. Edges and vertices of the wire cannot have tolerance larger than *MaxTol*. The value *EpsGeom*UnitFactor* is passed into *ShapeFix_Wire::SetPrecision* and *MaxTol* - into *ShapeFix_Wire::MaxTolerance*. To find out how these parameters affect the resulting tolerance changes, please, refer to class *ShapeFix_Wire*.
575 * *IGESToBRep_TopoCurve::TransferTopoBasicCurve* and *IGESToBRep_TopoCurve::Transfer2dTopoBasicCurve* - the boundary vertices of an edge (or a wire if a curve was of C0 continuity) translated from a basis IGES curve (*BSplineCurve, CopiousData, Line,* etc.) are built with tolerance *EpsGeom*UnitFactor*, the edge tolerance is *Precision::Confusion*. If a curve was divided into several edges, the common vertices of such adjacent edges have tolerance *Precision::Confusion*.
576
577
72b7576f 578<h5>Class IGESToBRep_TopoSurface</h5>
e5bd0d98 579
580All faces created by this class have tolerance *Precision::Confusion*.
581
72b7576f 582<h5>Class IGESToBRep_BRepEntity</h5>
e5bd0d98 583
584 * *IGESToBRep_BRepEntity::TransferVertex* - the vertices from the *VertexList* entity are constructed with tolerance *EpsGeom*UnitFactor*.
585 * *IGESToBRep_BRepEntity::TransferEdge* - the edges from the *EdgeList* entity are constructed with tolerance *Precision::Confusion*.
586 * *IGESToBRep_BRepEntity::TransferLoop* - this function works like *IGESToBRep_TopoCurve::TransferCurveOnFace* and *IGESToBRep_TopoCurve::TransferBoundaryOnFace*.
587 * *IGESToBRep_BRepEntity::TransferFace* the face from the Face IGES entity is constructed with tolerance *Precision::Confusion*.
588
72b7576f 589<h5>Shape Healing classes</h5>
e5bd0d98 590After performing a simple mapping, shape-healing algorithms are called (class *ShapeFix_Shape*) by *IGESToBRep_Actor::Transfer()*. Shape-healing algorithm performs the correction of the resulting OCCT shape.
591Class *ShapeFix_Wire* can increase the tolerance of a shape. This class is used in *IGESToBRep_BRepEntity::TransferLoop*, *IGESToBRep_TopoCurve::TransferBoundaryOnFace* and *IGESToBRep_TopoCurve::TransferCurveOnFace* for correcting a wire. The maximum possible tolerance applied to the edges or vertices after invoking the methods of this class is *MaxTolerance* (set by method *ShapeFix_Wire::MaxTolerance()* ).
72b7576f 592
dba69de2 593@subsection occt_iges_2_7 Code architecture
e5bd0d98 594
72b7576f 595The following diagram illustrates the structure of calls in reading IGES.
596The highlighted classes produce OCCT geometry.
e5bd0d98 597
598@image html /user_guides/iges/images/iges_image003.png "The structure of calls in reading IGES"
599@image latex /user_guides/iges/images/iges_image003.png "The structure of calls in reading IGES"
72b7576f 600
dba69de2 601@subsection occt_iges_2_8 Example
e5bd0d98 602
603~~~~~
72b7576f 604#include “IGESControl_Reader.hxx”
605#include “TColStd_HSequenceOfTransient.hxx”
606#include “TopoDS_Shape.hxx”
607{
608IGESControl_Reader myIgesReader;
609Standard_Integer nIgesFaces,nTransFaces;
610
611myIgesReader.ReadFile (“MyFile.igs”);
612//loads file MyFile.igs
613
614Handle(TColStd_HSequenceOfTransient) myList = myIgesReader.GiveList(“iges-faces”);
615//selects all IGES faces in the file and puts them into a list called //MyList,
616
617nIgesFaces = myList-Length();
618nTransFaces = myIgesReader.TransferList(myList);
619//translates MyList,
620
dba69de2 621cout“IGES Faces: “nIgesFaces“ Transferred:”nTransFacesendl;
72b7576f 622TopoDS_Shape sh = myIgesReader.OneShape();
623//and obtains the results in an OCCT shape.
624}
e5bd0d98 625~~~~~
72b7576f 626
e5bd0d98 627@section occt_iges_3 Writing IGES
628@subsection occt_iges_3_1 Procedure
72b7576f 629
72b7576f 630You can translate OCCT shapes to IGES entities in the following steps:
e5bd0d98 6311. Initialize the process.
6322. Set the translation parameters,
6333. Perform the model translation,
6344. Write the output IGES file.
635
72b7576f 636You can translate several shapes before writing a file. Each shape will be a root entity in the IGES model.
e5bd0d98 637
638@subsection occt_iges_3_2 Domain covered
72b7576f 639There are two families of OCCT objects that can be translated:
640 * geometrical,
641 * topological.
e5bd0d98 642
643@subsection occt_iges_3_3 Description of the process
644@subsubsection occt_iges_3_3_1 Initializing the process
645
72b7576f 646Choose the unit and the mode you want to use to write the output file as follows:
e5bd0d98 647* *IGESControl_Controller::Init* performs standard initialization. Returns False if an error occurred.
648* *IGESControl_Writer writer* uses the default unit (millimeters) and the default write mode (Face).
649* *IGESControl_Writer writer (UNIT)* uses the Face write mode and any of the units that are accepted by IGES.
650* *IGESControl_Writer writer (UNIT,modecr)* uses the unit (accepted by IGES) and the write mode of your choice.
651 * 0: Faces,
652 * 1: BRep
653The result is an *IGESControl_Writer* object.
654
655@subsubsection occt_iges_3_3_2 Setting the translation parameters
656
72b7576f 657The following parameters are used for the OCCT-to-IGES translation.
72b7576f 658
e5bd0d98 659* *write.iges.brep.mode:* allows choosing the write mode:
660 * "Faces" (0): OCCT *TopoDS_Faces* will be translated into IGES 144 (Trimmed Surface) entities, no B-Rep entities will be written to the IGES file,
661 * "BRep" (1): OCCT *TopoDS_Faces* will be translated into IGES 510 (Face) entities, the IGES file will contain B-Rep entities.
72b7576f 662Read this parameter with:
e5bd0d98 663~~~~~
664Standard_Integer byvalue = Interface_Static::IVal("write.iges.brep.mode");
665~~~~~
72b7576f 666Modify this parameter with:
e5bd0d98 667~~~~~
668Interface_Static::SetIVal ("write.iges.brep.mode", 1);
669~~~~~
670Default value is "Faces" (0).
671* *write.convertsurface.mode* when writing to IGES in the BRep mode, this parameter indicates whether elementary surfaces (cylindrical, conical, spherical, and toroidal) are converted into corresponding IGES 5.3 entities (if the value of a parameter value is On), or written as surfaces of revolution (by default).
672* *write.iges.unit:* allows choosing the unit. The default unit for Open CASCADE Technology is "MM" (millimeter). You can choose to write a file into any unit accepted by IGES.
673 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.unit")*;
674 * Modify this parameter with *Interface_Static::SetCVal ("write.iges.unit", "INCH");*
675* *write.iges.header.autor:* gives the name of the author of the file. The default value is the system name of the user.
676 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.author")*;
677 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.author", "name")*;
678* *write.iges.header.company:* gives the name of the sending company. The default value is "" (empty).
679 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.company");*
680 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.company", "Open CASCADE");*
681* *write.iges.header.product:* gives the name of the sending product. The default value is "CAS.CADE IGES processor Vx.x", where *x.x* means the current version of Open CASCADE Technology.
682 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.product")*;
683 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.product", "product name")*;
684* *write.iges.header.receiver:* - gives the name of the receiving company. The default value is "" (empty).
685 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.receiver");*
686 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.receiver", "reciever name");*
687* *write.precision.mode:* specifies the mode of writing the resolution value into the IGES file.
688 * "Least" (-1): resolution value is set to the minimum tolerance of all edges and all vertices in an OCCT shape.
689 * "Average" (0): resolution value is set to average between the average tolerance of all edges and the average tolerance of all vertices in an OCCT shape. This is the default value.
690 * "Greatest" (1): resolution value is set to the maximum tolerance of all edges and all vertices in an OCCT shape.
691 * "Session" (2): resolution value is that of the write.precision.val parameter.
692
693 * Read this parameter with *Standard_Integer ic = Interface_Static::IVal("write.precision.mode");*
694 * Modify this parameter with *if (!Interface_Static\::SetIVal("write.precision.mode",1)) .. error .. *
695* *write.precision.val:* is the user precision value. This parameter gives the resolution value for an IGES file when the *write.precision.mode* parameter value is 1. It is equal to 0.0001 by default, but can take any real positive (non null) value.
696
72b7576f 697Read this parameter with:
668c2575 698~~~~~
72b7576f 699Standard_Real rp = Interface_Static::RVal(;write.precision.val;);
668c2575 700~~~~~
72b7576f 701Modify this parameter with:
668c2575 702~~~~~
72b7576f 703if (!Interface_Static::SetRVal(;write.precision.val;,0.01))
704.. error ..
668c2575 705~~~~~
72b7576f 706Default value is 0.0001.
668c2575 707
708<h4>write.iges.resource.name</h4> and <h4>write.iges.sequence</h4> are the same as the corresponding read.iges.\* parameters, please, see above. Note that the default sequence for writing contains *DirectFaces* operator, which converts elementary surfaces based on left-hand axes (valid in CASCADE) to right-hand axes (which are valid only in IGES).
709
710Default values :
711~~~~~
712write.iges.resource.name – IGES,
713write.iges.sequence – ToIGES.
714~~~~~
715
716@subsubsection occt_iges_3_3_3 Performing the Open CASCADE Technology shape translation
717
72b7576f 718You can perform the translation in one or several operations. Here is how you translate topological and geometrical objects:
668c2575 719~~~~~
720Standard_Boolean ok = writer.AddShape (TopoDS_Shape);
721~~~~~
722*ok* is True if translation was correctly performed and False if there was at least one entity that was not translated.
723~~~~~
72b7576f 724Standard_Boolean ok = writer.AddGeom (geom);
668c2575 725~~~~~
726where *geom* is *Handle(Geom_Curve)* or *Handle(Geom_Surface)*;
727*ok* is True if the translation was correctly performed and False if there was at least one entity whose geometry was not among the allowed types.
728
729@subsubsection occt_iges_3_3_4 Writing the IGES file
72b7576f 730Write the IGES file with:
668c2575 731~~~~~
732Standard_Boolean ok = writer.Write ("filename.igs");
733~~~~~
72b7576f 734to give the file name.
668c2575 735~~~~~
72b7576f 736Standard_Boolean ok = writer.Write (S);
668c2575 737~~~~~
738where *S* is *Standard_OStream*
739*ok* is True if the operation was correctly performed and False if an error occurred (for instance, if the processor could not create the file).
740
741@subsection occt_iges_3_4 Mapping Open CASCADE Technology shapes to IGES entities
742
72b7576f 743Translated objects depend on the write mode that you chose. If you chose the Face mode, all of the shapes are translated, but the level of topological entities becomes lower (geometrical one). If you chose the BRep mode, topological OCCT shapes become topological IGES entities.
668c2575 744
745@subsubsection occt_iges_3_4_1 Curves
746
747| CASCADE shape | IGES entity type | Comments |
748| :------------ | :---------------- | :------- |
749| Geom_BsplineCurve | 126: BSpline Curve | |
750| Geom_BezierCurve | 126: BSpline Curve | |
751| Geom_TrimmedCurve | All types of translatable IGES curves | The type of entity output depends on the type of the basis curve. If the curve is not trimmed, limiting points will be defined by the CASCADE RealLast value. |
752| Geom_Circle | 100: Circular Arc or 126: BSpline Curve | A BSpline Curve is output if the *Geom_Circle* is closed |
753| Geom_Ellipse | 104: Conic Arc or 126: BSpline Curve | A Conic Arc has Form 1. A BSpline Curve is output if the *Geom_Ellipse* is closed. |
754| Geom_Hyperbola | 104: Conic Arc | Form 2 |
755| Geom_Parabola | 104: Conic Arc | Form 3 |
756| Geom_Line | 110: Line | |
757| Geom_OffsetCurve | 130: Offset Curve | |
758
759@subsubsection occt_iges_3_4_2 Surfaces
760
761| CASCADE shapes | IGES entity type | Comments |
762| :------------- | :--------------- | :------- |
763| Geom_BSplineSurface | 128: BSpline Surface | |
764| Geom_BezierSurface | 128: BSpline Surface | |
765| Geom_RectangularTrimmedSurface | All types of translatable IGES surfaces. | The type of entity output depends on the type of the basis surface. If the surface is not trimmed and has infinite edges/sides, the coordinates of the sides in IGES will be limited to the CASCADE *RealLast* value. |
766| Geom_Plane | 128: BSpline Surface or 190: Plane Surface | A BSpline Surface (of degree 1 in U and V) is output if you are working in the face mode. A Plane Surface is output if you are working in the BRep mode. |
767| Geom_CylindricalSurface | 120: Surface Of Revolution | |
768| Geom_ConicalSurface | 120: Surface Of Revolution | |
769| Geom_SphericalSurface | 120: Surface Of Revolution | |
770| Geom_ToroidalSurface | 120: Surface Of Revolution | |
771| Geom_SurfaceOfLinearExtrusion | 122: Tabulated Cylinder | |
772| Geom_SurfaceOfRevolution | 120: Surface Of Revolution | |
773| Geom_OffsetSurface | 140: Offset Surface | |
774
775@subsubsection occt_iges_3_4_3 Topological entities - Translation in Face mode
776
777| CASCADE shapes | IGES entity type | Comments |
778| :------------- | :--------------- | :------- |
779| Single TopoDS_Vertex | 116: 3D Point | |
780| TopoDS_Vertex in a TopoDS_Edge | No equivalent | Not transferred. |
781| TopoDS_Edge | All types of translatable IGES curves | The output IGES curve will be the one that corresponds to the Open CASCADE Technology definition. |
782| Single TopoDS_Wire | 102: Composite Curve | Each *TopoDS_Edge* in the *TopoDS_Wire* results in a curve. |
783| TopoDS_Wire in a TopoDS_Face | 142: Curve On Surface | Both curves (3D and pcurve) are transferred if they are defined and result in a simple curve or a composite curve depending on whether there is one or more edges in the wire.Note: if the basis surface is a plane (108), only the 3D curve is used. |
784| TopoDS_Face | 144: Trimmed Surface | |
785| TopoDS_Shell | 402: Form 1 Group or no equivalent | Group is created only if *TopoDS_Shell* contains more than one *TopoDS_Face*. The IGES group contains Trimmed Surfaces. |
786| TopoDS_Solid | 402: Form 1 Group or no equivalent | Group is created only if *TopoDS_Solid* contains more than one *TopoDS_Shell*. One IGES entity is created per *TopoDS_Shell*. |
787| TopoDS_CompSolid | 402: Form 1 Group or no equivalent | Group is created only if *TopoDS_CompSolid* contains more than one *TopoDS_Solid*. One IGES entity is created per *TopoDS_Solid*. |
788| TopoDS_Compound | 402: Form 1 Group or no equivalent | Group is created only if *TopoDS_Compound* contains more than one item. One IGES entity is created per *TopoDS_Shape* in the *TopoDS_Compound*. If *TopoDS_Compound* is nested into another *TopoDS_Compound*, it is not mapped. |
789
790@subsubsection occt_iges_3_4_4 Topological entities - Translation in BRep mode
791
792| CASCADE shapes | IGES entity type | Comments |
793| :------------- | :--------------- | :------- |
794| Single TopoDS_Vertex | No equivalent | Not transferred. |
795| TopoDS_Vertex in a TopoDS_Edge | One item in a 502: *VertexList* | |
796| TopoDS_Edge | No equivalent | Not transferred as such. This entity serves as a part of a Loop entity. |
797| TopoDS_Edge in a TopoDS_Wire | One item in a 504: EdgeList | |
798| TopoDS_Wire | 508: Loop | |
799| TopoDS_Face | 510: Face | If the geometrical support of the face is a plane, it will be translated as a 190 entity *PlaneSurface*. |
800| TopoDS_Shell | 514: Shell | |
801| TopoDS_Solid | 186: Manifold Solid | |
802| TopoDS_CompSolid | 402 Form1 Group or no equivalent | Group is created only if *TopoDS_Compound* contains more than one item. One IGES Manifold Solid is created for each *TopoDS_Solid* in the *TopoDS_CompSolid*. |
803| TopoDS_Compound | 402 Form1 Group or no equivalent | Group is created only if *TopoDS_Compound* contains more than one item. One IGES entity is created per *TopoDS_Shape* in the *TopoDS_Compound*. If *TopoDS_Compound* is nested into another *TopoDS_Compound* it is not mapped. |
804
805@subsection occt_iges_3_5 Tolerance management
806@subsubsection occt_iges_3_5_1 Setting resolution in an IGES file
807
808There are several possibilities to set resolution in an IGES file. They are controlled by write.precision.mode parameter; the dependence between the value of this parameter and the set resolution is described in paragraph <a href="#occt_iges_3_3_2">Setting the translation parameters</a>.
809
810If the value of parameter *write.precision.mode* is -1, 0 or 1, resolution is computed from tolerances of sub-shapes inside the shape to be translated. In this computation, only tolerances of *TopoDS_Edges* and *TopoDS_Vertices* participate since they reflect the accuracy of the shape. *TopoDS_Faces* are ignored in computations since their tolerances may have influence on resulting computed resolution while IGES resolution mainly concerns points and curves but not surfaces.
811
812@subsection occt_iges_3_6 Code architecture
813@subsubsection occt_iges_3_6_1 Graph of calls
72b7576f 814The following diagram illustrates the class structure in writing IGES.
815The highlighted classes are intended to translate geometry.
dba69de2 816
668c2575 817@image html /user_guides/iges/images/iges_image004.png "The class structure in writing IGES"
818@image latex /user_guides/iges/images/iges_image004.png "The class structure in writing IGES"
dba69de2 819
668c2575 820@subsection occt_iges_3_7 Example
e5bd0d98 821
822~~~~~{c++}
72b7576f 823#include IGESControl_Controller.hxx
824#include IGESControl_Writer.hxx
825#include TopoDS_Shape.hxx
826Standard_Integer main()
827{
dba69de2 828 IGESControl_Controller::Init();
829 IGESControl_Writer ICW (;MM;, 0);
830 //creates a writer object for writing in Face mode with millimeters
831 TopoDS_Shape sh;
832 ICW.AddShape (sh);
833 //adds shape sh to IGES model
834 ICW.ComputeModel();
835 Standard_Boolean OK = ICW.Write (;MyFile.igs;);
836 //writes a model to the file MyFile.igs
72b7576f 837}
e5bd0d98 838~~~~~
839
668c2575 840
841@section occt_iges_4_ Using XSTEPDRAW
842
72b7576f 843XSTEPDRAW UL is intended for creating executables for testing XSTEP interfaces interactively in the DRAW environment. It provides an additional set of DRAW commands specific for the data exchange tasks, which allow loading and writing data files and analysis of resulting data structures and shapes.
668c2575 844
845In 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, vertical dash (|) is used.
846
847@subsection occt_iges_4_2 Setting interface parameters
848
72b7576f 849A set of parameters for importing and exporting IGES files is defined in the XSTEP resource file. In XSTEPDRAW, these parameters can be viewed or changed using command
668c2575 850Draw> param [<parameter_name> [<value>]]
851Command *param* with no arguments gives a list of all parameters with their values. When argument *parameter_name* is specified, information about this parameter is printed (current value and short description).
852
72b7576f 853The third argument is used to set a new value of the given parameter. The result of the setting is printed immediately.
668c2575 854
72b7576f 855During all interface operations, the protocol of the process (fail and warning messages, mapping of the 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 a standard output).
72b7576f 856
668c2575 857Command *xtrace* is intended to view and change these parameters:
858* *Draw> xtrace* - prints current settings (e.g.: "Level=0 - Standard Output");
859* *Draw> xtrace #* - sets the trace level to the value #;
860* *Draw> xtrace tracefile.log* - sets the trace file as *tracefile.log*;
861* *Draw xtrace* - directs all messages to the standard output.
862
863@subsection occt_iges_4_3 Reading IGES files
864For a description of parameters used in reading an IGES file refer to <a href="#occt_iges_2_3_3">Setting the translation parameters</a>.
865
866These parameters are set by command *param* :
72b7576f 867
668c2575 868| Description | Name | Values |
869| :------------ | :---- | :----- |
870| Precision for input entities | read.precision.mode | 0 or 1 |
871| | read.precision.val | real |
872| Continuity of B splines | read.iges.bspline.continuity | 0-2 |
873| Surface curves | read.surfacecurve.mode | 2, 3 or 0 |
72b7576f 874
875It is possible either only to load an IGES file into memory (i.e. to fill the model with data from the file), or to read it (i.e. to load and convert all entities to OCCT shapes).
668c2575 876
72b7576f 877Loading is done by the command
668c2575 878~~~~~
879Draw> xload <file_name>
880~~~~~
881Once the file is loaded, it is possible to investigate the structure of the loaded data. To learn how to do it see <a href="#occt_iges_4_4">Analyzing the transferred</a>
882
72b7576f 883Reading of an IGES file is done by the command
668c2575 884~~~~~
885Draw> igesbrep <file_name> <result_shape_name> [<selection>]
886~~~~~
887Here a dot can be used instead of a filename if the file is already loaded by *xload* or *igesbrep* command. In that case, only conversion of IGES entities to OCCT shapes will be done.
888
889Command *igesbrep* will interactively ask the user to select a set of entities to be converted:
72b7576f 890
668c2575 891| N | Mode | Description |
892| :-- | :-- | :---------- |
893| 0 | End | finish conversion and exit igesbrep |
894| 1 | Visible roots | convert only visible roots |
895| 2 | All roots | convert all roots |
896| 3 | One entity | convert entity with number provided by the user |
897| 4 | Selection | convert only entities contained in selection |
72b7576f 898
899After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes (e.g., one shape per root or one shape for all the entities). It is also possible to save loaded shapes in files, and to cancel loading.
668c2575 900
901The second parameter of the *igesbrep* command defines the name of the loaded shape. If several shapes are created, they will get indexed names. For instance, if the last parameter was ‘s’, they will be *s_1, ... s_N.
902
903*<selection>* specifies the scope of selected entities in the model, it is *xst-transferrable-roots* by default. An asterisk “*” can be specified instead of *iges-visible-transf-roots*. For possible values for selection refer to <a href="#occt_iges_2_3_4">Selecting entities</a> section.
904
905
906Instead of *igesbrep* it is possible to use commands:
907~~~~~
908Draw> trimport <file_name> <result_shape_name> <selection>
909~~~~~
910which outputs the result of translation of each selected entity into one shape, or
911~~~~~
912Draw> trimpcomp <file_name> <result_shape_name> <selection>
913~~~~~
914which outputs the result of translation of all selected entities into one shape (*TopoDS_Compound* for several entities).
915
916An asterisk “*” can be specified instead of selection, it means *xst-transferrable-roots*.
917
72b7576f 918During the IGES translation, a map of correspondence between IGES entities and OCCT shapes is created.
668c2575 919The following commands are available:
920
921* *Draw> tpent \# * - provides information on the result of translation of the given IGES entity;
922* *Draw> tpdraw \#* - creates an OCCT shape corresponding to an IGES entity;
923* *Draw> fromshape <shape_name>* provides the number of an IGES entity corresponding to an OCCT shape;
924* *Draw> tpclear* clears the map of correspondences between IGES entities and OCCT shapes.
925
926@subsection occt_iges_4_4 Analyzing the transferred data
927
72b7576f 928The procedure of analysis of the data import can be divided into two stages:
668c2575 9291. Checking the file contents;
9302. Estimation of translation results (conversion and validated ratios).
931
932@subsubsection occt_iges_4_4_1 Checking file contents
933
72b7576f 934General statistics on the loaded data can be obtained by using command
668c2575 935~~~~~
936Draw> data <symbol>
937~~~~~
72b7576f 938The information printed by this command depends on the symbol specified:
939
668c2575 940| Symbol | Output |
941| :-------- | :----- |
942| g | Prints information contained in the header of the file (Start and Global sections) |
943| c or f | Runs check procedure of the integrity of the loaded data and prints the resulting statistics (f works only with fails while c with both fail and warning messages) |
944| t | The same as c or f, with a list of failed or warned entities |
945| m or l | The same as t but also prints a status for each entity |
946| e | Lists all entities of the model with their numbers, types, status of validity etc. |
947| r | The same as e but lists only root entities |
948
72b7576f 949
950There is a set of special objects, which can be used to operate with the loaded model. They can be of the following types:
668c2575 951| Special object type | Operation |
952| :------------------ | :---------- |
953| Selection Filters | allow selecting subsets of entities of the loaded model |
954| Counters | Calculate statistics on the model data |
955
72b7576f 956
957A list of these objects defined in the current session can be printed in DRAW by command
668c2575 958~~~~~
959Draw> listitems
960~~~~~
961In the following commands if several <i><selection></i> arguments are specified the results of each following selection are applied to the results of the previous one.
962~~~~~
963Draw> givelist <selection_name> [<selection_name>]
964~~~~~
965prints a list of loaded entities defined by selection argument.
966
967~~~~~
968Draw> givecount <selection_name> [<selection_name>]
969~~~~~
970prints a number of loaded entities defined by <i>selection</i> argument.
971
972Three commands are used to calculate statistics on the entities in the model:
973* *Draw> count <counter> [<selection> ...]* - prints only a number of entities per each type matching the criteria defined by arguments.
974* *Draw> sumcount <counter> [<selection> ...]* - prints the total number of entities of all types matching the criteria defined by arguments and the largest number corresponding to one type.
975* *Draw> listcount <counter> [<selection> ...]* prints a list of entities per each type matching the criteria defined by arguments.
976
977Optional <i><selection></i> argument, if specified, defines a subset of entities, which are to be taken into account. Argument <i><counter></i> should be one of the currently defined counters:
978
979| Counter | Operation |
980| :-------- | :-------- |
981| xst-types | Calculates how much entities of each OCCT type exist |
982| iges-types | Calculates how much entities of each IGES type and form exist |
983| iges-levels | Calculates how much entities lie in different IGES levels |
984
985The command:
986~~~~~
987Draw> listtypes <selection_name> ...
988~~~~~
72b7576f 989gives a list of entity types which were encountered in the last loaded file (with a number of IGES entities of each type). The list can be shown not for all entities but for a subset of them. This subset is defined by an optional selection argument.
990
668c2575 991Entities in the IGES file are numbered in the succeeding order. An entity can be identified either by its number (#) or by its label. Label is the letter ‘D’ followed by the index of the first line with the data for this entity in the Directory Entry section of the IGES file. The label can be calculated on the basis of the number as ‘D(2*# -1)’. For example, entity # 6 has label D11.
992
993* *Draw> elab \#* - provides a label for an entity with a known number;
994* *Draw> enum \#* - prints a number for an entity with the given label;
995* *Draw> entity \# <level_of_information>* - gives the content of an IGES entity;
996* *Draw> estat \#* - provides the list of entities referenced by a given entity and the list of entities referencing to it.
997
998@subsubsection occt_iges_4_4_2 Estimating the results of reading IGES
72b7576f 999All of the following commands are available only after the data are converted into OCCT shapes (i.e. after command **igesbrep**).
72b7576f 1000
668c2575 1001~~~~~
1002Draw> tpstat [*|?]<symbol> [<selection>]
1003~~~~~
1004provides all statistics on the last transfer, including the list of transferred entities with mapping from IGES to OCCT types, as well as fail and warning messages. The parameter <i><symbol></i> defines what information will be printed:
1005* G - General statistics (list of results and messages)
1006* C - Count of all warning and fail messages
1007* C - List of all warning and fail messages
1008* F - Count of all fail messages
1009* F - List of all fail messages
1010* N - List of all transferred roots
1011* S - The same, with types of source entity and result type
1012* B - The same, with messages
1013* T - Count of roots for geometrical types
1014* R - Count of roots for topological types
1015* l - The same, with a type of the source entity
72b7576f 1016
1017The sign ‘*’ before the 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.
668c2575 1018
1019Optional argument <i><selection></i> can limit the action of the command with a selected subset of entities.
72b7576f 1020To get help, run this command without arguments.
668c2575 1021
1022For example, to get translation ratio on IGES faces, you can use.
1023~~~~~
1024Draw:> tpstat *l iges-faces
1025~~~~~
72b7576f 1026The second version of the same command is TPSTAT (not capital spelling).
668c2575 1027~~~~~
1028Draw:> TPSTAT symbol
1029~~~~~
72b7576f 1030Symbol can be of the following values:
668c2575 1031* g - General statistics (list of results and messages)
1032* c - Count of all warning and fail messages
1033* C - List of all warning and fail messages
1034* r - Count of resulting OCCT shapes per each type
1035* s - Mapping of IGES roots and resulting OCCT shapes
72b7576f 1036
668c2575 1037Sometimes the trimming contours of IGES faces (i.e., entity 141 for 143, 142 for 144) can be lost during translation due to fails.
1038
1039The number of lost trims and the corresponding IGES entities can be obtained by the command:
1040~~~~~
1041Draw> tplosttrim [<IGES_type>]
1042~~~~~
1043It outputs the rank and DE numbers of faces that lost their trims and their numbers for each type (143, 144, 510) and their total number. If a face lost several of its trims it is output only once.
1044
1045Optional parameter <i><IGES_type></i> can be *TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces.
1046
1047For example, to get untrimmed 144 entities, use command
1048~~~~~
1049Draw> tplosttrim TrimmedSurface
1050~~~~~
1051To get the information on OCCT shape contents, use command
1052~~~~~
1053Draw> statshape <shape_name>
1054~~~~~
72b7576f 1055It outputs the number of each kind of shapes (vertex, edge, wire, etc.) in a shape and some geometrical data (number of C0 surfaces, curves, indirect surfaces, etc.).
668c2575 1056
72b7576f 1057Note. 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.
72b7576f 1058
668c2575 1059To analyze the internal validity of a shape, use command
1060~~~~~
1061Draw> checkbrep <shape_name> <expurged_shape_name>
1062~~~~~
1063It checks the geometry and topology of a shape 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 IGES entities the OCCT shape was produced from.
1064
1065<i><expurged_shape_name></i> will contain the original shape without invalid subshapes.
1066
1067To get information on tolerances of subshapes, use command
1068~~~~~
1069Draw> tolerance <shape_name> [<min> [<max>] [<symbol>]]
1070~~~~~
1071It outputs maximum, average and minimum values of tolerances for each kind of subshapes having tolerances or it can output tolerances of all subshapes of the whole shape.
1072
1073When specifying <min> and <max> arguments this command outputs shapes with names <i><shape_name>...</i> and their total number with tolerances in the range [min, max].
1074
1075<i><Symbol></i> is used for specifying the kind of sub-shapes to analyze:
1076* v - for vertices,
1077* e - for edges,
1078* f - for faces,
1079* c - for shells and faces.
1080
1081@subsection occt_iges_4_5 Writing an IGES file
1082
1083Refer to <a href="#occt_iges_3_3_2">Setting the translation parameters</a> for a description of parameters used in reading an IGES file. The parameters are set by command *param*:
1084
1085| Description | Name | Values |
1086| :----------- | :---- | :----- |
1087| Author | XSTEP.iges.header.author | String |
1088| Company | XSTEP.iges.header.company | String |
1089| Receiver | XSTEP.iges.header.receiver | String |
1090| Write mode for shapes | XSTEP.iges.writebrep.mode | 0/Faces or 1/BRep |
1091| Measurement units | XSTEP.iges.unit | 1-11 (or a string value) |
72b7576f 1092
1093Several shapes can be written in one file. To start writing a new file, enter command
668c2575 1094~~~~~
1095Draw> newmodel
1096~~~~~
1097This command clears the *InterfaceModel* to make it empty.
72b7576f 1098
668c2575 1099~~~~~
1100Draw> brepiges <shape_name_1> [<filename.igs>]
1101~~~~~
1102Converts the specified shapes into IGES entities and puts them into the *InterfaceModel*.
72b7576f 1103
668c2575 1104~~~~~
1105Draw> writeall <filename.igs>
1106~~~~~
1107Allows writing the prepared model to a file with name *filename.igs*.
72b7576f 1108
668c2575 1109@section occt_iges_5_ Reading from and writing to XDE
1110
1111@subsection occt_iges_5_1 Loading an IGES file
72b7576f 1112
72b7576f 1113Before performing any other operation, you must load an IGES file with:
668c2575 1114~~~~~
72b7576f 1115IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
1116IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
668c2575 1117~~~~~
72b7576f 1118Loading the file only memorizes, but does not translate the data.
668c2575 1119
1120@subsection occt_iges_5_2 Checking the loaded IGES file
1121
1122This step is not obligatory. See the description of this step <a href="#occt_iges_2_3_2"> above</a>.
1123
1124@subsection occt_iges_5_3 Setting parameters for translation to XDE
1125See the description of this step <a href="#occt_iges_2_3_3"> above</a>.
1126
72b7576f 1127In addition, the following parameters can be set for XDE translation of attributes:
668c2575 1128* For transferring colors:
1129~~~~~
72b7576f 1130reader.SetColorMode(mode);
1131// mode can be Standard_True or Standard_False
668c2575 1132~~~~~
1133* For transferring names:
1134~~~~~
72b7576f 1135reader.SetNameMode(mode);
1136// mode can be Standard_True or Standard_False
668c2575 1137~~~~~
1138@subsection occt_iges_5_4 Performing the translation of an IGES file to XDE
72b7576f 1139The following function performs a translation of the whole document:
668c2575 1140~~~~~
72b7576f 1141Standard_Boolean ok = reader.Transfer(doc);
668c2575 1142~~~~~
1143where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*.
1144
1145@subsection occt_iges_5_5 Initializing the process of translation from XDE to IGES
1146The process can be initialized as follows:
1147~~~~~
72b7576f 1148IGESCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False);
668c2575 1149~~~~~
1150@subsection occt_iges_5_6 Setting parameters for translation from XDE to IGES
1151
72b7576f 1152The following parameters can be set for translation of attributes to IGES:
668c2575 1153* For transferring colors:
1154~~~~~
72b7576f 1155aWriter.SetColorMode(mode);
1156// mode can be Standard_True or Standard_False
668c2575 1157~~~~~
1158* For transferring names:
1159~~~~~
72b7576f 1160aWriter.SetNameMode(mode);
1161// mode can be Standard_True or Standard_False
668c2575 1162~~~~~
1163@subsection occt_iges_5_7 Performing the translation of an XDE document to IGES
1164
72b7576f 1165You can perform the translation of a document by calling the function:
668c2575 1166~~~~~
72b7576f 1167IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
668c2575 1168~~~~~
1169where "doc" is a variable which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*.
1170
1171@subsection occt_iges_5_8 Writing an IGES file
72b7576f 1172Write an IGES file with:
668c2575 1173~~~~~
1174IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.igs");
1175~~~~~
72b7576f 1176or
668c2575 1177~~~~~
72b7576f 1178IFSelect_ReturnStatus statw = writer.WriteFile (S);
668c2575 1179~~~~~
1180where S is OStream.
72b7576f 1181
1182