1 -- Created on: 1995-03-14
2 -- Created by: Christian CAILLET
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
25 ---Purpose : Basic package to work functions of X-STEP (IFSelect & Co)
26 -- under control of DRAW
28 -- Works with some "static" data : a SessionPilot (used to run)
29 -- with its WorkSession and Model and TransferReader, a
32 uses TCollection, TColStd, TopTools,
33 gp, Geom, Geom2d, TopoDS, MoniTool,
34 Interface, Transfer, IFSelect, XSControl, Draw, SWDRAW
39 ---Purpose : Gathers general commands for XSDRAW : initialisation control,
40 -- also commands to analyse the result of a transfer
41 -- (it is an appendix made of user callable functions)
46 ---Purpose : Gathers commands which only apply to shapes/geometry, and are
47 -- not concerned by XSTEP features for files
48 -- This set of functions just enriches the standard DRAW set,
49 -- with either useful but lacking basic functions, or complements
50 -- used in transfer operations, or specific control functions
54 ---Purpose : Takes variables to/from the DRAW session
56 --class ProgressIndicator;
57 ---Purpose : Implements ProgressIndicator for DRAW
59 -- Linking with DRAW function set
61 ChangeCommand (oldname,newname : CString);
62 ---Purpose : Changes the name under which a command of xstep is known by
63 -- Draw. This allows to avoid collisions
64 -- To be called before LoadDraw or any other xstep initialisation
66 RemoveCommand (oldname : CString);
67 ---Purpose : Removes a command from the interpretation list of Draw
68 -- To be called before LoadDraw or any other xstep initialisation
70 LoadSession returns Boolean;
71 ---Purpose : Defines the basic context to work with a X-STEP Session :
72 -- it performs the basic inits, also records the Controller
73 -- If the Controller is not yet set, it must be set after
74 -- (call to SetController)
75 -- LoadSession is called by LoadDraw
76 -- Returns True the first time, False if already called
78 LoadDraw (theCommands : in out Interpretor from Draw);
79 ---Purpose : Defines the context for using a X-STEP Session under DRAW
80 -- Once the various INITs have been done, a call to LoadDraw
81 -- records the defined commands for the X-STEP SessionPilot,
82 -- into the DRAW interpretation list.
83 -- "Set" commands are accessed under command xset
84 -- SDS>xset name command ...
85 -- Other commands can be accessed directly or under command xstep
86 -- SDS>command ... and SDS>xstep command ... are equivalent
88 -- Only the command xinit is accessed directly only :
89 -- SDS>xinit (from the already defined Controller)
90 -- SDS>xinit iges (first defines the Controller as for "iges")
92 -- It also records the function to be called by DRAW (not
93 -- declared because specific).
94 -- And it defines the context variables, i.e. a WorkSession, then
95 -- it calls SetController with the currently defined Controller
96 -- Remark : at least, the standard commands are recorded
98 -- See also Controller : it is part of the Context, but it must
99 -- be precised separately
101 Execute (command : CString; var : CString = "") returns Integer;
102 ---Purpose : Allows to execute a xstep-draw command from C++ program
103 -- Fixed form : Execute("command args...");
104 -- Form with a variable text part : add %s for the variable :
105 -- Execute ("command args %s args..",var) [var is a CString]
106 -- Returns the same value as returned by call from DRAW
108 Pilot returns mutable SessionPilot from IFSelect;
109 ---Purpose : Returns the SessionPilot (can be used for direct call)
111 Session returns mutable WorkSession from XSControl;
112 ---Purpose : Returns the WorkSession defined in AddDraw (through Pilot)
113 -- It is from XSControl, it brings functionnalities for Transfers
115 SetController (control : Controller from XSControl);
116 ---Purpose : Defines a Controller for the command "xinit" and applies it
117 -- (i.e. calls its method Customise)
119 Controller returns Controller from XSControl;
120 ---Purpose : Returns the Controller, a Null Handle if not yet defined
122 SetNorm (normname : CString; profile : CString = "") returns Boolean;
123 ---Purpose : Sets a norm by its name (controller recorded as <normname> )
124 -- Returns True if done, False if this norm is unknown
125 -- If <profile> is given, also sets the norm to <profile>
126 -- (if <profile> is undefined for <normname>, it is ignored)
128 -- Additionnal access to XSTEP data
130 Protocol returns Protocol from Interface;
131 ---Purpose : Returns the actually defined Protocol
133 Model returns mutable InterfaceModel from Interface;
134 ---Purpose : Returns the Model of the Session (it is Session()->Model() )
136 SetModel (model : mutable InterfaceModel from Interface; file : CString = "");
137 ---Purpose : Sets a Model in session (it is Session()->SetModel(model) )
138 -- If <file> is defined, SetLoadedFile is also done
140 NewModel returns InterfaceModel from Interface;
141 ---Purpose : Produces a new model (from the Controller), can be Null
142 -- Does not set it in the session
144 Entity (num : Integer) returns Transient;
145 ---Purpose : Returns the entity n0 <num> of the Model of the Session
146 -- (it is StartingEntity)
147 -- Null Handle if <num> is not suitable
149 Number (ent : Transient) returns Integer;
150 ---Purpose : Returns the number of an entity in the Model (StartingNumber)
151 -- 0 if <ent> unknown in the model, or null
153 SetTransferProcess (TP : mutable Transient);
154 ---Purpose : Sets a TransferProcess in order to analyse it (see Activator)
155 -- It can be either a FinderProcess or a TransientProcess, in
156 -- that case a new TransferReader is created on it
158 TransientProcess returns TransientProcess from Transfer;
159 ---Purpose : Returns the TransferProcess : TransientProcess detained by
160 -- the TransferReader
162 FinderProcess returns FinderProcess from Transfer;
163 ---Purpose : Returns the FinderProcess, detained by the TransferWriter
166 InitTransferReader (mode : Integer);
167 ---Purpose : Initialises a TransferReader, according to mode :
168 -- 0 nullifies it, 1 clears it (not nullify)
169 -- 2 sets it with TransientProcess & Model
170 -- 3 idem plus roots of TransientProcess
171 -- Remark : called with 0 at least at each SetModel/NewModel
173 TransferReader returns TransferReader from XSControl;
174 ---Purpose : Returns the current TransferReader, can be null
175 -- It detains the TransientProcess
177 -- Some useful functions
180 GetEntity (name : CString = "") returns Transient;
181 ---Purpose : Takes the name of an entity, either as argument, or (if <name>
182 -- is empty) on keybord, and returns the entity
183 -- name can be a label or a number (in alphanumeric), it is
184 -- searched by NumberFromLabel from WorkSession.
185 -- If <name> doesn't match en entity, a Null Handle is returned
187 GetEntityNumber (name : CString = "") returns Integer;
188 ---Purpose : Same as GetEntity, but returns the number in the model of the
189 -- entity. Returns 0 for null handle
191 GetList (first : CString = ""; second : CString = "")
192 returns HSequenceOfTransient from TColStd;
193 ---Purpose : Evaluates and returns a list of entity, from :
194 -- keyboard if <first> and <second> are empty, see below
195 -- first if second is empty : can be a number/label of an entity
196 -- or the name of a selection to be evaluated (standard)
197 -- first : name of a selection, evaluated from a list defined by
199 -- In case of failure, returns a Null Handle
201 FileAndVar (file, var, def : CString;
202 resfile, resvar : out AsciiString from TCollection)
204 ---Purpose : Analyses given file name and variable name, with a default
205 -- name for variables. Returns resulting file name and variable
206 -- name plus status "file to read"(True) or "already read"(False)
207 -- In the latter case, empty resfile means no file available
209 -- If <file> is null or empty or equates ".", considers Session
210 -- and returned status is False
211 -- Else, returns resfile = file and status is True
212 -- If <var> is neither null nor empty, resvar = var
213 -- Else, the root part of <resfile> is considered, if defined
214 -- Else, <def> is taken
216 MoreShapes (list : in out mutable HSequenceOfShape from TopTools;
217 name : CString) returns Integer;
218 ---Purpose : Analyses a name as designating Shapes from DRAW variables or
219 -- XSTEP transfer (last Transfer on Reading). <name> can be :
220 -- "*" : all the root shapes produced by last Transfer (Read)
221 -- i.e. considers roots of the TransientProcess
222 -- a name : a name of a variable DRAW
224 -- Returns the count of designated Shapes. Their list is put in
225 -- <list>. If <list> is null, it is firstly created. Then it is
226 -- completed (Append without Clear) by the Shapes found
227 -- Returns 0 if no Shape could be found