1 -- Created on: 1996-01-30
2 -- Created by: Christian CAILLET
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class Writer from IGESControl
19 ---Purpose : This class creates and writes
20 -- IGES files from CAS.CADE models. An IGES file can be written to
21 -- an existing IGES file or to a new one.
22 -- The translation can be performed in one or several
23 -- operations. Each translation operation
24 -- outputs a distinct root entity in the IGES file.
25 -- To write an IGES file it is possible to use the following sequence:
26 -- To modify the IGES file header or to change translation
27 -- parameters it is necessary to use class Interface_Static (see
28 -- IGESParameters and GeneralParameters).
30 uses CString, OStream, Transient, Shape from TopoDS,
31 FinderProcess, BasicEditor from IGESData, IGESModel, IGESEntity
35 Create returns Writer;
36 ---Purpose : Creates a writer object with the
37 -- default unit (millimeters) and write mode (Face).
38 -- IGESControl_Writer (const Standard_CString unit,
39 -- const Standard_Integer modecr = 0);
41 Create (unit : CString; modecr : Integer = 0) returns Writer;
42 ---Purpose : Creates a writer with given
43 -- values for units and for write mode.
44 -- unit may be any unit that is accepted by the IGES standard.
45 -- By default, it is the millimeter.
46 -- modecr defines the write mode and may be:
47 -- - 0: Faces (default)
50 Create (model : IGESModel; modecr : Integer = 0) returns Writer;
51 ---Purpose : Creates a writer object with the
52 -- prepared IGES model model in write mode.
53 -- modecr defines the write mode and may be:
54 -- - 0: Faces (default)
57 Model (me) returns IGESModel;
58 ---Purpose : Returns the IGES model to be written in output.
60 TransferProcess (me) returns FinderProcess;
61 SetTransferProcess (me : in out; TP : FinderProcess);
62 ---Purpose : Returns/Sets the TransferProcess : it contains final results
63 -- and if some, check messages
65 AddShape (me : in out; sh : Shape) returns Boolean;
66 ---Purpose : Translates a Shape to IGES Entities and adds them to the model
67 -- Returns True if done, False if Shape not suitable for IGES or null
69 AddGeom (me : in out; geom : Transient) returns Boolean;
70 ---Purpose : Translates a Geometry (Surface or Curve) to IGES Entities and
71 -- adds them to the model
72 -- Returns True if done, False if geom is neither a Surface or
73 -- a Curve suitable for IGES or is null
75 AddEntity (me : in out; ent : IGESEntity) returns Boolean;
76 ---Purpose : Adds an IGES entity (and the ones it references) to the model
78 ComputeModel (me : in out);
79 ---Purpose : Computes the entities found in
80 -- the model, which is ready to be written.
81 -- This contrasts with the default computation of headers only.
83 Write (me : in out; S : in out OStream; fnes : Boolean = Standard_False)
85 ---Purpose : Computes then writes the model to an OStream
86 -- Returns True when done, false in case of error
88 Write (me : in out; file : CString; fnes : Boolean = Standard_False)
90 ---Purpose : Prepares and writes an IGES model
91 -- either to an OStream, S or to a file name,CString.
92 -- Returns True if the operation was performed correctly and
93 -- False if an error occurred (for instance,
94 -- if the processor could not create the file).
96 PrintStatsTransfer (me; what : Integer; mode : Integer = 0);
97 ---Purpose : Prints Statistics about Transfer
101 theTP : FinderProcess;
103 thedit : BasicEditor from IGESData;
104 thecr : Integer; -- mode ecr
105 thest : Boolean; -- computed ?