1 IGES Support {#user_guides__iges}
6 @section occt_iges_1 Introduction
9 This 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>
11 IGES 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).
13 This 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.
17 File translation is performed in the programming mode, via C++ calls, and the resulting OCCT objects are shapes.
19 All 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.
21 @section occt_iges_2 Reading IGES
22 @subsection occt_iges_2_1 Procedure
23 You can translate an IGES file to an OCCT shape by following the steps below:
25 -# Check file consistency,
26 -# Set the translation parameters,
27 -# Perform the file translation,
29 @subsection occt_iges_2_2 Domain covered
30 @subsubsection occt_iges_2_2_1 Translatable entities
31 The types of IGES entities, which can be translated, are:
37 * Structure entities (groups). Each entity in the group outputs a shape. There can be a group of groups.
38 * Subfigures. Each entity defined in a sub-figure outputs a shape
39 * Transformation Matrix.
41 **Note** that all non-millimeter length unit values in the IGES file are converted to millimeters.
43 @subsubsection occt_iges_2_2_2 Attributes
44 Entity attributes in the Directory Entry Section of the IGES file (such as layers, colors and thickness) are translated to Open CASCADE Technology using XDE.
45 @subsubsection occt_iges_2_2_3 Administrative data
46 Administrative 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.
49 @subsection occt_iges_2_3 Description of the process
50 @subsubsection occt_iges_2_3_1 Loading the IGES file
51 Before performing any other operation, you have to load the file using the syntax below.
53 IGESControl_Reader reader;
54 IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
56 The loading operation only loads the IGES file into computer memory; it does not translate it.
58 @subsubsection occt_iges_2_3_2 Checking the IGES file
59 This step is not obligatory. Check the loaded file with:
61 Standard_Boolean ok = reader.Check(Standard_True);
63 The 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.
65 reader.PrintCheckLoad (failsonly, mode);
67 Error messages are displayed if there are invalid or incomplete IGES entities, giving you information on the cause of the error.
69 Standard_Boolean failsonly = Standard_True or Standard_False;
71 If you give True, you will see fail messages only. If you give False, you will see both fail and warning messages.
73 Your 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.
80 @subsubsection occt_iges_2_3_3 Setting translation parameters
81 The 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.
83 <h4>read.iges.bspline.continuity</h4>
84 manages 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).
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.
89 Read this parameter with:
91 Standard_Integer ic = Interface_Static::IVal("read.iges.bspline.continuity");
93 Modify this value with:
95 if (!Interface_Static::SetIVal ("read.iges.bspline.continuity",2))
100 This 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).
103 <h4>read.precision.mode</h4>
104 reads the precision value.
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.
108 Read this parameter with:
110 Standard_Integer ic = Interface_Static::IVal("read.precision.mode");
112 Modify this value with:
114 if (!Interface_Static::SetIVal ("read.precision.mode",1))
117 Default value is *File* (0).
119 <h4>read.precision.val</h4>
120 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.
122 This value is in the measurement unit defined in the IGES file header.
124 Read this parameter with:
126 Standard_Real rp = Interface_Static::RVal("read.precision.val");
128 Modify this parameter with:
130 if (!Interface_Static::SetRVal ("read.precision.val",0.001))
133 Default value is 0.0001.
135 The 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.
137 Value 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.
139 <h4>read.maxprecision.mode</h4>
140 defines the mode of applying the maximum allowed tolerance. Its possible values are:
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.
145 Read this parameter with:
147 Standard_Integer mv = Interface_Static::IVal("read.maxprecision.mode");
149 Modify this parameter with:
151 if (!Interface_Static::SetIVal ("read.maxprecision.mode",1))
154 Default value is *Preferred (0)*.
156 <h4>read.maxprecision.val</h4>
157 defines 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.
158 Read this parameter with:
160 Standard_Real rp = Interface_Static::RVal("read.maxprecision.val");
162 Modify this parameter with:
164 if (!Interface_Static::SetRVal ("read.maxprecision.val",0.1))
169 <h4>read.stdsameparameter.mode</h4>
170 defines 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*.
174 Read this parameter with:
176 Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode");
178 Modify this parameter with:
180 if (!Interface_Static::SetIVal ("read.stdsameparameter.mode",1))
183 Deafault value is 0 (Off).
185 <h4>read.surfacecurve.mode</h4>
186 preference for the computation of curves in case of 2D/3D inconsistency in an entity which has both 2D and 3D representations.
188 Here 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.
190 The 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.
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).
194 The 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:
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.
200 * *2DUse_Preferred (2)* : the 2D is used to rebuild the 3D in case of their inconsistency,
201 * *2DUse_Forced (-2)*: the 2D is always used to rebuild the 3D (even if 2D is present in the file),
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),
205 If 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.
207 The 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.
211 In any other case, the 2D representation is preferred to the 3D.
213 If 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.
215 Read this parameter with:
217 Standard_Integer ic = Interface_Static::IVal("read.surfacecurve.mode");
219 Modify this value with:
221 if (!Interface_Static::SetIVal ("read.surfacecurve.mode",3))
224 Default value is Default (0).
226 <h4>read.encoderegularity.angle</h4>
227 This 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.
229 Read this parameter with:
231 Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle");
233 Modify this parameter with:
235 if (!Interface_Static::SetRVal ("read.encoderegularity.angle",0.1))
238 Default value is 0.01.
240 <h4>read.iges.bspline.approxd1.mode</h4>
241 This 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.
243 Read this parameter with:
245 Standard_Real bam = Interface_Static::CVal("read.iges.bspline.approxd1.mode");
247 Modify this parameter with:
249 if (!Interface_Static::SetRVal ("read.encoderegularity.angle","On"))
252 Default value is Off.
255 <h4>read.iges.resource.name and read.iges.sequence</h4>
256 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 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.
258 Please 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> .
260 In 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.
263 * read.iges.resource.name - IGES,
264 * read.iges.sequence - FromIGES.
266 <h4>read.scale.unit</h4>
267 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.
271 <h4>xstep.cascade.unit</h4>
272 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.
276 @subsubsection occt_iges_2_3_4 Selecting entities
278 A list of entities can be formed by invoking the method *IGESControl_Reader::GiveList*.
280 Handle(TColStd_HSequenceOfTransient) list = reader.GiveList();
282 Several predefined operators can be used to select a list of entities of a specific type.
283 To 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:
284 1. Requesting the faces in the file:
286 faces = Reader.GiveList("iges-faces");
288 2. Requesting the visible roots in the file:
290 visibles = Reader.GiveList(iges-visible-roots);
292 3. Requesting the visible faces:
294 visfac = Reader.GiveList(iges-visible-roots,faces);
296 Using 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.
298 faces = Reader.GiveList(“xst-type(SurfaceOfRevolution)”);
299 faces = Reader.GiveList(“iges-type(120)”);
301 You can also look for:
302 * values returned by your signature which match your criterion exactly
304 faces = Reader.GiveList(“xst-type(=SurfaceOfRevolution)”);
306 * values returned by your signature which do not contain your criterion
308 faces = Reader.GiveList(“xst-type(!SurfaceOfRevolution)”);
310 * values returned by your signature which do not exactly match your criterion.
312 faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”);
315 <h4>List of predefined operators that can be used:</h4>
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.
336 @subsubsection occt_iges_2_3_5 Performing the IGES file translation
337 Perform translation according to what you want to translate:
338 1. Translate an entity identified by its rank with:
340 Standard_Boolean ok = reader.Transfer (rank);
342 2. Translate an entity identified by its handle with:
344 Standard_Boolean ok = reader.TransferEntity (ent);
346 3. Translate a list of entities in one operation with:
348 Standard_Integer nbtrans = reader.TransferList (list);
351 where *nbtrans* returns the number of items in the list that produced a shape and *reader.IsDone()* indicates whether at least one entity was translated.
352 4. Translate a list of entities, entity by entity:
354 Standard_Integer i,nb = list-Length();
355 for (i = 1; i = nb; i ++) {
356 Handle(Standard_Transient) ent = list-Value(i);
357 Standard_Boolean OK = reader.TransferEntity (ent);
360 5. Translate the whole file (all entities or only visible entities) with:
362 Standard_Boolean onlyvisible = Standard_True or Standard_False;
363 reader.TransferRoots(onlyvisible)
366 @subsubsection occt_iges_2_3_6 Getting the translation results
367 Each successful translation operation outputs one shape. A series of translations gives a series of shapes.
368 Each 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.
370 Standard_Integer nbs = reader.NbShapes();
372 returns the number of shapes recorded in the result.
374 TopoDS_Shape shape = reader.Shape(num);,
376 returns the result *num,* where *num* is an integer between 1 and *NbShapes*.
378 TopoDS_Shape shape = reader.Shape();
380 returns the first result in a translation operation.
382 TopoDS_Shape shape = reader.OneShape();
384 returns 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.
391 erases the existing results.
393 reader.PrintTransferInfo (failsonly, mode);
395 displays the messages that appeared during the last invocation of *Transfer* or *TransferRoots*.
397 If *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.
404 @subsection occt_iges_2_4 Mapping of IGES entities to Open CASCADE Technology shapes
406 *NOTE* that IGES entity types that are not given in the following tables are not translatable.
408 @subsubsection occt_iges_2_4_1 Points
410 | IGES entity type | CASCADE shape | Comments |
411 | :---------------- | :------------- | --------- |
412 | 116: Point | TopoDS_Vertex | |
414 @subsubsection occt_iges_2_4_2 Curves
415 Curves, which form the 2D of face boundaries, are translated as *Geom2D_Curves* (Geom2D circles, etc.).
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. |
430 The 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.
432 @subsubsection occt_iges_2_4_3 Surfaces
433 Translation of a surface outputs either a *TopoDS_Face* or a *TopoDS_Shell*.
434 If 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*.
436 | IGES entity type | CASCADE shape | Comments |
437 | :-------------- | :------------ | :--------- |
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.
441 Limitation: This translation cannot be completed when these two TopoDS_Wires are oriented in different directions. |
442 | 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). |
443 | 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). |
444 The Geom_Surface geometrical support is limited according to the generatrix.
445 128: BSpline Surface TopoDS_Face The geometrical support of the TopoDS_Face is a Geom_BsplineSurface.
446 140: Offset Surface TopoDS_Face
448 The translation of an Offset Surface outputs a TopoDS_Face whose geometrical support is a Geom_OffsetSurface.
451 For OCCT algorithms, the original surface must be C1-continuous so that the Geom_OffsetSurface can be created.
452 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.
453 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.
456 If the bounding curves define holes, natural bounds are not created.
457 If the orientation of the contours is wrong, it is not corrected.
458 144: Trimmed Surface TopoDS_Face
460 For the needs of interface processing, the basis surface must be a face.
461 Shells are only processed if they are single-face.
462 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.
463 If the orientation of the contours is wrong, it is corrected.
464 190: Plane Surface TopoDS_Face
465 This type of IGES entity can only be used in BRep entities in place of an IGES 108 type entity.
466 The geometrical support of the face is a Geom_Plane.
470 @subsubsection occt_iges_2_4_4 Boundary Representation Solid Entities
472 IGES entity type CASCADE shape Comments
473 186: ManifoldSolid TopoDS_Solid
474 514: Shell TopoDS_Shell
475 510: Face TopoDS_Face This is the lowest IGES entity in the BRep structure that can be specified as a starting point for translation.
476 508: Loop TopoDS_Wire
481 @subsubsection occt_iges_2_4_5 Structure Entities
483 IGES entity type CASCADE shape Comments
484 402/1: Associativity Instance: Group with back pointers
486 402/7: Associativity Instance: Group without back pointers TopoDS_Compound
487 402/9: Associativity Instance: Single Parent
489 The translation of a SingleParent entity is only performed for 402 form 9 with entities 108/1 and 108/-1.
490 The geometrical support for the TopoDS_Face is a Geom_Plane with boundaries:
491 - the parent plane defines the outer boundary,
492 - child planes define the inner boundaries.
496 @subsubsection occt_iges_2_4_6 Subfigures
498 IGES entity type CASCADE shape Comments
499 308: Subfigure Definition TopoDS_Compound This IGES entity is only translated when there are no Singular Subfigure Instance entities.
500 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.
504 @subsubsection occt_iges_2_4_7 Transformation Matrix
506 IGES entity type CASCADE shape Comments
507 124: Transformation Matrix Geom_Transformation This entity is never translated alone. It must be included in the definition of another entity.
510 @subsection occt_iges_2_5 Messages
511 Messages are displayed concerning the normal functioning of the processor (transfer, loading, etc.).
512 You must declare an include file:
514 #includeInterface_DT.hxx
517 You have the choice of the following options for messages:
519 IDT_SetLevel (level);
521 level modifies the level of messages:
523 * 1: raise and fail messages are displayed, as are messages concerning file access,
524 * 2: warnings are also displayed.
526 IDT_SetFile (“tracefile.log”);
528 prints the messages in a file,
532 restores screen output.
534 @subsection occt_iges_2_6 Tolerance management
535 @subsubsection occt_iges_2_6_1 Values used for tolerances during reading IGES
537 During 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.
539 <h4>3D (spatial) tolerances</h4>
541 * Package method *Precision\::Confusion* equal to 10<sup>-7</sup> is used as a minimal distance between points, which are considered distinct.
542 * 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.
543 * 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").
544 * 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.
545 * 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*.
547 <h4>2D (parametric) tolerances</h4>
549 * 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.
550 * 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).
551 * 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.
552 * Methods *Resolution(tolerance3d)* of the class *GeomAdaptor_Curve* or *BRepAdaptor_Curve* return tolerance in the parametric space of a curve computed from 3d tolerance.
554 <h4>Zero-dimensional tolerances</h4>
555 * 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>.
557 @subsubsection occt_iges_2_6_2 Initial setting of tolerances in translating objects
559 Transfer 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.
561 This object contains three tolerances: *Epsilon, EpsGeom* and *EpsCoeff*.
563 Parameter *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.
565 Parameter *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*.
567 Parameter *EpsCoeff* is set by default to 10<sup>-6</sup> and is not changed.
569 During 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.
571 @subsubsection occt_iges_2_6_3 Transfer process
572 <h4>Translating into Geometry</h4>
573 Geometrical 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*.
575 Since 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).
577 Use of precision parameters is reflected in the following classes:
578 * *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).
579 * *IGESToBRep_BasicCurve::TransferBSplineCurve* - all weights of *BSplineCurve* are assumed to be more than *Precision::PConfusion* (else the curve is not translated).
580 * *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>.
581 * *IGESToBRep_BasicSurface::TransferBSplineSurface* - all weights of *BSplineSurface* are assumed to be more than *Precision::PConfusion* (else the surface is not translated).
584 <h4>Translating into Topology</h4>
586 IGES 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*.
588 Class *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.
590 Although 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.
592 The following classes show what default tolerances are used when creating shapes and how they are updated during transfer.
594 <h5>Class IGESToBRep_TopoCurve</h5>
596 All 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>.
597 * *IGESToBRep_TopoCurve::TransferPoint* - vertex is constructed from a Point entity with tolerance *EpsGeom*UnitFactor*.
598 * *IGESToBRep_TopoCurve::Transfer2dPoint* - vertex is constructed from a Point entity with tolerance *EpsCoeff*.
599 * *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*.
600 * *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*.
601 * *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*.
604 <h5>Class IGESToBRep_TopoSurface</h5>
606 All faces created by this class have tolerance *Precision::Confusion*.
608 <h5>Class IGESToBRep_BRepEntity</h5>
610 * *IGESToBRep_BRepEntity::TransferVertex* - the vertices from the *VertexList* entity are constructed with tolerance *EpsGeom*UnitFactor*.
611 * *IGESToBRep_BRepEntity::TransferEdge* - the edges from the *EdgeList* entity are constructed with tolerance *Precision::Confusion*.
612 * *IGESToBRep_BRepEntity::TransferLoop* - this function works like *IGESToBRep_TopoCurve::TransferCurveOnFace* and *IGESToBRep_TopoCurve::TransferBoundaryOnFace*.
613 * *IGESToBRep_BRepEntity::TransferFace* the face from the Face IGES entity is constructed with tolerance *Precision::Confusion*.
615 <h5>Shape Healing classes</h5>
616 After 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.
617 Class *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()* ).
619 @subsection occt_iges_2_7 Code architecture
621 The following diagram illustrates the structure of calls in reading IGES.
622 The highlighted classes produce OCCT geometry.
624 @image html /user_guides/iges/images/iges_image003.png "The structure of calls in reading IGES"
625 @image latex /user_guides/iges/images/iges_image003.png "The structure of calls in reading IGES"
627 @subsection occt_iges_2_8 Example
630 #include “IGESControl_Reader.hxx”
631 #include “TColStd_HSequenceOfTransient.hxx”
632 #include “TopoDS_Shape.hxx”
634 IGESControl_Reader myIgesReader;
635 Standard_Integer nIgesFaces,nTransFaces;
637 myIgesReader.ReadFile (“MyFile.igs”);
638 //loads file MyFile.igs
640 Handle(TColStd_HSequenceOfTransient) myList = myIgesReader.GiveList(“iges-faces”);
641 //selects all IGES faces in the file and puts them into a list called //MyList,
643 nIgesFaces = myList-Length();
644 nTransFaces = myIgesReader.TransferList(myList);
647 cout“IGES Faces: “nIgesFaces“ Transferred:”nTransFacesendl;
648 TopoDS_Shape sh = myIgesReader.OneShape();
649 //and obtains the results in an OCCT shape.
653 @section occt_iges_3 Writing IGES
654 @subsection occt_iges_3_1 Procedure
656 You can translate OCCT shapes to IGES entities in the following steps:
657 1. Initialize the process.
658 2. Set the translation parameters,
659 3. Perform the model translation,
660 4. Write the output IGES file.
662 You can translate several shapes before writing a file. Each shape will be a root entity in the IGES model.
664 @subsection occt_iges_3_2 Domain covered
665 There are two families of OCCT objects that can be translated:
669 @subsection occt_iges_3_3 Description of the process
670 @subsubsection occt_iges_3_3_1 Initializing the process
672 Choose the unit and the mode you want to use to write the output file as follows:
673 * *IGESControl_Controller::Init* performs standard initialization. Returns False if an error occurred.
674 * *IGESControl_Writer writer* uses the default unit (millimeters) and the default write mode (Face).
675 * *IGESControl_Writer writer (UNIT)* uses the Face write mode and any of the units that are accepted by IGES.
676 * *IGESControl_Writer writer (UNIT,modecr)* uses the unit (accepted by IGES) and the write mode of your choice.
679 The result is an *IGESControl_Writer* object.
681 @subsubsection occt_iges_3_3_2 Setting the translation parameters
683 The following parameters are used for the OCCT-to-IGES translation.
685 * *write.iges.brep.mode:* allows choosing the write mode:
686 * "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,
687 * "BRep" (1): OCCT *TopoDS_Faces* will be translated into IGES 510 (Face) entities, the IGES file will contain B-Rep entities.
688 Read this parameter with:
690 Standard_Integer byvalue = Interface_Static::IVal("write.iges.brep.mode");
692 Modify this parameter with:
694 Interface_Static::SetIVal ("write.iges.brep.mode", 1);
696 Default value is "Faces" (0).
697 * *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).
698 * *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.
699 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.unit")*;
700 * Modify this parameter with *Interface_Static::SetCVal ("write.iges.unit", "INCH");*
701 * *write.iges.header.autor:* gives the name of the author of the file. The default value is the system name of the user.
702 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.author")*;
703 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.author", "name")*;
704 * *write.iges.header.company:* gives the name of the sending company. The default value is "" (empty).
705 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.company");*
706 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.company", "Open CASCADE");*
707 * *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.
708 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.product")*;
709 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.product", "product name")*;
710 * *write.iges.header.receiver:* - gives the name of the receiving company. The default value is "" (empty).
711 * Read this parameter with *Standard_String byvalue = Interface_Static::CVal("write.iges.header.receiver");*
712 * Modify this value with *Interface_Static::SetCVal ("write.iges.header.receiver", "reciever name");*
713 * *write.precision.mode:* specifies the mode of writing the resolution value into the IGES file.
714 * "Least" (-1): resolution value is set to the minimum tolerance of all edges and all vertices in an OCCT shape.
715 * "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.
716 * "Greatest" (1): resolution value is set to the maximum tolerance of all edges and all vertices in an OCCT shape.
717 * "Session" (2): resolution value is that of the write.precision.val parameter.
719 * Read this parameter with *Standard_Integer ic = Interface_Static::IVal("write.precision.mode");*
720 * Modify this parameter with *if (!Interface_Static\::SetIVal("write.precision.mode",1)) .. error .. *
721 * *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.
723 Read this parameter with:
725 Standard_Real rp = Interface_Static::RVal(;write.precision.val;);
727 Modify this parameter with:
729 if (!Interface_Static::SetRVal(;write.precision.val;,0.01))
732 Default value is 0.0001.
733 <h4>write.iges.resource.name</h4>
734 <h4>write.iges.sequence</h4>
735 The same as read.iges.*, please see above. Note that the default sequence for writing contains one operator – DirectFaces - which converts elementary surfaces based on left-hand axes (valid in CASCADE) to right-hand axes (which are valid only in IGES).
736 Default values : write.iges.resource.name – IGES, write.iges.sequence – ToIGES.
737 @subsubsection occt_iges_333 Performing the Open CASCADE Technology shape translation
738 You can perform the translation in one or several operations. Here is how you translate topological and geometrical objects:
739 Standard_Boolean ok = writer.AddShape (shape);
740 where shape is a TopoDS_Shape.
741 ok is True if translation was correctly performed and False if there was at least one entity that was not translated.
742 Standard_Boolean ok = writer.AddGeom (geom);
743 where geom is either Handle(Geom_Curve) or Handle(Geom_Surface)
744 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.
745 @subsubsection occt_iges_334 Writing the IGES file
746 Write the IGES file with:
747 Standard_Boolean ok = writer.Write (;filename.igs;);
748 to give the file name.
749 Standard_Boolean ok = writer.Write (S);
750 where S is Standard_OStream
751 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).
752 @subsection occt_iges_34 Mapping Open CASCADE Technology shapes to IGES entities
753 Translated 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.
754 @subsubsection occt_iges_341 Curves
755 @subsubsection occt_iges_342 Surfaces
757 @subsubsection occt_iges_343 Topological entities
758 <h5>Translation in Face mode</h5>
760 <h5>Translation in BRep mode</h5>
761 @subsection occt_iges_35 Tolerance management
762 @subsubsection occt_iges_351 Setting resolution in an IGES file
763 There 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 3.3.2 Setting the translation parameters.
764 If 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.
766 @subsection occt_iges_36 Code architecture
767 @subsubsection occt_iges_361 List of the classes
768 <h5>package IGESControl </h5>
769 IGESControl_Controller
771 <h5>package BRepToIGES </h5>
776 <h5>package BRepToIGESBRep </h5>
777 BRepToIGESBRep_Entity
778 <h5>package GeomToIGES </h5>
780 GeomToIGES_GeomVector
782 GeomToIGES_GeomSurface
783 <h5>package Geom2dToIGES </h5>
784 Geom2dToIGES_Geom2dCurve
785 <h5>package IGESConvGeom </h5>
786 IGESConvGeom_GeomBuilder
787 For description of classes refer to CDL.
788 @subsubsection occt_iges_362 List of API classes
789 <h5>package IGESControl</h5>
790 * IGESControl_Controller
792 <h5>package IGESData</h5>
793 * class IGESData_IGESModel
794 * class IGESData_IGESEntity
795 For details refer to 4. API for reading/writing IGES and CDL.
796 @subsubsection occt_iges_363 Graph of calls
797 The following diagram illustrates the class structure in writing IGES.
798 The highlighted classes are intended to translate geometry.
800 @image html /user_guides/iges/images/iges_image004.png
801 @image latex /user_guides/iges/images/iges_image004.png
803 @subsection occt_iges_37 Example
806 #include IGESControl_Controller.hxx
807 #include IGESControl_Writer.hxx
808 #include TopoDS_Shape.hxx
809 Standard_Integer main()
811 IGESControl_Controller::Init();
812 IGESControl_Writer ICW (;MM;, 0);
813 //creates a writer object for writing in Face mode with millimeters
816 //adds shape sh to IGES model
818 Standard_Boolean OK = ICW.Write (;MyFile.igs;);
819 //writes a model to the file MyFile.igs
823 @section occt_1856844696_1288309531 API for reading/writing IGES
824 @subsection occt_1856844696_12883095311 Overview
826 API classes provides the following tools:
827 * loading IGES files into memory,
828 * checking IGES files consistency,
829 * translating IGES files into OCCT shapes,
830 * translating OCCT shapes into IGES files,
831 * accessing the IGES model (which is an image of the IGES file in memory),
832 * selecting entities from the IGES model,
833 * accessing each entity in the IGES model.
834 @subsection occt_1856844696_12883095312 Package IGESControl
835 @subsubsection occt_1856844696_128830953121 General description
836 This package is intended to provide a tool to convert IGES-format entities to OCCT shapes and vice versa.
837 The package allows the end-user to perform both import from and export to an IGES file.
838 IGES files up to and including IGES version 5.3 can be read.
839 IGES files that are produced by this component conform to IGES version 5.3.
840 The result of reading IGES files is either a single Open CASCADE Technology shape or a set of them, the result of exporting Open CASCADE Technology geometric or topologic objects is an IGES file which may include one or several root entities (the ones not referenced by others).
841 @subsubsection occt_1856844696_128830953122 Class IGESControl_Controller
842 <h4>General description </h4>
843 This class controls the IGES norm.
844 This class is intended to provide an appropriate initialization of the IGES norm, namely it includes a set of necessary parameters for IGES translation and declaration of possible selections for IGES entities.
845 After the execution of initialization procedures, the use of IGES norm becomes available.
851 <h5>Constructors</h5>
852 IGESControl_Controller(const Standard_Boolean modefnes = Standard_False);
853 Purpose: Initializes the use of IGES (if modefnes is False) or FNES (if modefnes is True) norm.
854 <h5>Method for performing initialization</h5>
856 static Standard_Boolean Init() ;
857 Purpose: Performs standard initialization creating controller objects for both IGES and FNES norm.
858 Returns True when done, False if an error occurred.
859 <h5>Method for creating IGES model</h5>
860 IGESControl:: NewModel
861 Handle_Interface_InterfaceModel NewModel() const;
862 Purpose: Creates a new empty model ready to receive data of the norm. The Global section is filled with static parameters (receiver, author, company and unit).
863 <h5>Method for getting the actor object</h5>
864 IGESControl:: ActorRead
865 Handle_Transfer_ActorOfTransientProcess ActorRead( const Handle(Interface_InterfaceModel)& model) const;
866 Purpose: Returns the actor object for reading (actually, it is of type IGESToBRep_Actor) with a set parameter of spline continuity taken from static parameter.
867 <h5>Method for translating an Open CASCADE Technology shape</h5>
868 IGESControl:: TransferWriteShape
869 virtual IFSelect_ReturnStatus TransferWriteShape(const TopoDS_Shape& shape, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model, const Standard_Integer modetrans = 0) const;
870 Purpose: Translates shape into the interface model.
871 modetrans: 0 - group of Faces (IGES 5.1) , 1 - for BRep (IGES = 5.1)
873 IFSelect_RetDone: OK,
874 IFSelect_RetError: if modetrans is not equal to 0 or 1, or model is not an IGES model.
875 IFSelect_Fail: if shape is null.
877 @subsubsection occt_1856844696_128830953123 Class IGESControl_Reader
878 <h4>General description</h4>
879 This object reads IGES files and translates their contents into OCCT shapes.
880 All definitions in IGES version 5.3 are recognized but only geometric and topologic entities can be translated. Data, which cannot be translated, is loaded with the file but during translation it is ignored.
881 The translation of the IGES model into the OCCT model goes through the following steps:
882 * loading a file into memory,
883 * checking file consistency,
884 * setting translation parameters,
885 * performing the translation itself,
886 * fetching the results.
888 The resulting OCCT objects belong to topologic shapes. The geometric objects (2D and 3D) are constructed in intermediate steps and serve as a support for topologic entities.
889 Each successful translation operation outputs one shape. A series of translations gives a list of shapes.
892 This class complements IGESToBRep_Reader class:
893 * deals directly with WorkSession object,
894 * computes the list of IGES entities matching specified criteria,
895 * performs translation of a list of entities and the ones specified by handle,
896 * outputs the results of checking and translating.
898 <h5>Constructors: </h5>
899 * IGESControl_Reader ();
900 Purpose: Creates a reader from scratch and with a new WorkSession object.
901 * IGESControl_Reader (const Handle(XSControl_WorkSession)& WS,
902 const Standard_Boolean scratch);
903 Purpose: Defines work session for the reader. If scratch is True the new model will be created in the work session.
904 <h5>Methods for dealing with WorkSession object </h5>
905 * IGESControl_Reader::SetWS
906 void SetWS ( const Handle(XSControl_WorkSession)& WS,
907 const Standard_Boolean scratch = Standard_True);
908 Purpose: Defines the work session for the reader.
909 If scratch is True the new model will be created in the work session object.
910 * IGESControl_Reader::WS
911 Handle_XSControl_WorkSession() const;
912 Purpose: Returns the used work session object.
913 <h5>Method for loading an IGES file into memory </h5>
914 * IGESControl_Reader::ReadFile
915 IFSelect_ReturnStatus ReadFile(const Standard_CString filename);
916 Purpose: Loads and memorizes an IGES file in memory.
918 IFSelect_RetDone: the file was successfully read
919 IFSelect_RetVoid: no file found
920 IFSelect_RetError: an error occurred during reading
922 IGESToBRep_Reader::LoadFile()
924 <h5>Methods for selecting entities to transfer</h5>
925 * IGESControl_Reader::GiveList
926 Handle_TColStd_HSequenceOfTransient GiveList( const Standard_CString first = ;;, const Standard_CString second = ;;);
927 Purpose: Returns a list of entities from the model according to the following rules:
928 * if first and second are empty - the list of roots for transfer,
929 * if first is a number or label of an entity - this entity itself,
930 * if first is a list of numbers/labels separated by commas - these entities,
931 * if first is a name of a selection in work session and second is not defined - the standard result of this selection,
932 * if first is a name of a selection and second is defined - the criterion defined by second is applied to result of first selection
934 if second is erroneous it is ignored.
935 Handle_TColStd_HSequenceOfTransient GiveList( const Standard_CString first, const Handle(Standard_Transient)& ent) ;
936 Purpose: Returns a list of entities from the model according to the following rules:
937 * if first is a selection name and second is an entity or a list of entities (as a HSequenceOfTransient) - the standard result of this selection is applied to this list.
939 if first is erroneous, a null handle is returned.
940 <h5>Methods for performing translation</h5>
941 * IGESControl_Reader::TransferEntity
942 Standard_Boolean TransferEntity(const Handle(Standard_Transient)& start) ;
943 Purpose: Performs the translation of the entity specified by its handle.
944 Returns False if an entity is not in the Model, else returns the result of the transfer.
945 * IGESControl_Reader:: TransferList
946 Standard_Integer TransferList( const Handle(TColStd_HSequenceOfTransient)& list) ;
947 Purpose: Performs the translation of the list of entities.
948 Returns the number of successful transfers.
949 <h5>Methods for printing statistics</h5>
950 * IGESControl_Reader:: PrintCheckLoad
951 void PrintCheckLoad( const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const ;
952 Purpose: Displays the check results on file entities.
953 If failsonly is True prints only "Fail" messages, otherwise all messages.
954 mode determines the contents and the order of messages:
955 IFSelect_ItemsByEntity - sequential list of messages per entity,
956 IFSelect_CountByItem - counts the number of entities per message,
957 IFSelect_ShortByItem - the same function but also of the first five entities,
958 IFSelect_ListByItem - the same but displays the rank numbers of all (not only five) entities,
959 IFSelect_EntitiesByItem - the same plus it displays the Directory Entry number for each entity
960 * IGESControl_Reader:: PrintCheckTransfer
961 void PrintCheckTransfer( const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const;
962 Purpose: Displays the checking results of the last transfer.
963 The parameters play the same role as in PrintCheckLoad.
964 * IGESControl_Reader:: PrintStatsTransfer
965 void PrintStatsTransfer( const Standard_Integer what, const Standard_Integer mode = 0) const;
966 Purpose: Displays all available statistics of the last transfer on the default trace file. The returned information is filtered by giving parameters.
967 what defines what kind of statistics are to be printed:
970 2 - all recorded (roots, intermediate, checked entities),
971 3 - abnormal records,
972 4 - warnings and fails messages,
973 5 - only fail messages
974 mode is used according to what:
975 if what is 0 mode is ignored
976 if what is 1, 2 or 3 mode defines the following:
977 0 - lists numbers of concerned entities in the model,
978 1 - for each entity, gives the number, label, type and result type and/or status (fail / warning...),
979 2 - for each entity, gives the maximum information (check result),
980 3 - counts per type of starting entity (class type),
981 4 - counts per result type and/or status,
982 5 - counts per couple (starting type / result type/status),
983 6 – does the same thing plus gives for each item, the list of numbers of entities in the starting model
984 if what is 4 or 5 - mode is treated as enumeration IFSelect_PrintCount.
985 * IGESControl_Reader:: PrintTransferInfo
986 void PrintTransferInfo( const IFSelect_PrintFail failwarn, const IFSelect_PrintCount mode) const;
987 Purpose: Displays information concerning the last transfer on the default trace file according to the given parameters:
988 mode defines what will be printed:
989 IFSelect_GeneralCount - general statistics (number of selected IGES entities, number of root IGES entities, number of resulting OCCT shapes, number of fail and warning messages),
990 IFSelect_CountByItem - number of IGES entities per each message type and IGES type and form,
991 IFSelect_ListByItem - number and a complete list of DE numbers of IGES entities per each message type and IGES type and form,
992 IFSelect_ResultCount - number of resulting OCCT shapes per each type of the shape,
993 IFSelect_Mapping - mapping of root IGES entities into OCCT shapes per IGES type and form and OCCT shape type.
994 failwarn defines if only fail messages (if failwarn is IFSelect_FailOnly) or both fail and warning messages (if it is IFSelect_FailAndWarn) will be printed if mode is IFSelect_CountByItem or IFSelect_ListByItem.
995 @subsubsection occt_1856844696_128830953124 Class IGESControl_Writer
996 <h4>General description </h4>
997 This class is intended to create and write an IGES file out of OCCT models.
998 IGES files produced by this component conform to IGES version 5.3.
999 This component gives a possibility to write an IGES file containing either geometric entities (conformant to IGES version less than 5.1) only or BRep entities (conformant to IGES version up to and including 5.3) as well. The writing mode is chosen by specifying the appropriate parameter.
1000 The translation of an OCCT model (which can be a 2D or 3D geometric object or a topologic shape) into an IGES file is fulfilled in the following steps:
1001 1. initializing the file,
1002 2. setting the translation parameters,
1003 3. performing the translation itself,
1004 4. writing the IGES file.
1005 Export to the IGES file can be performed on the basis of either an already existing IGES model (representation of the IGES file in memory) or a new one. The former case gives an opportunity to add geometric/topologic OCCT objects into an IGES model (file) that already exists.
1007 <h5>Constructors:</h5>
1008 * IGESControl_Writer();
1009 Purpose: Creates a writer object with the default unit and write mode (Face).
1010 * IGESControl_Writer( const Standard_CString unit, const Standard_Integer modecr = 0 );
1011 Purpose: Creates a writer object with the given values for the unit and write mode.
1012 unit is the name of the units that are accepted by IGES in the upper case ("IN" or "INCH" for inches, "MM" for millimeters and so on),
1013 modecr corresponds to write mode:
1016 * IGESControl_Writer( const Handle(IGESData_IGESModel)& model,
1017 const Standard_Integer modecr = 0);
1018 Purpose: Creates a writer object with an already prepared IGES model and write mode.
1019 <h5>Methods dealing with IGES models</h5>
1020 * IGESControl_Writer:: Model
1021 Handle_IGESData_IGESModel Model() const;
1022 Purpose: Returns the produced model.
1023 * IGESControl_Writer:: ComputeModel() ;
1024 void ComputeModel() ;
1025 Purpose: Prepares the model before writing by setting the required statuses inside the model.
1026 <h5>Methods dealing with transfer processes</h5>
1027 * IGESControl_Writer:: SetTransferProcess
1028 void SetTransferProcess(const Handle(Transfer_FinderProcess)& TP) ;
1029 Purpose: Sets the FinderProcess object for the writer.
1030 * IGESControl_Writer:: TransferProcess
1031 Handle_Transfer_FinderProcess TransferProcess() const;
1032 Purpose: Returns the FinderProcess object (containing final results and messages if any).
1033 <h5>Methods for performing translation</h5>
1034 * IGESControl_Writer:: AddShape
1035 Standard_Boolean AddShape(const TopoDS_Shape& sh) ;
1036 Purpose: Translates a shape sh to IGES entities and adds them to the model.
1037 Returns True if done, False if sh is not suitable for IGES or is null.
1038 * IGESControl_Writer:: AddGeom
1039 Standard_Boolean AddGeom(const Handle(Standard_Transient)& geom) ;
1040 Purpose: Translates geom (which must be a curve or a surface) to IGES entities and adds them to the model.
1041 Returns True if done, False if geom is neither a surface nor a curve suitable for IGES or is null.
1042 * IGESControl_Writer:: AddEntity
1043 Standard_Boolean AddEntity(const Handle(IGESData_IGESEntity)& ent) ;
1044 Purpose: Adds an IGES entity (and the ones it references) to the model.
1045 Returns False if ent is null.
1046 <h5>Methods for writing an IGES file</h5>
1047 * IGESControl_Writer:: Write
1048 Standard_Boolean Write( Standard_OStream& S, const Standard_Boolean fnes = Standard_False) ;
1049 Standard_Boolean Write( const Standard_CString file, const Standard_Boolean fnes = Standard_False) ;
1050 Purpose: Prepares (call ComputeModel()) and writes the model to the stream S or to the file file.
1051 Returns True if the operation was correctly performed, False in case of error.
1052 If mode fnes is equal to True, the resulting file will be written in the FNES format.
1053 <h5>Method for obtaining statistics</h5>
1054 * IGESControl_Writer:: PrintStatsTransfer
1055 void PrintStatsTransfer( const Standard_Integer what, const Standard_Integer mode = 0) const;
1056 Purpose: Intended to display all statistics on the last performed translation.
1057 Remarks: At the present moment does nothing (an empty method).
1060 @subsubsection occt_1856844696_128830953125 General description
1061 Performs the actual translation of IGES entities into OCCT objects.
1062 This package recognizes an IGES entity, performs its translation into an OCCT object (which can be 2D or 3D geometric objects, topologic shapes or transformation matrices) and returns the resulting shapes with associated messages (if there are any) occurred during the translation.
1063 Those IGES entities that can be translated into OCCT objects by this package are given in the following table:
1065 Finally, all geometric IGES entities (curves and surfaces) are translated into topologic shapes. OCCT geometric objects serve as a support for topology.
1066 @subsubsection occt_1856844696_128830953126 Class IGESToBRep_Reader
1067 <h4>General description</h4>
1068 This class reads IGES files and translates their contents into OCCT shapes.
1069 This class provides basic tools for loading, checking and translating IGES files into OCCT topologic shapes. It is complemented with more high-level features by class IGESControl_Reader.
1070 The functionalities provided by this class are the following:
1071 * loading a file into memory,
1072 * checking an IGES model in memory,
1073 * translating all root entities or one entity specified by its rank number into OCCT shapes,
1074 * fetching the results.
1077 <h5>Constructors: </h5>
1078 * IGESToBRep_Reader();
1079 Purpose: Performs initialization calling IGESAppli::Init() and IGESSolid::Init(), creates a new Actor object for transfer.
1081 <h5>Method for loading an IGES file into memory</h5>
1082 * IGESToBRep_Reader:: LoadFile
1083 Standard_Integer LoadFile(const Standard_CString filename) ;
1084 Purpose: Loads an IGES file filename into memory calling IGESFile_Read(), sets the returned IGES model (representing the loaded IGES file) calling SetModel().
1085 <h5>Method for checking an IGES file</h5>
1086 * IGESToBRep_Reader:: Check
1087 Standard_Boolean Check(const Standard_Boolean withprint) const;
1088 Purpose: Performs checking of a loaded IGES file calling Interface_CheckTool and Interface_CheckIterator. If withprint is True outputs the results of checking to the default trace file.
1089 <h5>Methods for preparing the transfer process</h5>
1090 * IGESToBRep_Reader:: SetModel
1091 void SetModel(const Handle(IGESData_IGESModel)& model) ;
1092 Purpose: Sets a new IGES model object. Clears the list of translated shapes (if there are any), sets a new transfer process object.
1093 * IGESToBRep_Reader:: Model
1094 Handle_IGESData_IGESModel Model() const;
1095 Purpose: Returns the used IGES model object.
1096 * IGESToBRep_Reader:: SetTransientProcess
1097 void SetTransientProcess(const Handle(Transfer_TransientProcess)& TP) ;
1098 Purpose: Sets the transfer process object.
1099 * IGESToBRep_Reader:: TransientProcess
1100 Handle_Transfer_TransientProcess TransientProcess() const;
1101 Purpose: Returns the used transfer process object.
1102 * IGESToBRep_Reader:: Actor
1103 Handle_IGESToBRep_Actor Actor() const;
1104 Purpose: Returns the used actor object.
1105 * IGESToBRep_Reader::Clear
1107 Purpose: Clears the list of translated shapes.
1108 <h5>Methods for translation</h5>
1109 * IGESToBRep_Reader:: TransferRoots
1110 void TransferRoots(const Standard_Boolean onlyvisible = Standard_True)
1111 Purpose: Performs the translation of root entities (ones that are not referenced by others). If onlyvisible is True, translates only visible entities (with Blank status equal to 0). Sets the continuity in accordance with the static parameter read.iges.bspline.continuity.
1112 If parameter read.maxprecision.mode is set to 1, calls to ShapeTool_Utils::LimitTolerance() for the resulting shape with parameters 0 and the maximum between read.maxprecision.val and the basis tolerance of processor.
1113 * IGESToBRep_Reader:: Transfer
1114 Standard_Boolean Transfer(const Standard_Integer num) ;
1115 Purpose: Performs the translation of an entity specified by its rank number.
1116 Creates an object of class IGESToBRep_CurveAndSurface and sets:
1117 3D precision (taking its value either from the file or from the work session in accordance with the static parameter read.precision.mode),
1118 the approximation mode parameter in accordance with static the parameter read.iges.bspline.approxd1.mode,
1119 the mode for a preferred computation of curves on a surface in accordance with the static parameter read.surfacecurve.mode,
1120 the spline continuity parameter in accordance with the static parameter read.iges.bspline.continuity,
1121 the transfer process object taken from itself.
1122 Once all the fields have been filled out this method calls method TransferGeometry() with the IGES entity calculated by its rank number to obtain the OCCT shape.
1123 Like method TransferRoots() this one also limits the tolerance if the static parameter read.maxprecision.mode is set to 1.
1124 Returns False if num is greater than the number of entities in the model or less than 1, otherwise returns True even if there was an exception during the transfer.
1125 <h5>Methods for fetching the results</h5>
1126 * IGESToBRep_Reader:: IsDone
1127 Standard_Boolean IsDone() const;
1128 Purpose: Returns True if the last transfer was successful.
1129 * IGESToBRep_Reader:: NbShapes
1130 Standard_Integer NbShapes() const;
1131 Purpose: Returns the number of shapes recorded in the result.
1132 * IGESToBRep_Reader:: Shape
1133 TopoDS_Shape Shape(const Standard_Integer num = 1) const;
1134 Purpose: Returns the result number num where num is an integer between 1 and NbShapes(). If not returns a null shape.
1135 * IGESToBRep_Reader:: OneShape
1136 TopoDS_Shape OneShape() const;
1137 Purpose: Returns all results in a single shape, which is:
1138 * a null shape if there are no results,
1139 * in the case of a single result, only that shape,
1140 * a compound that lists all the results if there are several resulting shapes.
1141 @subsection occt_1856844696_12883095313 Package IGESData
1142 @subsubsection occt_1856844696_128830953131 General description
1143 This package defines general objects for dealing with the IGES interface.
1144 It gives a basic description of the IGES interface:
1145 * defines the Model for IGES (class IGESData_IGESModel),
1146 * defines the Protocol tool specific for IGES (class IGESData_Protocol)
1147 * defines the basic class IGESData_IGESEntity describing abstract IGES entity
1148 * defines classes derived from IGESEntity and representing general IGES entities (IGESData_LineFontEntity, IGESData_TransfEntity, IGESData_SingleParentEntity, etc.),
1149 @subsubsection occt_1856844696_128830953132 Class IGESData_IGESModel
1150 <h4>General description </h4>
1151 Gives an access to the general data in the Start and the Global sections of an IGES file.
1152 Defines a model specific for IGES.
1153 An IGES file includes the following sections:
1160 Interface_InterfaceModel
1164 <h5>Constructor</h5>
1165 * IGESData_IGESModel ();
1166 Purpose: Creates an empty IGES Model.
1167 <h5>Methods for initializing</h5>
1168 * IGESData_IGESModel::ClearHeader
1169 void ClearHeader() ;
1170 Purpose: Erases all the data in the Start and Global sections.
1171 * IGESData_IGESModel::NewEmptyModel
1172 Handle_Interface_InterfaceModel NewEmptyModel() const;
1173 Purpose: Returns a new Empty Model of the same type as this object, i.e. of type IGESData_IGESModel.
1174 <h5>Methods for dealing with the Start and the Global sections</h5>
1175 * IGESData_IGESModel::DumpHeader
1176 void DumpHeader(Standard_OStream& S, const Standard_Integer level = 0) const;
1177 Remark: the Integer parameter is intended to be used as a level indicator, but not used for the moment.
1178 * IGESData_IGESModel::StartSection
1179 Handle_TColStd_HSequenceOfHAsciiString StartSection() const;
1180 Purpose: Returns the Start section of the Model as a list of lines.
1181 * IGESData_IGESModel::NbStartLines
1182 Standard_Integer NbStartLines() const;
1183 Purpose: Returns the number of the lines in the Start section.
1184 * IGESData_IGESModel::StartLine
1185 Standard_CString StartLine(const Standard_Integer num) const;
1186 Purpose: Returns a line from the Start section specified by number num.
1187 Remark: An empty string is returned if number num is out of range [1, NbStartLines()].
1188 * IGESData_IGESModel::ClearStartSection
1189 void ClearStartSection() ;
1190 Purpose: Clears the Start section.
1191 * IGESData_IGESModel::SetStartSection
1192 void SetStartSection(const Handle(TColStd_HSequenceOfHAsciiString)& list, const Standard_Boolean copy = Standard_True) ;
1193 Purpose: Sets a new Start section from the list of strings list, copying it if copy is True (by default) or pointing to the list if copy is False.
1194 * IGESData_IGESModel::AddStartLine
1195 void AddStartLine(const Standard_CString line, const Standard_Integer atnum = 0) ;
1196 Purpose: Adds a new string to the end of the existing Start section if atnum is 0 or not given, or before the atnum-th line.
1197 Remark: If a number is out of range [0, NbStartLines()], the line is added at the end of section.
1198 * IGESData_IGESModel::GlobalSection
1199 const IGESData_GlobalSection& GlobalSection() const;
1200 Purpose: Returns the Global section of the Model.
1201 * IGESData_IGESModel::SetGlobalSection.
1202 void SetGlobalSection(const IGESData_GlobalSection& header) ;
1203 Purpose: Sets the Model's Global section.
1204 * IGESData_IGESModel::ApplyStatic
1205 Standard_Boolean ApplyStatic(const Standard_CString param = ;;) ;
1206 Purpose: Sets some parameters of the Global section to those defined by static parameters (see parameters of translation). The allowed values for param (all by default) are: receiver, author and company (these are acronyms of static parameters). Returns True when done and if param is given, False if param is unknown or empty.
1207 Remark: To set a unit into the Global section use the IGESData_BasicEditor class.
1208 See also: User’s Guide: Parameters of translation.
1209 * IGESData_IGESModel::GetFromAnother
1210 void GetFromAnother(const Handle(Interface_InterfaceModel)& other) ;
1211 Purpose: Takes the Global section from another Model.
1212 * IGESData_IGESModel::VerifyCheck
1213 virtual void VerifyCheck(Interface_Check& ach) const;
1214 Purpose: Checks whether the Global section contains valid data according to the IGES specification. If the Global section is correct this method adds nothing into ach, but if not the method adds fail messages.
1215 * IGESData_IGESModel::SetLineWeights
1216 void SetLineWeights(const Standard_Real defw) ;
1217 Purpose: Sets LineWeights of entities according to the Global section (MaxLineWeight and LineWeightGrad values) or to a default value (defw) for undefined weights.
1218 <h5>Methods for dealing with IGES entities</h5>
1219 * IGESData_IGESModel::ClearLabels() ;
1220 void ClearLabels() ;
1221 Purpose: Erases labels. Not yet implemented.
1222 * IGESData_IGESModel::PrintLabel
1223 void PrintLabel(const Handle(Standard_Transient)& ent, Standard_OStream& S) const;
1224 Purpose: Prints the Directory Entry number of a given entity, i.e. 'Dnn' where Dnn=2*number-1on the stream S.
1225 * IGESData_IGESModel::StringLabel
1226 Handle_TCollection_HAsciiString StringLabel (const Handle(Standard_Transient)& ent) const;
1227 Purpose: Returns a string with a Directory Entry number of a given entity, i.e. a string 'Dnn' where Dnn=2*number-1.
1228 * IGESData_IGESModel::Entity
1229 Handle_IGESData_IGESEntity Entity(const Standard_Integer num) const;
1230 Purpose: Returns an entity given by its rank number.
1231 * IGESData_IGESModel::DNum
1232 Standard_Integer DNum(const Handle(IGESData_IGESEntity)& ent) const;
1233 Purpose: Returns the DE Number of an entity, i.e. 2*Number(ent)-1, or 0 if ent is unknown from this Model.
1234 @subsubsection occt_1856844696_128830953133 Class IGESData_IGESEntity
1235 <h4>General description</h4>
1236 Represents an abstract IGES entity.
1237 This class provides an access to common IGES entity fields (TypeNumber, TransformationMatrix,
1239 This class is a basic one for other classes complementing it to represent a certain IGES entity.
1240 Refer to the IGES specification for more details.
1245 <h5>Constructors: </h5>
1246 * IGESData_IGESEntity();
1247 Purpose: Creates an empty object. Sets all values to defaults (calls Clear()).
1248 <h5>Methods for initializing fields of object.</h5>
1249 * IGESData_IGESEntity::Clear
1251 Purpose: Clears all fields of the object.
1252 * IGESData_IGESEntity::InitTypeAndForm
1253 void InitTypeAndForm( const Standard_Integer typenum, const Standard_Integer formnum) ;
1254 Purpose: Sets the Type and Form Numbers to new values.
1255 Remarks: Private method. Reserved for special use.
1256 * IGESData_IGESEntity::InitDirFieldEntity
1257 void InitDirFieldEntity( const Standard_Integer fieldnum, const Handle(IGESData_IGESEntity)& ent) ;
1258 Purpose: Sets a directory field to an ent of any kind (see DirFieldEntity() for more details).
1259 Remarks: If fieldnum is not equal to values listed in DirFieldEntity(), this method does nothing.
1260 * IGESData_IGESEntity::InitTransf
1261 void InitTransf(const Handle(IGESData_TransfEntity)& ent) ;
1262 Purpose: Sets the Transf or erases it if ent is null.
1263 * IGESData_IGESEntity::InitView
1264 void InitView(const Handle(IGESData_ViewKindEntity)& ent) ;
1265 Purpose: Sets the View or erases it if ent is null.
1266 * IGESData_IGESEntity::InitLineFont
1267 void InitLineFont( const Handle(IGESData_LineFontEntity)& ent, const Standard_Integer rank = 0) ;
1268 Purpose: Sets the LineFont. If ent is null the RankLineFont is set to rank, otherwise it is set to a negative value.
1269 * IGESData_IGESEntity::InitLevel
1270 void InitLevel( const Handle(IGESData_LevelListEntity)& ent, const Standard_Integer val = 0) ;
1271 Purpose: Sets the Level. If ent is null the DefLevel is set to val, otherwise it is set to a negative value.
1272 * IGESData_IGESEntity::InitColor
1273 void InitColor( const Handle(IGESData_ColorEntity)& ent, const Standard_Integer rank = 0) ;
1274 Purpose: Sets the Color. If ent is null the DefColor is set to rank, otherwise it is set to a negative value.
1275 * IGESData_IGESEntity::InitStatus
1276 void InitStatus( const Standard_Integer blank,
1277 const Standard_Integer subordinate,
1278 const Standard_Integer useflag,
1279 const Standard_Integer hierarchy) ;
1280 Purpose: Sets the flags of the Directory Part.
1281 * IGESData_IGESEntity::SetLabel
1282 void SetLabel( const Handle(TCollection_HAsciiString)& label, const Standard_Integer sub = -1) ;
1283 Purpose: Sets a new Label to an Entity. If sub is given, it sets the value of SubScriptNumber, else SubScriptNumber is erased.
1284 * IGESData_IGESEntity::InitMisc
1285 void InitMisc( const Handle(IGESData_IGESEntity)& str,
1286 const Handle(IGESData_LabelDisplayEntity)& lab,
1287 const Standard_Integer weightnum) ;
1288 Purpose: Sets data or erases it if it is given as null (zero for weightnum):
1290 lab for LabelDisplay,
1291 weightnum for WeightNumber
1292 * IGESData_IGESEntity::SetLineWeight
1293 void SetLineWeight( const Standard_Real defw,
1294 const Standard_Real maxw,
1295 const Standard_Integer gradw) ;
1296 Purpose: Computes and sets the ;true; line weight according to IGES rules from the global data MaxLineWeight (maxw) and LineWeightGrad (gradw), or sets it to defw (Default) if LineWeightNumber is null
1297 Remarks: If gradw is zero, there is division by zero in this method.
1298 <h5>Methods for querying the corresponding fields of an IGES entity. </h5>
1299 * IGESData_IGESEntity::IGESType
1300 IGESData_IGESType IGESType() const;
1301 Purpose: Returns information on the IGES type of an entity including the type and the form of that entity.
1302 * IGESData_IGESEntity::TypeNumber
1303 Standard_Integer TypeNumber() const;
1304 Purpose: Returns the IGES Type number.
1305 * IGESData_IGESEntity::FormNumber
1306 Standard_Integer FormNumber() const;
1307 Purpose: Returns the IGES Form number.
1308 * IGESData_IGESEntity::DirFieldEntity
1309 Handle_IGESData_IGESEntity DirFieldEntity(const Standard_Integer fieldnum) const;
1310 Purpose: Returns the Entity that is recorded for a given Field Number fieldnum where:
1315 7 - Transf(ormation Matrix)
1318 In a case of other values it returns a null handle.
1320 * IGESData_IGESEntity::HasStructure
1321 Standard_Boolean HasStructure() const;
1322 Purpose: Returns True if an IGES entity is defined with a structure (it is normally reserved for certain classes, such as Macros).
1323 * IGESData_IGESEntity::Structure
1324 Handle_IGESData_IGESEntity Structure() const;
1325 Purpose: Returns the Structure (used by some types of IGES entities only), returns a null handle if Structure is not defined.
1326 * IGESData_IGESEntity::DefLineFont
1327 IGESData_DefType DefLineFont() const;
1328 Purpose: Returns the definition status of LineFont.
1329 * IGESData_IGESEntity::RankLineFont
1330 Standard_Integer RankLineFont() const;
1331 Purpose: Returns LineFont definition as an integer if it is defined as Rank. If LineFont is defined as an Entity, returns a negative value
1332 * IGESData_IGESEntity::LineFont
1333 Handle_IGESData_LineFontEntity LineFont() const;
1334 Purpose: Returns LineFont as an entity if it is defined as Reference. Returns a null handle if DefLineFont is not ;DefReference;.
1335 * IGESData_IGESEntity::DefLevel
1336 IGESData_DefList DefLevel() const;
1337 Purpose: Returns the definition status of Level.
1338 * IGESData_IGESEntity::Level
1339 Standard_Integer Level() const;
1340 Purpose: Returns Level definition as an integer.
1341 * IGESData_IGESEntity::LevelList
1342 Handle_IGESData_LevelListEntity LevelList() const;
1343 Purpose: Returns LevelList if Level is defined as List. Returns a null handle if DefLevel is not ;DefSeveral;.
1344 * IGESData_IGESEntity::DefView
1345 IGESData_DefList DefView() const;
1346 Purpose: Returns the definition status of View (None,One or Several).
1347 * IGESData_IGESEntity::View
1348 Handle_IGESData_ViewKindEntity View() const;
1349 Purpose: Returns the View (either Single or List) if it is defined. Returns a null handle if it is not defined.
1351 * IGESData_IGESEntity::SingleView
1352 Handle_IGESData_ViewKindEntity SingleView() const;
1353 Purpose: Returns View as Single, if defined as One. Returns a null handle if DefView is not ;DefOne;.
1354 * IGESData_IGESEntity::ViewList
1355 Handle_IGESData_ViewKindEntity ViewList() const;
1356 Purpose: Returns View as a List. Returns a null handle if DefView is not ;DefSeveral;.
1357 * IGESData_IGESEntity::HasTransf
1358 Standard_Boolean HasTransf() const;
1359 Purpose: Returns True if a Transformation Matrix is defined.
1360 * IGESData_IGESEntity::Transf
1361 Handle_IGESData_TransfEntity Transf() const;
1362 Purpose: Returns the Transformation Matrix (under IGES definition). Returns a null handle if there is none.
1363 Remarks: For a more complete use, see Location & CompoundLocation.
1364 * IGESData_IGESEntity::HasLabelDisplay
1365 Standard_Boolean HasLabelDisplay() const;
1366 Purpose: Returns True if the LabelDisplay mode is defined for this entity.
1367 * IGESData_IGESEntity::LabelDisplay
1368 Handle_IGESData_LabelDisplayEntity LabelDisplay() const;
1369 Purpose: Returns the LabelDisplay, if there is one; else returns a null handle.
1370 * IGESData_IGESEntity::BlankStatus
1371 Standard_Integer BlankStatus() const;
1372 Purpose: Returns the Blank Status (0 - visible, 1 - blanked).
1373 * IGESData_IGESEntity::SubordinateStatus
1374 Standard_Integer SubordinateStatus() const;
1375 Purpose: Returns the Subordinate Switch (0-1-2-3)
1376 * IGESData_IGESEntity::UseFlag
1377 Standard_Integer UseFlag() const;
1378 Purpose: Returns the Use Flag (0 to 5) of an entity.
1379 * IGESData_IGESEntity::HierarchyStatus
1380 Standard_Integer HierarchyStatus() const;
1381 Purpose: Returns the Hierarchy status (0-1-2).
1382 * IGESData_IGESEntity::LineWeightNumber
1383 Standard_Integer LineWeightNumber() const;
1384 Purpose: Returns the LineWeight Number (0 if it is not defined).
1385 See also: LineWeight.
1387 * IGESData_IGESEntity::LineWeight
1388 Standard_Real LineWeight() const;
1389 Purpose: Returns ;true; LineWeight, computed from LineWeightNumber and the global parameter of the Model by call to SetLineWeight.
1390 * IGESData_IGESEntity::DefColor
1391 IGESData_DefType DefColor() const;
1392 Purpose: Returns the definition status of Color.
1393 * IGESData_IGESEntity::RankColor
1394 Standard_Integer RankColor() const;
1395 Purpose: Returns the Color definition as an Integer (if defined as Rank). If Color is defined as an Entity, returns a negative value.
1396 * IGESData_IGESEntity::Color
1397 Handle_IGESData_ColorEntity Color() const;
1398 Purpose: Returns the Color as an Entity (if defined as Reference) or a null handle if Color Definition is not ;DefReference;.
1399 * IGESData_IGESEntity::CResValues
1400 Standard_Boolean CResValues( const Standard_CString res1,
1401 const Standard_CString res2) const;
1402 Purpose: Fills res1 and res2 with inner ;reserved; alphanumeric fields theRes1 and theRes2. Returns False if both are blank, otherwise returns True.
1403 Warning: Both must be of a length equal to at least 9 characters. The contents of res1 and res2 are modofied. The 9-th character becomes null.
1404 * IGESData_IGESEntity::HasShortLabel
1405 Standard_Boolean HasShortLabel() const;
1406 Purpose: Returns True if ShortLabel is not null.
1407 * IGESData_IGESEntity::ShortLabel
1408 Handle_TCollection_HAsciiString ShortLabel() const;
1409 Purpose: Returns label value as a string (null if ShortLabel is blank).
1410 * IGESData_IGESEntity::HasSubScriptNumber
1411 virtualStandard_Boolean HasSubScriptNumber() const;
1412 Purpose: Returns True if SubScript Number is defined.
1413 * IGESData_IGESEntity::SubScriptNumber
1414 Standard_Integer SubScriptNumber() const;
1415 Purpose: Returns SubScript Number as an integer (0 if not defined).
1416 * IGESData_IGESEntity::HasOneParent()
1417 Standard_Boolean HasOneParent() const;
1418 Purpose: Returns True if an entity has one and only one parent, defined by a SingleParentEntity Type Associativity (explicit sharing).
1419 Remarks: Thus, implicit sharing remains defined at the model level.
1420 See class ToolLocation.
1421 * IGESData_IGESEntity::UniqueParent() const;
1422 Handle_IGESData_IGESEntity UniqueParent() const;
1423 Purpose: Returns the Unique Parent (if it is the one).
1424 Exceptions: Interface_InterfaceError if there are either several or no parents.
1425 * IGESData_IGESEntity::Location()
1426 gp_GTrsf Location() const;
1427 Purpose: Returns the entity Location given by Transf in the Directory Part (see above). Considers local location only (not taking into account the parent's one - see CompoundLocation for that). If no Transf is defined, returns Identity.
1428 * IGESData_IGESEntity::VectorLocation()
1429 gp_GTrsf VectorLocation() const;
1430 Purpose: Returns the Translation part of a local location (as for Location).
1431 * IGESData_IGESEntity::CompoundLocation()
1432 gp_GTrsf CompoundLocation() const;
1433 Purpose: Returns the location of this object combined with CompoundLocation of its Parent (i.e. can be recursive). If the Parent is not single (see HasOneParent) returns Location.
1434 * IGESData_IGESEntity::HasName()
1435 Standard_Boolean HasName() const;
1436 Purpose: Says if a Name is defined as Short Label or as Name Property. (Property is looked for first, otherwise ShortLabel is considered).
1437 * IGESData_IGESEntity::NameValue()
1438 Handle_TCollection_HAsciiString NameValue() const;
1439 Purpose: Returns the Name value as a String (Property Name or ShortLabel). If SubNumber is defined, it is concatenated after ShortLabel as follows - label (number). Ignored in case of Property Name.
1440 <h5>Methods for dealing with associativities and properties.</h5>
1441 * IGESData_IGESEntity::ArePresentAssociativities()
1442 Standard_Boolean ArePresentAssociativities() const;
1443 Purpose: Returns True if the Entity is defined with an Associativity list, even an empty one (i.e., the file is of 0 length). Otherwise returns False (the file contains no identification concerning this list at all).
1444 * IGESData_IGESEntity::NbAssociativities
1445 Standard_Integer NbAssociativities() const;
1446 Purpose: Returns the number of recorded associativities (0 if no list is defined).
1447 * IGESData_IGESEntity::Associativities
1448 Interface_EntityIterator Associativities() const;
1449 Purpose: Returns the Associativity List in the form of an EntityIterator.
1450 * IGESData_IGESEntity::NbTypedAssociativities
1451 Standard_Integer NbTypedAssociativities
1452 const Handle(Standard_Type)& atype) const;
1453 Purpose: Returns information on how many Associativities have the given type.
1455 * IGESData_IGESEntity::TypedAssociativity
1456 Handle_IGESData_IGESEntity TypedAssociativity
1457 (const Handle(Standard_Type)& atype) const;
1458 Purpose: Returns the Associativity of a given Type (if one exists)
1459 Exceptions: Interface_InterfaceError if there is none or more than one associativity.
1460 * IGESData_IGESEntity::AddAssociativity
1461 void AddAssociativity(const Handle(IGESData_IGESEntity)& ent) ;
1462 Purpose: Adds an Associativity to the list (called by Associate only).
1463 Exceptions: Standard_NullObject if ent is null.
1464 * IGESData_IGESEntity::RemoveAssociativity
1465 void RemoveAssociativity(const Handle(IGESData_IGESEntity)& ent) ;
1466 Purpose: Removes an Associativity from the list (called by Dissociate).
1467 Exceptions: Standard_NullObject if ent is null.
1468 * IGESData_IGESEntity::LoadAssociativities
1469 void LoadAssociativities(const Interface_EntityList& list) ;
1470 Purpose: Loads a complete List of Asociativities (used during Read or Copy operations).
1471 * IGESData_IGESEntity::ClearAssociativities
1472 void ClearAssociativities() ;
1473 Purpose: Removes all associativities at once.
1474 * IGESData_IGESEntity::Associate
1475 void Associate(const Handle(IGESData_IGESEntity)& ent) const;
1476 Purpose: Sets this object to the Associativity list of another Entity. If ent is a null object, method does nothing.
1477 * IGESData_IGESEntity::Dissociate
1478 void Dissociate(const Handle(IGESData_IGESEntity)& ent) const;
1479 Purpose: Removes this object from the Associativity list of another Entity. If ent is a null object, method does nothing.
1480 * IGESData_IGESEntity::ArePresentProperties
1481 Standard_Boolean ArePresentProperties() const;
1482 Purpose: Returns True if the Entity is defined with a Property list, even an empty one (i.e., the file is of 0 length). Otherwise, returns False (file contains no identification concerning this list at all).
1483 * IGESData_IGESEntity::NbProperties()
1484 Standard_Integer NbProperties() const;
1485 Purpose: Returns the number of recorded properties (0 if no list is defined)
1486 * IGESData_IGESEntity::Properties()
1487 Interface_EntityIterator Properties() const;
1488 Purpose: Returns the Property List in the form of an EntityIterator
1489 * IGESData_IGESEntity::NbTypedProperties
1490 Standard_Integer NbTypedProperties
1491 (const Handle(Standard_Type)& atype) const;
1492 Purpose: Returns information on how many Properties have a given type
1493 * IGESData_IGESEntity::TypedProperty
1494 Handle_IGESData_IGESEntity TypedProperty
1495 (const Handle(Standard_Type)& atype) const;
1496 Purpose: Returns the Property of a given Type (if only one exists)
1497 Exceptions: Interface_InterfaceError if there is none or more than one Properties.
1498 * IGESData_IGESEntity::AddProperty
1499 void AddProperty(const Handle(IGESData_IGESEntity)& ent) ;
1500 Purpose: Adds a Property to the list.
1501 Exceptions: Standard_NullObject if entis null.
1502 * IGESData_IGESEntity::RemoveProperty
1503 void RemoveProperty(const Handle(IGESData_IGESEntity)& ent) ;
1504 Purpose: Removes a Property from the list.
1505 Exceptions: Standard_NullObject if entis null.
1506 * IGESData_IGESEntity::LoadProperties
1507 void LoadProperties(const Interface_EntityList& list) ;
1508 Purpose: Loads a complete List of Properties (used during Read or Copy operations).
1509 * IGESData_IGESEntity::ClearProperties() ;
1510 void ClearProperties() ;
1511 Purpose: Removes all properties at once
1515 @section occt_1856844696_722523915 Using XSTEPDRAW
1516 @subsection occt_1856844696_7225239151 XSDRAWIGES Overview
1517 XSTEPDRAW 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.
1518 This paragraph 5 is divided into several sections. Sections 5.3 and 5.5 deal with reading and writing of IGES files and are intended specifically for the IGES processor, sections 5.2 and 5.4 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.
1520 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, vertical dash (|) is used.
1521 @subsection occt_1856844696_7225239152 Setting interface parameters
1522 A 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
1523 Draw param [parameter_name [value]]
1524 Command 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).
1525 The third argument is used to set a new value of the given parameter. The result of the setting is printed immediately.
1526 During 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).
1527 Command xtrace is intended to view and change these parameters:
1529 - prints current settings (e.g.: ;Level=0 - Standard Output;);
1531 - sets the trace level to the value #;
1532 Draw xtrace tracefile.log
1533 - sets the trace file as tracefile.log; and
1535 - directs all messages to the standard output.
1537 @subsection occt_1856844696_7225239153 Reading IGES files
1538 For a description of parameters used in reading an IGES file refer to 2.3.3 ;Setting the translation parameters ;.
1539 These parameters are set by command param:
1542 It 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).
1543 Loading is done by the command
1544 Draw xload file_name
1545 Once the file is loaded, it is possible to investigate the structure of the loaded data. To learn how to do it see 5.4 Analyzing the transferred.
1546 Reading of an IGES file is done by the command
1547 Draw igesbrep file_name result_shape_name [selection]
1548 Here 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.
1549 Command **igesbrep** will interactively ask the user to select a set of entities to be converted:
1552 After 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.
1553 The 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.
1554 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 2.3.4.
1555 Instead of igesbrep the following commands can be used:
1556 Draw trimport file_name result_shape_name selection
1557 which outputs the result of translation of each selected entity into one shape,
1558 Draw trimpcomp file_name result_shape_name selection
1559 which outputs the result of translation of all selected entities into one shape (TopoDS_Compound for several entities).
1560 An asterisk “*” can be specified instead of selection, it means xst-transferrable-roots.
1561 During the IGES translation, a map of correspondence between IGES entities and OCCT shapes is created.
1562 To get information on the result of translation of the given IGES entity the command
1565 To create an OCCT shape corresponding to an IGES entity the command
1568 To get the number of an IGES entity corresponding to an OCCT shape the command
1569 Draw fromshape shape_name
1571 To clear the map of correspondences between IGES entities and OCCT shapes the command
1574 @subsection occt_1856844696_7225239154 Analyzing the transferred data
1575 The procedure of analysis of the data import can be divided into two stages:
1576 1. checking the file contents,
1577 2. estimation of translation results (conversion and validated ratios).
1578 @subsubsection occt_1856844696_72252391541 Checking file contents
1579 General statistics on the loaded data can be obtained by using command
1581 The information printed by this command depends on the symbol specified:
1584 There is a set of special objects, which can be used to operate with the loaded model. They can be of the following types:
1586 A list of these objects defined in the current session can be printed in DRAW by command
1588 In the following commands if several selection arguments are specified the results of each following selection are applied to those of the one preceding it.
1590 Draw givelist selection_name [selection_name]
1591 prints a list of loaded entities defined by selection argument. For possible values of selection_name please refer to 2.3.4.
1593 Draw givecount selection_name [selection_name]
1594 prints a number of loaded entities defined by selection argument. For possible values of selection_name please refer to 2.3.4.
1595 Three commands are used to calculate statistics on the entities in the model:
1596 Draw count counter [selection ...]
1597 Prints only a number of entities per each type matching the criteria defined by arguments.
1598 Draw sumcount counter [selection ...]
1599 Prints the total number of entities of all types matching the criteria defined by arguments and the largest number corresponding to one type.
1600 Draw listcount counter [selection ...]
1601 Prints a list of entities per each type matching the criteria defined by arguments.
1602 Optional selection argument, if specified, defines a subset of entities, which are to be taken into account. Argument counter should be one of the currently defined counters:
1605 Draw listtypes selection_name ...
1606 gives 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.
1608 Entities 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. To get a label for an entity with a known number, command
1611 In the same way, command
1613 prints a number for an entity with the given label.
1614 The content of an IGES entity can be obtained by using command
1615 Draw entity # level_of_information
1616 The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by command
1618 @subsubsection occt_1856844696_72252391542 Estimating the results of reading IGES
1619 All of the following commands are available only after the data are converted into OCCT shapes (i.e. after command **igesbrep**).
1621 Draw tpstat [*|?]symbol [selection]
1622 is provided to get 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 *symbol *defines what information will be printed:
1625 The 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.
1626 Optional argument selection can limit the action of the command with a selected subset of entities.
1627 To get help, run this command without arguments.
1628 Example. Translation ratio on IGES faces.
1629 Draw: tpstat *l iges-faces
1630 The second version of the same command is TPSTAT (not capital spelling).
1632 Symbol can be of the following values:
1634 Sometimes the trimming contours of IGES faces (i.e., entity 141 for 143, 142 for 144) can be lost during translation due to fails. To obtain the number of lost trims and the number of corresponding IGES entities the command
1635 Draw tplosttrim [IGES_type]
1636 is used. It 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.
1637 Optional parameter IGES_type can be TrimmedSurface, BoundedSurface or Face to specify the only type of IGES faces.
1638 Example. Untrimmed 144 entities.
1639 Draw tplosttrim TrimmedSurface
1640 To get information on OCCT shape contents the command
1641 Draw statshape shape_name
1643 It 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.).
1644 Note. 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.
1645 To analyze the internal validity of a shape, command
1646 Draw checkbrep shape_name expurged_shape_name
1647 is used. It 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.
1648 expurged_shape_name will contain the original shape without invalid subshapes.
1649 To get information on tolerances of subshapes the command
1650 Draw tolerance shape_name [min [max] [symbol]]
1651 is used. It 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.
1652 When specifying min and max arguments this command outputs shapes with names shape_name_... and their total number with tolerances in the range [min, max].
1653 Symbol is used for specifying the kind of sub-shapes to analyze: v - for vertices, e - for edges, f - for faces, c - for shells and faces.
1654 @subsection occt_1856844696_7225239155 Writing an IGES file
1655 For a description of parameters used in reading an IGES file refer to 3.3.2 Setting the translation parameters.
1656 These parameters are set by command **param**:
1659 Several shapes can be written in one file. To start writing a new file, enter command
1661 Actually, command **newmodel** will clear the InterfaceModel to make it empty, and the next command will convert the specified shapes to IGES entities and put them into the InterfaceModel:
1662 Draw brepiges shape_name_1 [filename.igs]
1663 To write the prepared model to a file with name **filename.igs**, enter
1664 Draw writeall filename.igs
1665 @subsection occt_1856844696_7225239156 Index of useful commands
1670 @section occt_1856844696_332489123 Reading from and writing to XDE
1671 @subsection occt_1856844696_3324891231 Description of the process
1672 @subsubsection occt_1856844696_33248912311 Loading an IGES file
1673 Before performing any other operation, you must load an IGES file with:
1674 IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
1675 IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
1676 Loading the file only memorizes, but does not translate the data.
1677 @subsubsection occt_1856844696_33248912312 Checking the loaded IGES file
1678 This step is not obligatory. See the description of this step below in paragraph 2.3.2.
1679 @subsubsection occt_1856844696_33248912313 Setting parameters for translation to XDE
1680 See the description of this step below in paragraph 2.3.3.
1681 In addition, the following parameters can be set for XDE translation of attributes:
1682 • Parameter for transferring colors:
1683 reader.SetColorMode(mode);
1684 // mode can be Standard_True or Standard_False
1685 • Parameter for transferring names:
1686 reader.SetNameMode(mode);
1687 // mode can be Standard_True or Standard_False
1688 @subsubsection occt_1856844696_33248912314 Performing the translation of an IGES file to XDE
1689 The following function performs a translation of the whole document:
1690 Standard_Boolean ok = reader.Transfer(doc);
1691 where ;doc; is a variable which contains a handle to the output document and should have a type Handle(TDocStd_Document).
1692 @subsubsection occt_1856844696_33248912315 Initializing the process of translation from XDE to IGES
1693 Here is how the process is initialized:
1694 IGESCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False);
1695 @subsubsection occt_1856844696_33248912316 Setting parameters for translation from XDE to IGES
1696 The following parameters can be set for translation of attributes to IGES:
1697 • Parameter for transferring colors:
1698 aWriter.SetColorMode(mode);
1699 // mode can be Standard_True or Standard_False
1700 • Parameter for transferring names:
1701 aWriter.SetNameMode(mode);
1702 // mode can be Standard_True or Standard_False
1703 @subsubsection occt_1856844696_33248912317 Performing the translation of an XDE document to IGES
1704 You can perform the translation of a document by calling the function:
1705 IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
1706 where ;doc; is a variable which contains a handle to the input document for transferring and should have a type Handle(TDocStd_Document).
1707 @subsubsection occt_1856844696_33248912318 Writing an IGES file
1708 Write an IGES file with:
1709 IFSelect_ReturnStatus statw = aWriter.WriteFile(;filename.igs;);
1711 IFSelect_ReturnStatus statw = writer.WriteFile (S);