973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | //#58 rln 28.12.98 Versioning |
15 | |
7fd59977 |
16 | #include <IFSelect_Act.hxx> |
7fd59977 |
17 | #include <IFSelect_CheckCounter.hxx> |
7fd59977 |
18 | #include <IFSelect_Dispatch.hxx> |
19 | #include <IFSelect_DispGlobal.hxx> |
7fd59977 |
20 | #include <IFSelect_DispPerCount.hxx> |
21 | #include <IFSelect_DispPerFiles.hxx> |
42cf5bc1 |
22 | #include <IFSelect_DispPerOne.hxx> |
7fd59977 |
23 | #include <IFSelect_DispPerSignature.hxx> |
42cf5bc1 |
24 | #include <IFSelect_EditForm.hxx> |
25 | #include <IFSelect_Editor.hxx> |
26 | #include <IFSelect_Functions.hxx> |
27 | #include <IFSelect_GeneralModifier.hxx> |
28 | #include <IFSelect_GraphCounter.hxx> |
29 | #include <IFSelect_IntParam.hxx> |
30 | #include <IFSelect_ListEditor.hxx> |
31 | #include <IFSelect_Modifier.hxx> |
32 | #include <IFSelect_ModifReorder.hxx> |
7fd59977 |
33 | #include <IFSelect_SelectDeduct.hxx> |
42cf5bc1 |
34 | #include <IFSelect_SelectDiff.hxx> |
35 | #include <IFSelect_SelectEntityNumber.hxx> |
36 | #include <IFSelect_SelectErrorEntities.hxx> |
37 | #include <IFSelect_SelectIncorrectEntities.hxx> |
38 | #include <IFSelect_SelectIntersection.hxx> |
39 | #include <IFSelect_Selection.hxx> |
7fd59977 |
40 | #include <IFSelect_SelectModelEntities.hxx> |
41 | #include <IFSelect_SelectModelRoots.hxx> |
42cf5bc1 |
42 | #include <IFSelect_SelectPointed.hxx> |
43 | #include <IFSelect_SelectRange.hxx> |
7fd59977 |
44 | #include <IFSelect_SelectRoots.hxx> |
7fd59977 |
45 | #include <IFSelect_SelectShared.hxx> |
7fd59977 |
46 | #include <IFSelect_SelectSharing.hxx> |
42cf5bc1 |
47 | #include <IFSelect_SelectSignature.hxx> |
7fd59977 |
48 | #include <IFSelect_SelectSuite.hxx> |
42cf5bc1 |
49 | #include <IFSelect_SelectUnion.hxx> |
50 | #include <IFSelect_SelectUnknownEntities.hxx> |
51 | #include <IFSelect_SessionFile.hxx> |
52 | #include <IFSelect_SessionPilot.hxx> |
53 | #include <IFSelect_ShareOut.hxx> |
54 | #include <IFSelect_Signature.hxx> |
55 | #include <IFSelect_SignatureList.hxx> |
56 | #include <IFSelect_SignCounter.hxx> |
57 | #include <IFSelect_SignType.hxx> |
4f953fa9 |
58 | #include <IFSelect_Transformer.hxx> |
42cf5bc1 |
59 | #include <IFSelect_WorkLibrary.hxx> |
60 | #include <IFSelect_WorkSession.hxx> |
61 | #include <Interface_Category.hxx> |
62 | #include <Interface_CheckIterator.hxx> |
63 | #include <Interface_EntityIterator.hxx> |
64 | #include <Interface_InterfaceModel.hxx> |
7fd59977 |
65 | #include <Interface_Macros.hxx> |
7fd59977 |
66 | #include <Interface_MSG.hxx> |
42cf5bc1 |
67 | #include <Interface_Static.hxx> |
68 | #include <Interface_Version.hxx> |
69 | #include <Message.hxx> |
70 | #include <Message_Messenger.hxx> |
71 | #include <Standard_Transient.hxx> |
72 | #include <TCollection_AsciiString.hxx> |
73 | #include <TCollection_HAsciiString.hxx> |
74 | #include <TColStd_HSequenceOfAsciiString.hxx> |
75 | #include <TColStd_HSequenceOfHAsciiString.hxx> |
76 | #include <TColStd_HSequenceOfTransient.hxx> |
77 | #include <TColStd_MapOfInteger.hxx> |
7fd59977 |
78 | |
42cf5bc1 |
79 | #include <stdio.h> |
7fd59977 |
80 | // Decomposition of a file name in its parts : prefix, root, suffix |
7fd59977 |
81 | static void SplitFileName |
82 | (const Standard_CString filename, |
83 | TCollection_AsciiString& prefix, |
84 | TCollection_AsciiString& fileroot, |
85 | TCollection_AsciiString& suffix) |
86 | { |
87 | Standard_Integer nomdeb, nomfin, nomlon; |
88 | TCollection_AsciiString resfile (filename); |
89 | nomlon = resfile.Length(); |
90 | nomdeb = resfile.SearchFromEnd ("/"); |
91 | if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT |
92 | if (nomdeb < 0) nomdeb = 0; |
93 | nomfin = resfile.SearchFromEnd ("."); |
94 | if (nomfin < nomdeb) nomfin = nomlon + 1; |
95 | |
96 | if (nomdeb > 0) prefix = resfile.SubString (1,nomdeb); |
97 | fileroot = resfile.SubString(nomdeb+1,nomfin-1); |
98 | if (nomfin <= nomlon) suffix = resfile.SubString (nomfin,nomlon); |
99 | } |
100 | |
101 | |
102 | |
103 | // Functions definit un certain nombre de commandes |
104 | // enregistrees dans le Dictionnaire de Activator (par des Act unitaires) |
105 | // Les actions elles-memes sont regroupees en fin de fichier |
106 | |
107 | // Les definitions |
108 | |
109 | static IFSelect_ReturnStatus funstatus |
110 | (const Handle(IFSelect_SessionPilot)& ) |
111 | { |
112 | // **** Version & cie **** |
113 | //#58 rln |
0ebe5b0a |
114 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
115 | sout<<"Processor Version : "<<XSTEP_PROCESSOR_VERSION<<std::endl; |
116 | sout<<"OL Version : "<<XSTEP_SYSTEM_VERSION<<std::endl; |
117 | sout<<"Configuration : "<<XSTEP_Config<<std::endl; |
118 | sout<<"UL Names : "<<XSTEP_ULNames<<std::endl; |
7fd59977 |
119 | return IFSelect_RetVoid; |
120 | } |
121 | |
122 | static IFSelect_ReturnStatus fun1 |
123 | (const Handle(IFSelect_SessionPilot)& pilot) |
124 | { |
125 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
126 | // **** ToggleHandler **** |
dde68833 |
127 | Standard_Boolean hand = !WS->ErrorHandle(); |
0ebe5b0a |
128 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
129 | if (hand) sout << " -- Mode Catch Error now Active" <<std::endl; |
130 | else sout << " -- Mode Catch Error now Inactive" <<std::endl; |
7fd59977 |
131 | WS->SetErrorHandle(hand); |
132 | return IFSelect_RetDone; |
133 | } |
134 | |
7fd59977 |
135 | static IFSelect_ReturnStatus fun3 |
136 | (const Handle(IFSelect_SessionPilot)& pilot) |
137 | { |
138 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
139 | Standard_Integer argc = pilot->NbWords(); |
140 | const Standard_CString arg1 = pilot->Arg(1); |
141 | // **** XRead / Load **** |
0ebe5b0a |
142 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
143 | if (argc < 2) { sout<<"Read/Load : give file name !"<<std::endl; return IFSelect_RetError; } |
144 | if (WS->Protocol().IsNull()) { sout<<"Protocol not defined"<<std::endl; return IFSelect_RetError; } |
145 | if (WS->WorkLibrary().IsNull()) { sout<<"WorkLibrary not defined"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
146 | |
147 | IFSelect_ReturnStatus status = WS->ReadFile (arg1); |
148 | // status : 0 OK, 1 erreur lecture, 2 Fail(try/catch), |
149 | // -1 fichier non trouve, -2 lecture faite mais resultat vide |
150 | switch (status) { |
0ebe5b0a |
151 | case IFSelect_RetVoid : sout<<"file:"<<arg1<<" gives empty result"<<std::endl; break; |
152 | case IFSelect_RetError : sout<<"file:"<<arg1<<" could not be opened"<<std::endl; break; |
153 | case IFSelect_RetDone : sout<<"file:"<<arg1<<" read"<<std::endl; break; |
154 | case IFSelect_RetFail : sout<<"file:"<<arg1<<" : error while reading"<<std::endl; break; |
155 | case IFSelect_RetStop : sout<<"file:"<<arg1<<" : EXCEPTION while reading"<<std::endl; break; |
156 | default : sout<<"file:"<<arg1<<" could not be read"<<std::endl; break; |
7fd59977 |
157 | } |
158 | if (status != IFSelect_RetDone) return status; |
04232180 |
159 | // sout<<" - clearing list of already written files"<<std::endl; |
7fd59977 |
160 | WS->BeginSentFiles(Standard_True); |
161 | return status; |
162 | } |
163 | |
7fd59977 |
164 | static IFSelect_ReturnStatus fun4 |
165 | (const Handle(IFSelect_SessionPilot)& pilot) |
166 | { |
167 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
168 | Standard_Integer argc = pilot->NbWords(); |
169 | const Standard_CString arg1 = pilot->Arg(1); |
170 | // **** Write All **** |
0ebe5b0a |
171 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
172 | if (argc < 2) { sout<<"Write All : give file name !"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
173 | return WS->SendAll (arg1); |
174 | } |
175 | |
176 | static IFSelect_ReturnStatus fun5 |
177 | (const Handle(IFSelect_SessionPilot)& pilot) |
178 | { |
179 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
180 | Standard_Integer argc = pilot->NbWords(); |
181 | const Standard_CString arg1 = pilot->Arg(1); |
182 | // const Standard_CString arg2 = pilot->Arg(2); |
183 | // **** Write Selected **** |
0ebe5b0a |
184 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
185 | if (argc < 3) { sout<<"Write Selected : give file name + givelist !"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
186 | Handle(TColStd_HSequenceOfTransient) result = |
187 | IFSelect_Functions::GiveList (WS,pilot->CommandPart( 2)); |
0ebe5b0a |
188 | if (result.IsNull()) { sout<<"No entity selected"<<std::endl; return IFSelect_RetError; } |
189 | else sout<<"Nb Entities selected : "<<result->Length()<<std::endl; |
7fd59977 |
190 | Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; |
191 | sp->SetList (result); |
192 | return WS->SendSelected (arg1,sp); |
193 | } |
194 | |
195 | static IFSelect_ReturnStatus fun6 |
196 | (const Handle(IFSelect_SessionPilot)& pilot) |
197 | { |
198 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
199 | Standard_Integer argc = pilot->NbWords(); |
200 | const Standard_CString arg1 = pilot->Arg(1); |
201 | // **** Write Entite(s) **** |
0ebe5b0a |
202 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
203 | if (argc < 3) { sout<<"Write Entitie(s) : give file name + n0s entitie(s)!"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
204 | int ko = 0; |
205 | Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; |
206 | for (Standard_Integer ia = 2; ia < argc ; ia ++) { |
207 | Standard_Integer id = pilot->Number(pilot->Arg(ia)); |
208 | if (id > 0) { |
209 | Handle(Standard_Transient) item = WS->StartingEntity(id); |
0ebe5b0a |
210 | if (sp->Add(item)) sout<<"Added:no."<<id<<std::endl; |
211 | else { sout<<" Fail Add n0."<<id<<std::endl; ko ++; } |
7fd59977 |
212 | } |
0ebe5b0a |
213 | else { sout<<"Not an entity number:"<<pilot->Arg(ia)<<std::endl; ko ++; } |
7fd59977 |
214 | } |
0ebe5b0a |
215 | if (ko > 0) { sout<<ko<<" bad arguments, abandon"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
216 | return WS->SendSelected (arg1,sp); |
217 | } |
218 | |
219 | static IFSelect_ReturnStatus fun7 |
220 | (const Handle(IFSelect_SessionPilot)& pilot) |
221 | { |
222 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
223 | Standard_Integer argc = pilot->NbWords(); |
224 | const Standard_CString arg1 = pilot->Arg(1); |
225 | // **** Entity Label **** |
0ebe5b0a |
226 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
227 | if (argc < 2) { sout<<"Give entity number"<<std::endl; return IFSelect_RetError; } |
228 | if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
229 | Standard_Integer nument = WS->NumberFromLabel (arg1); |
230 | if (nument <= 0 || nument > WS->NbStartingEntities()) |
0ebe5b0a |
231 | { sout<<"Not a suitable number: "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
232 | sout<<"N0."<<nument<<" ->Label in Model : "; |
0ebe5b0a |
233 | WS->Model()->PrintLabel(WS->StartingEntity(nument), sout); |
234 | sout<<std::endl; |
7fd59977 |
235 | return IFSelect_RetVoid; |
236 | } |
237 | |
238 | static IFSelect_ReturnStatus fun8 |
239 | (const Handle(IFSelect_SessionPilot)& pilot) |
240 | { |
241 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
242 | Standard_Integer argc = pilot->NbWords(); |
243 | const Standard_CString arg1 = pilot->Arg(1); |
244 | // **** Entity Number **** |
0ebe5b0a |
245 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
246 | if (argc < 2) { sout<<"Give label to search"<<std::endl; return IFSelect_RetError; } |
247 | if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<std::endl; return IFSelect_RetError; } |
7f56eba8 |
248 | const Handle(Interface_InterfaceModel) &model = WS->Model(); |
7fd59977 |
249 | Standard_Integer i, cnt = 0; |
250 | Standard_Boolean exact = Standard_False; |
0ebe5b0a |
251 | sout<<" ** Search Entity Number for Label : "<<arg1<<std::endl; |
7fd59977 |
252 | for (i = model->NextNumberForLabel (arg1, 0, exact) ; i != 0; |
253 | i = model->NextNumberForLabel (arg1, i, exact)) { |
254 | cnt ++; |
0ebe5b0a |
255 | sout<<" ** Found n0/id:"; |
256 | model->Print (model->Value(i), sout); |
257 | sout<<std::endl; |
7fd59977 |
258 | } |
259 | |
0ebe5b0a |
260 | if (cnt == 0) sout<<" ** No Match"<<std::endl; |
261 | else if (cnt == 1) sout<<" ** 1 Match"<<std::endl; |
262 | else sout<<cnt<<" Matches"<<std::endl; |
7fd59977 |
263 | return IFSelect_RetVoid; |
264 | } |
265 | |
266 | static IFSelect_ReturnStatus fun9 |
267 | (const Handle(IFSelect_SessionPilot)& pilot) |
268 | { |
269 | // **** List Types **** |
270 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
271 | Handle(IFSelect_Signature) signtype = WS->SignType(); |
272 | if (signtype.IsNull()) signtype = new IFSelect_SignType; |
273 | Handle(IFSelect_SignCounter) counter = |
274 | new IFSelect_SignCounter(signtype,Standard_False); |
275 | return pilot->ExecuteCounter (counter,1); |
276 | } |
277 | |
278 | static IFSelect_ReturnStatus funcount |
279 | (const Handle(IFSelect_SessionPilot)& pilot) |
280 | { |
281 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
282 | Standard_Integer argc = pilot->NbWords(); |
283 | const Standard_CString arg0 = pilot->Arg(0); |
284 | const Standard_CString arg1 = pilot->Arg(1); |
285 | Standard_Boolean listmode = (arg0[0] == 'l'); |
286 | // **** List Counter **** |
287 | |
0ebe5b0a |
288 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
289 | if (argc < 2) { |
0ebe5b0a |
290 | sout<<"Designer signature ou compteur, + facultatif selection + facultatif entite"<<std::endl; |
291 | sout<<" signature/compteur seul -> tout le modele"<<std::endl |
292 | << " sign/compteur + selection -> cette selection, evaluation normale"<<std::endl |
293 | <<" sign/compteur + sel + num -> cette selection evaluee sur entite n0 num"<<std::endl; |
7fd59977 |
294 | return IFSelect_RetError; |
295 | } |
296 | DeclareAndCast(IFSelect_SignCounter,counter,WS->NamedItem(arg1)); |
297 | if (counter.IsNull()) { |
298 | DeclareAndCast(IFSelect_Signature,signa,WS->NamedItem(arg1)); |
299 | if (!signa.IsNull()) counter = new IFSelect_SignCounter(signa,Standard_False,listmode); |
300 | } |
301 | // Handle(IFSelect_Selection) sel; |
302 | // Standard_Integer n3 = 0; if (argc > 3) n3 = WS->NumberFromLabel(arg3); |
303 | // if (argc > 2) sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2)); |
304 | // if (counter.IsNull() || (argc > 2 && n3 <= 0 && sel.IsNull()) ) { |
305 | // sout<<"Nom:"<<arg1; if (argc > 2) sout<<" et/ou "<<arg2; |
04232180 |
306 | // sout<<" incorrect (demande: compteur ou signature [selection])"<<std::endl; |
7fd59977 |
307 | // return IFSelect_RetError; |
308 | // } |
309 | |
310 | // Ajout : si Selection, on applique un GraphCounter |
311 | // Et en ce cas, on peut en avoir plusieurs : la limite est le mot-cle "on" |
312 | Standard_Integer onflag = 0; |
313 | Standard_Integer i; // svv Jan11 2000 : porting on DEC |
314 | for (i = 2; i < argc; i ++) { |
315 | if (!strcmp (pilot->Arg(i),"on")) { onflag = i; break; } |
316 | } |
317 | |
318 | Handle(IFSelect_Selection) sel = WS->GiveSelection(arg1); |
319 | DeclareAndCast(IFSelect_SelectDeduct,seld,sel); |
320 | if (!seld.IsNull()) { |
321 | // Si onflag, faire une SelectSuite |
322 | if (onflag > 2) { |
323 | Handle(IFSelect_SelectSuite) suite = new IFSelect_SelectSuite; |
324 | for (i = 1; i < onflag; i ++) { |
325 | sel = WS->GiveSelection(pilot->Arg(i)); |
326 | if (!suite->AddInput(sel)) { |
0ebe5b0a |
327 | sout<<"Incorrect definition for applied selection"<<std::endl; |
7fd59977 |
328 | return IFSelect_RetError; |
329 | } |
330 | } |
331 | seld = suite; |
332 | } |
333 | |
334 | Handle(IFSelect_GraphCounter) gc = new IFSelect_GraphCounter(Standard_False,listmode); |
335 | gc->SetApplied (seld); |
336 | counter = gc; |
337 | } |
338 | |
339 | if (counter.IsNull()) { |
0ebe5b0a |
340 | sout<<"Neither Counter nor Signature : "<<arg1<<std::endl; |
7fd59977 |
341 | return IFSelect_RetError; |
342 | } |
343 | |
344 | if (onflag == 0) onflag = 1; |
345 | IFSelect_PrintCount pcm = IFSelect_ListByItem; |
346 | if (arg0[0] == 'c') pcm = IFSelect_CountByItem; |
347 | if (arg0[0] == 's') pcm = IFSelect_CountSummary; |
348 | return pilot->ExecuteCounter (counter,onflag+1, pcm); |
349 | } |
350 | |
351 | static IFSelect_ReturnStatus funsigntype |
352 | (const Handle(IFSelect_SessionPilot)& pilot) |
353 | { |
354 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
355 | Standard_Integer argc = pilot->NbWords(); |
356 | const Standard_CString arg1 = pilot->Arg(1); |
357 | // **** Sign Type **** |
358 | Handle(IFSelect_Signature) signtype = WS->SignType(); |
0ebe5b0a |
359 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
360 | if (signtype.IsNull()) sout<<"signtype actually undefined"<<std::endl; |
7fd59977 |
361 | else { |
362 | Handle(TCollection_HAsciiString) str = WS->Name (signtype); |
363 | Standard_Integer id = WS->ItemIdent (signtype); |
0ebe5b0a |
364 | sout<<signtype->Label()<<std::endl; |
7fd59977 |
365 | if (str.IsNull()) { |
0ebe5b0a |
366 | if (id > 0) sout<<"signtype : item n0 "<<id<<std::endl; |
7fd59977 |
367 | } else { |
0ebe5b0a |
368 | sout<<"signtype : also named as "<<str->ToCString()<<std::endl; |
7fd59977 |
369 | } |
370 | } |
0ebe5b0a |
371 | if (argc < 2) sout<<"signtype newitem to change, signtype . to clear"<<std::endl; |
7fd59977 |
372 | else { |
373 | if (arg1[0] == '.' && arg1[1] == '\0') { |
374 | signtype.Nullify(); |
0ebe5b0a |
375 | sout<<"signtype now cleared"<<std::endl; |
7fd59977 |
376 | } else { |
377 | signtype = GetCasted(IFSelect_Signature,WS->NamedItem(arg1)); |
0ebe5b0a |
378 | if (signtype.IsNull()) { sout<<"Not a Signature : "<<arg1<<std::endl; return IFSelect_RetError; } |
379 | else sout<<"signtype now set to "<<arg1<<std::endl; |
7fd59977 |
380 | } |
381 | WS->SetSignType(signtype); |
382 | return IFSelect_RetDone; |
383 | } |
384 | return IFSelect_RetVoid; |
385 | } |
386 | |
387 | static IFSelect_ReturnStatus funsigncase |
388 | (const Handle(IFSelect_SessionPilot)& pilot) |
389 | { |
390 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
391 | const Standard_CString arg1 = pilot->Arg(1); |
392 | // **** Sign Case **** |
393 | Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature,WS->NamedItem(arg1)); |
0ebe5b0a |
394 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
395 | if (signcase.IsNull()) sout<<"Not a Signature : "<<arg1<<std::endl; |
7fd59977 |
396 | else { |
397 | Standard_Boolean hasmin,hasmax; Standard_Integer valmin,valmax; |
398 | if (signcase->IsIntCase(hasmin,valmin,hasmax,valmax)) { |
399 | sout<<"Signature "<<arg1<<" : Integer Case"; |
400 | if (hasmin) sout<<" - Mini:"<<valmin; |
401 | if (hasmax) sout<<" - Maxi:"<<valmax; |
0ebe5b0a |
402 | sout<<std::endl; |
7fd59977 |
403 | } |
404 | Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList(); |
0ebe5b0a |
405 | if (caselist.IsNull()) sout<<"Signature "<<arg1<<" : no predefined case, see command count "<<arg1<<std::endl; |
7fd59977 |
406 | else { |
407 | Standard_Integer i, nb = caselist->Length(); |
0ebe5b0a |
408 | sout<<"Signature "<<arg1<<" : "<<nb<<" basic cases :"<<std::endl; |
7fd59977 |
409 | for (i = 1; i <= nb; i ++) sout<<" "<<caselist->Value(i); |
0ebe5b0a |
410 | sout<<std::endl; |
7fd59977 |
411 | } |
412 | } |
413 | return IFSelect_RetVoid; |
414 | } |
415 | |
416 | |
417 | static IFSelect_ReturnStatus fun10 |
418 | (const Handle(IFSelect_SessionPilot)& pilot) |
419 | { |
420 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
421 | Standard_Integer argc = pilot->NbWords(); |
422 | const Standard_CString arg1 = pilot->Arg(1); |
423 | // **** Entity Status **** |
424 | Standard_Integer i,nb; |
0ebe5b0a |
425 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
426 | if (argc < 2) { |
427 | nb = Interface_Category::NbCategories(); |
428 | sout<<" Categories defined :"<<nb<<" i.e. :\n"; |
429 | for (i = 0; i <= nb; i ++) |
430 | sout<<"Cat."<<i<<" : "<<Interface_Category::Name(i)<<"\n"; |
0ebe5b0a |
431 | sout<<" On a given entity : give its number"<<std::endl; |
7fd59977 |
432 | return IFSelect_RetVoid; |
433 | } |
434 | Standard_Integer num = pilot->Number(arg1); |
435 | if (num <= 0 || num > WS->NbStartingEntities()) |
0ebe5b0a |
436 | { sout<<"Not a suitable entity number : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
437 | Handle(Standard_Transient) ent = WS->StartingEntity(num); |
0ebe5b0a |
438 | WS->PrintEntityStatus (ent, sout); |
7fd59977 |
439 | return IFSelect_RetVoid; |
440 | } |
441 | |
442 | static IFSelect_ReturnStatus fun11 |
443 | (const Handle(IFSelect_SessionPilot)& pilot) |
444 | { |
445 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
446 | // Standard_Integer argc = pilot->NbWords(); |
447 | const Standard_CString arg1 = pilot->Arg(1); |
448 | // **** DumpModel (Data) **** |
449 | Standard_Integer niv = 0; |
450 | // char arg10 = arg1[0]; |
451 | // if (argc < 2) arg10 = '?'; |
0ebe5b0a |
452 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
453 | switch (arg1[0]) { |
454 | case '?' : |
455 | sout<<"? for this help, else give a listing mode (first letter suffices) :\n" |
456 | <<" general General Statistics\n roots Roots\n" |
457 | <<" entities All Entities\n" |
458 | <<" listfails CheckList (fails) per entity\n" |
459 | <<" messages CheckList (complete) per entity\n" |
460 | <<" fails CheckList (fails) per message (counting)\n" |
461 | <<" check CheckList (complete) per message (counting)\n" |
462 | <<" totalcheck CheckList (complete) per message (listing n0 ents)\n" |
463 | <<" FAILS CheckList (fails) per message (listing complete)\n" |
0ebe5b0a |
464 | <<" TOTALCHECK CheckList (complete) per message (listing complete)"<<std::endl; |
7fd59977 |
465 | return IFSelect_RetVoid; |
466 | case 'g' : niv = 0; break; |
467 | case 'r' : niv = 1; break; |
468 | case 'e' : niv = 2; break; |
469 | case 'l' : niv = 3; break; |
470 | case 'm' : niv = 4; break; |
471 | case 'c' : niv = 5; break; |
472 | case 't' : niv = 6; break; |
473 | case 'T' : niv = 7; break; |
474 | case 'f' : niv = 8; break; |
475 | case 'F' : niv =10; break; |
0ebe5b0a |
476 | default : sout<<"Unknown Mode . data tout court pour help"<<std::endl; return IFSelect_RetError; |
7fd59977 |
477 | } |
478 | WS->TraceDumpModel(niv); |
479 | return IFSelect_RetVoid; |
480 | } |
481 | |
482 | static IFSelect_ReturnStatus fundumpent |
483 | (const Handle(IFSelect_SessionPilot)& pilot) |
484 | { |
485 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
486 | Standard_Integer argc = pilot->NbWords(); |
487 | Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary(); |
488 | Standard_Integer levdef=0,levmax=10,level; |
489 | WL->DumpLevels (levdef,levmax); |
0ebe5b0a |
490 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
491 | if (argc < 2 || (argc == 2 && levmax < 0)) { |
492 | sout<<"Give n0 or id of entity"; |
0ebe5b0a |
493 | if (levmax < 0) sout<<" and dump level"<<std::endl; |
494 | else sout<<" + optinal, dump level in [0 - "<<levmax<<"] , default = "<<levdef<<std::endl; |
7fd59977 |
495 | for (level = 0; level <= levmax; level ++) { |
496 | Standard_CString help = WL->DumpHelp (level); |
0ebe5b0a |
497 | if (help[0] != '\0') sout<<level<<" : "<<help<<std::endl; |
7fd59977 |
498 | } |
499 | return IFSelect_RetError; |
500 | } |
501 | |
502 | const Standard_CString arg1 = pilot->Arg(1); |
503 | const Standard_CString arg2 = pilot->Arg(2); |
504 | Standard_Integer num = pilot->Number(arg1); |
505 | if (num == 0) return IFSelect_RetError; |
506 | level = levdef; |
507 | if (argc > 2) level = atoi(arg2); |
508 | Handle(Standard_Transient) ent = WS->StartingEntity(num); |
509 | if ( ent.IsNull() ) { |
0ebe5b0a |
510 | sout << "No entity with given id " << arg1 << " (" << num << ") is found in the current model" << std::endl; |
7fd59977 |
511 | } |
512 | else { |
0ebe5b0a |
513 | sout << " -- DUMP Entity n0 " << num << " level " << level << std::endl; |
7fd59977 |
514 | WL->DumpEntity (WS->Model(),WS->Protocol(),ent,sout,level); |
515 | |
516 | Interface_CheckIterator chl = WS->CheckOne (ent); |
517 | if (!chl.IsEmpty(Standard_False)) chl.Print(sout,WS->Model(),Standard_False); |
518 | } |
04232180 |
519 | // sout << std::flush; |
7fd59977 |
520 | |
521 | return IFSelect_RetVoid; |
522 | } |
523 | |
524 | static IFSelect_ReturnStatus funsign |
525 | (const Handle(IFSelect_SessionPilot)& pilot) |
526 | { |
527 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
528 | Standard_Integer argc = pilot->NbWords(); |
529 | const Standard_CString arg1 = pilot->Arg(1); |
530 | const Standard_CString arg2 = pilot->Arg(2); |
0ebe5b0a |
531 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
532 | if (argc < 3) { sout<<" Give signature name + n0 or id of entity"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
533 | DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1)); |
0ebe5b0a |
534 | if (sign.IsNull()) { sout<<"Not a signature : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
535 | Standard_Integer num = pilot->Number(arg2); |
536 | Handle(Standard_Transient) ent = WS->StartingEntity (num); |
537 | if (num == 0) return IFSelect_RetError; |
0ebe5b0a |
538 | sout<<"Entity n0 "<<num<<" : "<<WS->SignValue(sign,ent)<<std::endl; |
7fd59977 |
539 | return IFSelect_RetVoid; |
540 | } |
541 | |
542 | static IFSelect_ReturnStatus funqp |
543 | (const Handle(IFSelect_SessionPilot)& pilot) |
544 | { |
545 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
546 | Standard_Integer argc = pilot->NbWords(); |
547 | const Standard_CString arg1 = pilot->Arg(1); |
548 | const Standard_CString arg2 = pilot->Arg(2); |
0ebe5b0a |
549 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
550 | if (argc < 3) { sout<<" Give 2 numeros or labels : dad son"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
551 | Standard_Integer n1 = WS->NumberFromLabel(arg1); |
552 | Standard_Integer n2 = WS->NumberFromLabel(arg2); |
0ebe5b0a |
553 | sout<<"QueryParent for dad:"<<arg1<<":"<<n1<<" and son:"<<arg2<<":"<<n2<<std::endl; |
7fd59977 |
554 | Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1),WS->StartingEntity(n2)); |
0ebe5b0a |
555 | if (qp < 0) sout<<arg1<<" is not super-entity of "<<arg2<<std::endl; |
556 | else if (qp == 0) sout<<arg1<<" is same as "<<arg2<<std::endl; |
557 | else sout<<arg1<<" is super-entity of "<<arg2<<" , max level found="<<qp<<std::endl; |
04232180 |
558 | // sout<<" Trouve "<<qp<<std::endl; |
7fd59977 |
559 | return IFSelect_RetVoid; |
560 | } |
561 | |
562 | |
563 | static IFSelect_ReturnStatus fun12 |
564 | (const Handle(IFSelect_SessionPilot)& pilot) |
565 | { |
566 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
567 | // **** DumpShare **** |
568 | WS->DumpShare(); return IFSelect_RetVoid; |
569 | } |
570 | |
571 | static IFSelect_ReturnStatus fun13 |
572 | (const Handle(IFSelect_SessionPilot)& pilot) |
573 | { |
574 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
575 | // **** ListItems **** |
576 | WS->ListItems(pilot->Arg(1)); return IFSelect_RetVoid; |
577 | } |
578 | |
579 | static IFSelect_ReturnStatus fun14 |
580 | (const Handle(IFSelect_SessionPilot)& pilot) |
581 | { |
582 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
583 | Standard_Integer argc = pilot->NbWords(); |
584 | const Standard_CString arg1 = pilot->Arg(1); |
585 | // **** NewInt **** |
0ebe5b0a |
586 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
587 | if (argc < 1) { sout<<"Donner la valeur entiere pour IntParam"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
588 | Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam; |
589 | if (argc >= 1) intpar->SetValue(atoi(arg1)); |
590 | return pilot->RecordItem (intpar); |
591 | } |
592 | |
593 | static IFSelect_ReturnStatus fun15 |
594 | (const Handle(IFSelect_SessionPilot)& pilot) |
595 | { |
596 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
597 | Standard_Integer argc = pilot->NbWords(); |
598 | const Standard_CString arg1 = pilot->Arg(1); |
599 | const Standard_CString arg2 = pilot->Arg(2); |
600 | // **** SetInt **** |
0ebe5b0a |
601 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
602 | if (argc < 3) |
0ebe5b0a |
603 | { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
604 | Standard_Integer val = atoi(arg2); |
605 | DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1)); |
606 | if (!WS->SetIntValue(par,val)) return IFSelect_RetFail; |
607 | return IFSelect_RetDone; |
608 | } |
609 | |
610 | static IFSelect_ReturnStatus fun16 |
611 | (const Handle(IFSelect_SessionPilot)& pilot) |
612 | { |
613 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
614 | Standard_Integer argc = pilot->NbWords(); |
615 | const Standard_CString arg1 = pilot->Arg(1); |
616 | // **** NewText **** |
0ebe5b0a |
617 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
618 | if (argc < 1) { sout<<"Donner la valeur texte pour TextParam"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
619 | Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString(); |
620 | if (argc >= 1) textpar->AssignCat(arg1); |
621 | return pilot->RecordItem (textpar); |
622 | } |
623 | |
624 | static IFSelect_ReturnStatus fun17 |
625 | (const Handle(IFSelect_SessionPilot)& pilot) |
626 | { |
627 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
628 | Standard_Integer argc = pilot->NbWords(); |
629 | const Standard_CString arg1 = pilot->Arg(1); |
630 | const Standard_CString arg2 = pilot->Arg(2); |
631 | // **** SetText **** |
0ebe5b0a |
632 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
633 | if (argc < 3) |
0ebe5b0a |
634 | { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
635 | DeclareAndCast(TCollection_HAsciiString,par,WS->NamedItem(arg1)); |
636 | if (!WS->SetTextValue(par,arg2)) return IFSelect_RetFail; |
637 | return IFSelect_RetDone; |
638 | } |
639 | |
640 | static IFSelect_ReturnStatus fun19 |
641 | (const Handle(IFSelect_SessionPilot)& pilot) |
642 | { |
643 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
644 | Standard_Integer argc = pilot->NbWords(); |
645 | const Standard_CString arg1 = pilot->Arg(1); |
646 | // **** DumpSel **** |
0ebe5b0a |
647 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
648 | if (argc < 2) { sout<<"Give 1 argument : Selection Name"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
649 | WS->DumpSelection (GetCasted(IFSelect_Selection,WS->NamedItem(arg1))); |
650 | return IFSelect_RetVoid; |
651 | } |
652 | |
653 | static IFSelect_ReturnStatus fun20 |
654 | (const Handle(IFSelect_SessionPilot)& pilot) |
655 | { |
656 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
657 | Standard_Integer argc = pilot->NbWords(); |
658 | // **** EvalSel **** |
659 | // **** GiveList **** |
660 | // **** GiveShort GivePointed **** |
661 | // **** MakeList **** |
662 | char mode = pilot->Arg(0)[0]; // givelist/makelist |
663 | if (mode == 'g') mode = pilot->Arg(0)[4]; // l list s short p pointed |
0ebe5b0a |
664 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
665 | if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
666 | |
667 | // MakeList : sur Pointed existante ou a creer |
668 | Handle(IFSelect_SelectPointed) pnt; |
669 | if (mode == 'm') { |
670 | const Standard_CString arg1 = pilot->Arg(1); |
671 | Handle(Standard_Transient) item = WS->NamedItem (arg1); |
672 | pnt = GetCasted(IFSelect_SelectPointed,item); |
673 | if (!pnt.IsNull()) { |
0ebe5b0a |
674 | sout<<arg1<<":Already existing Selection for List, cleared then filled"<<std::endl; |
7fd59977 |
675 | pnt->Clear(); |
676 | } else if (!item.IsNull()) { |
0ebe5b0a |
677 | sout<<arg1<<":Already existing Item not for a List, command ignored"<<std::endl; |
7fd59977 |
678 | return IFSelect_RetFail; |
679 | } else { |
680 | pnt = new IFSelect_SelectPointed; |
681 | WS->AddNamedItem (arg1,pnt); |
682 | } |
683 | } |
684 | |
685 | Handle(TColStd_HSequenceOfTransient) result = |
686 | IFSelect_Functions::GiveList (WS,pilot->CommandPart( (mode == 'm' ? 2 : 1) )); |
687 | if (result.IsNull()) return IFSelect_RetError; |
688 | Interface_EntityIterator iter (result); |
689 | sout<<pilot->CommandPart( (mode == 'm' ? 2 : 1) )<<" : "; |
0ebe5b0a |
690 | if (mode == 'l') WS->ListEntities (iter, 0, sout); |
691 | else if (mode == 's' || mode == 'm') WS->ListEntities (iter, 2, sout); |
7fd59977 |
692 | else if (mode == 'p') { |
693 | sout<<iter.NbEntities()<<" Entities : "; |
694 | for (iter.Start(); iter.More(); iter.Next()) |
695 | sout<<" +"<<WS->StartingNumber (iter.Value()); |
0ebe5b0a |
696 | sout<<std::endl; |
7fd59977 |
697 | } |
698 | |
699 | if (!pnt.IsNull()) { |
700 | pnt->SetList (result); |
0ebe5b0a |
701 | sout<<"List set to a SelectPointed : "<<pilot->Arg(1)<<std::endl; |
702 | sout<<"Later editable by command setlist"<<std::endl; |
7fd59977 |
703 | } |
704 | |
705 | return IFSelect_RetVoid; |
706 | } |
707 | |
708 | static IFSelect_ReturnStatus fun20c |
709 | (const Handle(IFSelect_SessionPilot)& pilot) |
710 | { |
711 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
712 | Standard_Integer argc = pilot->NbWords(); |
713 | // **** GiveCount **** |
0ebe5b0a |
714 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
715 | if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
716 | // WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1))); |
717 | Handle(TColStd_HSequenceOfTransient) result = |
718 | IFSelect_Functions::GiveList (WS,pilot->CommandPart(1)); |
719 | if (result.IsNull()) return IFSelect_RetError; |
0ebe5b0a |
720 | sout<<pilot->CommandPart(1)<<" : List of "<<result->Length()<<" Entities"<<std::endl; |
7fd59977 |
721 | return IFSelect_RetVoid; |
722 | } |
723 | |
724 | static IFSelect_ReturnStatus funselsuite |
725 | (const Handle(IFSelect_SessionPilot)& pilot) |
726 | { |
727 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
728 | Standard_Integer argc = pilot->NbWords(); |
729 | // **** SelSuite **** |
0ebe5b0a |
730 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
731 | if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
732 | // WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1))); |
733 | Handle(IFSelect_SelectSuite) selsuite = new IFSelect_SelectSuite; |
734 | |
735 | for (Standard_Integer i = 1; i < argc; i ++) { |
736 | Handle(IFSelect_Selection) sel = WS->GiveSelection(pilot->Arg(i)); |
737 | if (!selsuite->AddInput(sel)) { |
0ebe5b0a |
738 | sout<<pilot->Arg(i-1)<<" : not a SelectDeduct, no more can be added. Abandon"<<std::endl; |
7fd59977 |
739 | return IFSelect_RetError; |
740 | } |
741 | } |
742 | selsuite->SetLabel (pilot->CommandPart(1)); |
743 | return pilot->RecordItem (selsuite); |
744 | } |
745 | |
746 | |
747 | static IFSelect_ReturnStatus fun21 |
748 | (const Handle(IFSelect_SessionPilot)& pilot) |
749 | { |
750 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
751 | // **** ClearItems **** |
752 | WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False); |
753 | return IFSelect_RetDone; |
754 | } |
755 | |
756 | static IFSelect_ReturnStatus fun22 |
757 | (const Handle(IFSelect_SessionPilot)& pilot) |
758 | { |
759 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
760 | Standard_Integer argc = pilot->NbWords(); |
761 | const Standard_CString arg1 = pilot->Arg(1); |
762 | // **** ClearData **** |
763 | Standard_Integer mode = -1; |
764 | if (argc >= 2) { |
765 | if (arg1[0] == 'a') mode = 1; |
766 | if (arg1[0] == 'g') mode = 2; |
767 | if (arg1[0] == 'c') mode = 3; |
768 | if (arg1[0] == 'p') mode = 4; |
769 | if (arg1[0] == '?') mode = -1; |
770 | } |
771 | else mode = 0; |
0ebe5b0a |
772 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
773 | if (mode <= 0) { |
774 | if (mode < 0) sout<<"Give a suitable mode"; |
775 | sout<<" Available Modes :\n" |
0ebe5b0a |
776 | <<" a : all data g : graph+check c : check p : selectpointed"<<std::endl; |
7fd59977 |
777 | return (mode < 0 ? IFSelect_RetError : IFSelect_RetVoid); |
778 | } |
779 | WS->ClearData (mode); |
780 | return IFSelect_RetDone; |
781 | } |
782 | |
783 | static IFSelect_ReturnStatus fun24 |
784 | (const Handle(IFSelect_SessionPilot)& pilot) |
785 | { |
786 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
787 | Standard_Integer argc = pilot->NbWords(); |
788 | // **** Item Label **** |
0ebe5b0a |
789 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
790 | TCollection_AsciiString label; |
0ebe5b0a |
791 | if (argc < 2) { sout<<" Give label to search"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
792 | for (int i = 1; i < argc; i ++) { |
793 | label.AssignCat(pilot->Arg(i)); |
794 | if (i < argc-1) label.AssignCat(" "); |
795 | } |
796 | for (int mode = 0; mode <= 2; mode ++) { |
797 | int nbitems = 0; int id; |
798 | sout<<"Searching label : "<<label<<". in mode "; |
0ebe5b0a |
799 | if (mode == 0) sout <<" exact" << std::endl; |
800 | if (mode == 1) sout <<" same head" << std::endl; |
801 | if (mode == 2) sout <<" search if present" << std::endl; |
7fd59977 |
802 | for (id = WS->NextIdentForLabel(label.ToCString(), 0,mode) ; id != 0; |
803 | id = WS->NextIdentForLabel(label.ToCString(),id,mode)) { |
804 | sout<<" "<<id; nbitems ++; |
805 | } |
0ebe5b0a |
806 | sout<<" -- giving " << nbitems << " found" << std::endl; |
7fd59977 |
807 | } |
808 | return IFSelect_RetVoid; |
809 | } |
810 | |
811 | static IFSelect_ReturnStatus fun25 |
812 | (const Handle(IFSelect_SessionPilot)& pilot) |
813 | { |
814 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
815 | Standard_Integer argc = pilot->NbWords(); |
816 | const Standard_CString arg1 = pilot->Arg(1); |
817 | // **** Save (Dump) **** |
0ebe5b0a |
818 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
819 | if (argc < 2) { sout<<"Donner nom du Fichier"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
820 | IFSelect_SessionFile dumper(WS,arg1); |
821 | if (!dumper.IsDone()) return IFSelect_RetFail; |
822 | return IFSelect_RetDone; |
823 | } |
824 | |
825 | static IFSelect_ReturnStatus fun26 |
826 | (const Handle(IFSelect_SessionPilot)& pilot) |
827 | { |
828 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
829 | Standard_Integer argc = pilot->NbWords(); |
830 | const Standard_CString arg1 = pilot->Arg(1); |
831 | // **** Restore (Dump) **** |
0ebe5b0a |
832 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
833 | if (argc < 2) { sout<<"Donner nom du Fichier"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
834 | IFSelect_SessionFile dumper(WS); |
835 | Standard_Integer readstat = dumper.Read(arg1); |
836 | if (readstat == 0) return IFSelect_RetDone; |
0ebe5b0a |
837 | else if (readstat > 0) sout << "-- Erreur Lecture Fichier "<<arg1<<std::endl; |
838 | else sout << "-- Pas pu ouvrir Fichier "<<arg1<<std::endl; |
7fd59977 |
839 | return IFSelect_RetDone; |
840 | } |
841 | |
842 | static IFSelect_ReturnStatus fun27 |
843 | (const Handle(IFSelect_SessionPilot)& pilot) |
844 | { |
845 | Standard_Integer argc = pilot->NbWords(); |
846 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
847 | const Standard_CString arg1 = pilot->Arg(1); |
848 | const Standard_CString arg2 = pilot->Arg(2); |
849 | // **** Param(Value) **** |
0ebe5b0a |
850 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
851 | if (argc < 2) { |
852 | Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items(); |
853 | Standard_Integer i,nb = li->Length(); |
0ebe5b0a |
854 | sout<<" List of parameters : "<<nb<<" items : "<<std::endl; |
7fd59977 |
855 | for (i = 1; i <= nb; i ++) { |
0ebe5b0a |
856 | sout<<li->Value(i)->String(); |
857 | sout<<" : "<<Interface_Static::CVal(li->Value(i)->ToCString())<<std::endl; |
7fd59977 |
858 | } |
859 | return IFSelect_RetVoid; |
860 | } else if (atoi(arg1) > 0) { |
861 | Standard_Integer use = atoi (arg1); |
862 | WS->TraceStatics (use); |
863 | } else { |
0ebe5b0a |
864 | if (argc > 2) sout<<" FORMER STATUS of Static Parameter "<<arg1<<std::endl; |
865 | else sout<<" ACTUAL STATUS of Static Parameter "<<arg1<<std::endl; |
866 | if (!Interface_Static::IsPresent(arg1)) { sout<<" Parameter "<<arg1<<" undefined"<<std::endl; return IFSelect_RetError; } |
867 | if (!Interface_Static::IsSet(arg1)) sout<<" Parameter "<<arg1<<" not valued"<<std::endl; |
868 | else if (argc == 2) Interface_Static::Static (arg1) -> Print (sout); |
869 | else sout<<" Value : "<<Interface_Static::CVal(arg1)<<std::endl; |
870 | |
871 | if (argc == 2) sout<<"To modify, param name_param new_val"<<std::endl; |
7fd59977 |
872 | else { |
873 | sout<<" New demanded value : "<<arg2; |
874 | if (Interface_Static::SetCVal (arg1,arg2)) |
0ebe5b0a |
875 | { sout<<" OK"<<std::endl; return IFSelect_RetDone; } |
876 | else { sout <<" , refused"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
877 | } |
878 | } |
879 | return IFSelect_RetVoid; |
880 | } |
881 | |
7fd59977 |
882 | static IFSelect_ReturnStatus fun29 |
883 | (const Handle(IFSelect_SessionPilot)& pilot) |
884 | { |
885 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
886 | // **** SentFiles **** |
887 | Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles(); |
0ebe5b0a |
888 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
889 | if (list.IsNull()) |
0ebe5b0a |
890 | { sout<<"List of Sent Files not enabled"<<std::endl; return IFSelect_RetVoid; } |
7fd59977 |
891 | Standard_Integer i, nb = list->Length(); |
0ebe5b0a |
892 | sout<<" Sent Files : "<<nb<<" : "<<std::endl; |
7fd59977 |
893 | for (i = 1; i <= nb; i ++) |
0ebe5b0a |
894 | sout<<list->Value(i)->ToCString()<<std::endl; |
7fd59977 |
895 | return IFSelect_RetVoid; |
896 | } |
897 | |
898 | static IFSelect_ReturnStatus fun30 |
899 | (const Handle(IFSelect_SessionPilot)& pilot) |
900 | { |
901 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
902 | Standard_Integer argc = pilot->NbWords(); |
903 | const Standard_CString arg1 = pilot->Arg(1); |
904 | // **** FilePrefix **** |
0ebe5b0a |
905 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
906 | if (argc < 2) { |
0ebe5b0a |
907 | if (WS->FilePrefix().IsNull()) sout<<"Pas de prefixe defini"<<std::endl; |
908 | else sout<<"Prefixe : "<<WS->FilePrefix()->ToCString()<<std::endl; |
909 | sout<<"Pour changer : filepref newprefix"<<std::endl; |
7fd59977 |
910 | return IFSelect_RetVoid; |
911 | } |
912 | WS->SetFilePrefix(arg1); |
913 | return IFSelect_RetDone; |
914 | } |
915 | |
916 | static IFSelect_ReturnStatus fun31 |
917 | (const Handle(IFSelect_SessionPilot)& pilot) |
918 | { |
919 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
920 | Standard_Integer argc = pilot->NbWords(); |
921 | const Standard_CString arg1 = pilot->Arg(1); |
922 | // **** FileExtension **** |
0ebe5b0a |
923 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
924 | if (argc < 2) { |
0ebe5b0a |
925 | if (WS->FileExtension().IsNull()) sout<<"Pas d extension definie"<<std::endl; |
926 | else sout<<"Extension : "<<WS->FileExtension()->ToCString()<<std::endl; |
927 | sout<<"Pour changer : fileext newext"<<std::endl; |
7fd59977 |
928 | return IFSelect_RetVoid; |
929 | } |
930 | WS->SetFileExtension(arg1); |
931 | return IFSelect_RetDone; |
932 | } |
933 | |
934 | static IFSelect_ReturnStatus fun32 |
935 | (const Handle(IFSelect_SessionPilot)& pilot) |
936 | { |
937 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
938 | Standard_Integer argc = pilot->NbWords(); |
939 | const Standard_CString arg1 = pilot->Arg(1); |
940 | const Standard_CString arg2 = pilot->Arg(2); |
941 | // **** FileRoot **** |
0ebe5b0a |
942 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
943 | if (argc < 2) { sout<<"Donner Dispatch et nom de Root"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
944 | DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1)); |
945 | if (argc < 3) { |
0ebe5b0a |
946 | if (WS->FileRoot(disp).IsNull()) sout<<"Pas de racine definie pour "<<arg1<<std::endl; |
947 | else sout<<"Racine pour "<<arg1<<" : "<<WS->FileRoot(disp)->ToCString()<<std::endl; |
948 | sout<<"Pour changer : fileroot nomdisp newroot"<<std::endl; |
7fd59977 |
949 | return IFSelect_RetVoid; |
950 | } |
951 | if (!WS->SetFileRoot(disp,arg2)) return IFSelect_RetFail; |
952 | return IFSelect_RetDone; |
953 | } |
954 | |
955 | static IFSelect_ReturnStatus fun33 |
956 | (const Handle(IFSelect_SessionPilot)& pilot) |
957 | { |
958 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
959 | Standard_Integer argc = pilot->NbWords(); |
960 | const Standard_CString arg1 = pilot->Arg(1); |
961 | // **** Default File Root **** |
0ebe5b0a |
962 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
963 | if (argc < 2) { |
0ebe5b0a |
964 | if (WS->DefaultFileRoot().IsNull()) sout<<"Pas de racine par defaut definie"<<std::endl; |
965 | else sout<<"Racine par defaut : "<<WS->DefaultFileRoot()->ToCString()<<std::endl; |
966 | sout<<"Pour changer : filedef newdef"<<std::endl; |
7fd59977 |
967 | return IFSelect_RetVoid; |
968 | } |
969 | WS->SetDefaultFileRoot(arg1); |
970 | return IFSelect_RetDone; |
971 | } |
972 | |
973 | static IFSelect_ReturnStatus fun34 |
974 | (const Handle(IFSelect_SessionPilot)& pilot) |
975 | { |
976 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
977 | // **** EvalFile **** |
0ebe5b0a |
978 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
979 | if (!WS->HasModel()) |
0ebe5b0a |
980 | { sout<<"Pas de Modele charge, abandon"<<std::endl; return IFSelect_RetFail; } |
7fd59977 |
981 | |
0ebe5b0a |
982 | sout<<"Evaluation avec Memorisation des resultats"<<std::endl; |
7fd59977 |
983 | WS->EvaluateFile(); |
984 | Standard_Integer nbf = WS->NbFiles(); |
985 | for (Standard_Integer i = 1; i <= nbf; i ++) { |
986 | Handle(Interface_InterfaceModel) mod = WS->FileModel(i); |
987 | if (mod.IsNull()) |
0ebe5b0a |
988 | { sout<<"Modele "<<i<<" Model non genere ..."<<std::endl; continue; } |
7fd59977 |
989 | TCollection_AsciiString name = WS->FileName(i); |
990 | sout<<"Fichier n0 "<<i<<" Nb Entites : "<<mod->NbEntities()<<" Nom: "; |
0ebe5b0a |
991 | sout<<name<<std::endl; |
7fd59977 |
992 | } |
993 | return IFSelect_RetDone; |
994 | } |
995 | |
996 | static IFSelect_ReturnStatus fun35 |
997 | (const Handle(IFSelect_SessionPilot)& pilot) |
998 | { |
999 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1000 | // **** ClearFile **** |
1001 | WS->ClearFile(); return IFSelect_RetDone; |
1002 | } |
1003 | |
1004 | static IFSelect_ReturnStatus fun36 |
1005 | (const Handle(IFSelect_SessionPilot)& pilot) |
1006 | { |
1007 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1008 | Standard_Integer argc = pilot->NbWords(); |
1009 | // **** Split **** |
0ebe5b0a |
1010 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1011 | IFSelect_ReturnStatus stat = IFSelect_RetVoid; |
0ebe5b0a |
1012 | if (argc < 2) sout<<"Split : derniere liste de dispatches definie"<<std::endl; |
7fd59977 |
1013 | else { |
1014 | WS->ClearShareOut(Standard_True); |
1015 | for (Standard_Integer i = 1; i < argc; i ++) { |
1016 | DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i))); |
1017 | if (disp.IsNull()) { |
0ebe5b0a |
1018 | sout<<"Pas un dispatch:"<<pilot->Arg(i)<<", Splitt abandonne"<<std::endl; |
7fd59977 |
1019 | stat = IFSelect_RetError; |
1020 | } |
1021 | else WS->SetActive(disp,Standard_True); |
1022 | } |
1023 | } |
1024 | if (stat == IFSelect_RetError) return stat; |
1025 | WS->BeginSentFiles(Standard_True); |
1026 | if (!WS->SendSplit()) return IFSelect_RetFail; |
1027 | return IFSelect_RetDone; |
1028 | } |
1029 | |
1030 | static IFSelect_ReturnStatus fun37 |
1031 | (const Handle(IFSelect_SessionPilot)& pilot) |
1032 | { |
1033 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1034 | Standard_Integer argc = pilot->NbWords(); |
1035 | const Standard_CString arg1 = pilot->Arg(1); |
1036 | // **** Remaining Data **** |
1037 | char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay; |
1038 | if (argc >= 2) mode = arg1[0]; |
1039 | if (mode == 'u') numod = IFSelect_RemainUndo; |
1040 | else if (mode == 'l') numod = IFSelect_RemainDisplay; |
1041 | else if (mode == 'c') numod = IFSelect_RemainCompute; |
1042 | else if (mode == 'f') numod = IFSelect_RemainForget; |
1043 | else { |
0ebe5b0a |
1044 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1045 | if (argc<2) sout<<"Donner un Mode - "; |
0ebe5b0a |
1046 | sout<<"Modes possibles : l list, c compute, u undo, f forget"<<std::endl; |
7fd59977 |
1047 | if (mode == '?') return IFSelect_RetDone; else return IFSelect_RetError; |
1048 | } |
1049 | if (!WS->SetRemaining(numod)) return IFSelect_RetVoid; |
1050 | return IFSelect_RetDone; |
1051 | } |
1052 | |
1053 | static IFSelect_ReturnStatus fun38 |
1054 | (const Handle(IFSelect_SessionPilot)& pilot) |
1055 | { |
1056 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1057 | Standard_Integer argc = pilot->NbWords(); |
1058 | const Standard_CString arg1 = pilot->Arg(1); |
1059 | const Standard_CString arg2 = pilot->Arg(2); |
1060 | // **** SetModelContent **** |
0ebe5b0a |
1061 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1062 | if (argc < 3) { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1063 | Standard_Boolean keepmode; |
1064 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1)); |
1065 | if (sel.IsNull()) |
0ebe5b0a |
1066 | { sout<<"Pas de Selection de Nom : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1067 | if (arg2[0] == 'k') { sout<<" -- SetContent keep ..."; keepmode = Standard_True; } |
1068 | else if (arg2[0] == 'r') { sout<<" -- SetContent remove ..."; keepmode = Standard_False; } |
0ebe5b0a |
1069 | else { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1070 | |
0ebe5b0a |
1071 | if (WS->SetModelContent(sel,keepmode)) sout<<" Done"<<std::endl; |
1072 | else sout<<" Result empty, ignored"<<std::endl; |
7fd59977 |
1073 | return IFSelect_RetDone; |
1074 | } |
1075 | |
1076 | static IFSelect_ReturnStatus fun40 |
1077 | (const Handle(IFSelect_SessionPilot)& pilot) |
1078 | { |
1079 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1080 | // **** ListModif **** |
1081 | WS->ListFinalModifiers(Standard_True); |
1082 | WS->ListFinalModifiers(Standard_False); return IFSelect_RetVoid; |
1083 | } |
1084 | |
1085 | static IFSelect_ReturnStatus fun41 |
1086 | (const Handle(IFSelect_SessionPilot)& pilot) |
1087 | { |
1088 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1089 | Standard_Integer argc = pilot->NbWords(); |
1090 | const Standard_CString arg1 = pilot->Arg(1); |
1091 | // **** Modifier **** |
0ebe5b0a |
1092 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1093 | if (argc < 2) { sout<<"Donner Nom du Modifier"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1094 | DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1)); |
1095 | if (modif.IsNull()) |
0ebe5b0a |
1096 | { sout<<"Pas de Modifier de Nom : "<<arg1<<std::endl; return IFSelect_RetVoid; } |
7fd59977 |
1097 | Handle(IFSelect_IntParam) low,up; |
1098 | |
1099 | Handle(IFSelect_Dispatch) disp = modif->Dispatch(); |
0ebe5b0a |
1100 | sout<<"Modifier : "<<arg1<<" Label : "<<modif->Label()<<std::endl; |
7fd59977 |
1101 | Standard_Integer rank = WS->ModifierRank(modif); |
1102 | if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier))) |
1103 | sout<< "Model Modifier n0." << rank; |
1104 | else sout<< "File Modifier n0." << rank; |
0ebe5b0a |
1105 | if (disp.IsNull()) sout<<" Applique a tous les Dispatchs" << std::endl; |
7fd59977 |
1106 | else { |
1107 | sout << " Dispatch : "<<disp->Label(); |
1108 | if (WS->HasName(disp)) sout << " - Nom:"<<WS->Name(disp)->ToCString(); |
0ebe5b0a |
1109 | sout<<std::endl; |
7fd59977 |
1110 | } |
1111 | |
1112 | Handle(IFSelect_Selection) sel = modif->Selection(); |
1113 | if (!sel.IsNull()) sout<<" Selection : "<< sel->Label(); |
1114 | if (WS->HasName(sel)) sout<<" - Nom:"<< WS->Name(sel)->ToCString(); |
0ebe5b0a |
1115 | sout<<std::endl; |
7fd59977 |
1116 | return IFSelect_RetVoid; |
1117 | } |
1118 | |
1119 | static IFSelect_ReturnStatus fun42 |
1120 | (const Handle(IFSelect_SessionPilot)& pilot) |
1121 | { |
1122 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1123 | Standard_Integer argc = pilot->NbWords(); |
1124 | const Standard_CString arg1 = pilot->Arg(1); |
1125 | const Standard_CString arg2 = pilot->Arg(2); |
1126 | // **** ModifSel **** |
0ebe5b0a |
1127 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1128 | if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Selection optionnel\n" |
0ebe5b0a |
1129 | <<"Selection pour Mettre une Selection, sinon Annule"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1130 | DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1)); |
1131 | if (modif.IsNull()) |
0ebe5b0a |
1132 | { sout<<"Pas un nom de Modifier : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1133 | Handle(IFSelect_Selection) sel; |
1134 | if (arg2[0] != '\0') { |
1135 | sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2)); |
1136 | if (sel.IsNull()) |
0ebe5b0a |
1137 | { sout<<"Pas un nom de Selection : "<<arg2<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1138 | } |
1139 | if (!WS->SetItemSelection(modif,sel)) return IFSelect_RetFail; |
1140 | return IFSelect_RetDone; |
1141 | } |
1142 | |
1143 | static IFSelect_ReturnStatus fun43 |
1144 | (const Handle(IFSelect_SessionPilot)& pilot) |
1145 | { |
1146 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1147 | Standard_Integer argc = pilot->NbWords(); |
1148 | const Standard_CString arg1 = pilot->Arg(1); |
1149 | const Standard_CString arg2 = pilot->Arg(2); |
1150 | // **** SetAppliedModifier **** |
0ebe5b0a |
1151 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1152 | if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n" |
1153 | <<" - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n" |
0ebe5b0a |
1154 | <<" - Transformer : pas un Dispatch mais un Transformer"<<std::endl; |
7fd59977 |
1155 | return IFSelect_RetError; } |
1156 | DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1)); |
1157 | if (modif.IsNull()) |
0ebe5b0a |
1158 | { sout<<"Pas un nom de Modifier : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1159 | Handle(Standard_Transient) item; |
1160 | if (arg2[0] != '\0') { |
1161 | item = WS->NamedItem(arg2); |
1162 | if (item.IsNull()) |
0ebe5b0a |
1163 | { sout<<"Pas un nom connu : "<<arg2<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1164 | } |
1165 | else item = WS->ShareOut(); |
1166 | if (!WS->SetAppliedModifier(modif,item)) return IFSelect_RetFail; |
1167 | return IFSelect_RetDone; |
1168 | } |
1169 | |
1170 | static IFSelect_ReturnStatus fun44 |
1171 | (const Handle(IFSelect_SessionPilot)& pilot) |
1172 | { |
1173 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1174 | Standard_Integer argc = pilot->NbWords(); |
1175 | const Standard_CString arg1 = pilot->Arg(1); |
1176 | // **** ResetApplied (modifier) **** |
0ebe5b0a |
1177 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1178 | if (argc < 2) { sout<<"Designer un modifier"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1179 | DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1)); |
1180 | if (modif.IsNull()) |
0ebe5b0a |
1181 | { sout<<"Pas un nom de Modifier : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1182 | if (!WS->ResetAppliedModifier(modif)) return IFSelect_RetFail; |
1183 | return IFSelect_RetDone; |
1184 | } |
1185 | |
1186 | static IFSelect_ReturnStatus fun45 |
1187 | (const Handle(IFSelect_SessionPilot)& pilot) |
1188 | { |
1189 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1190 | Standard_Integer argc = pilot->NbWords(); |
1191 | const Standard_CString arg1 = pilot->Arg(1); |
1192 | const Standard_CString arg2 = pilot->Arg(2); |
1193 | const Standard_CString arg3 = pilot->Arg(3); |
1194 | // **** ModifMove **** |
0ebe5b0a |
1195 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1196 | if (argc < 4) { sout<<"modifmove MF rang1 rang2, M pour Model F pour File"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1197 | Standard_Boolean formodel; |
1198 | if (arg1[0] == 'm' || arg1[0] == 'M') formodel = Standard_True; |
1199 | else if (arg1[0] == 'f' || arg1[0] == 'F') formodel = Standard_False; |
0ebe5b0a |
1200 | else { sout<<"preciser M pour Model, F pour File"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1201 | Standard_Integer before = atoi(arg2); |
1202 | Standard_Integer after = atoi(arg3); |
0ebe5b0a |
1203 | if (before == 0 || after == 0) { sout<<"Donner 2 Entiers Positifs"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1204 | if (!WS->ChangeModifierRank(formodel,before,after)) return IFSelect_RetFail; |
1205 | return IFSelect_RetDone; |
1206 | } |
1207 | |
1208 | static IFSelect_ReturnStatus fun51 |
1209 | (const Handle(IFSelect_SessionPilot)& pilot) |
1210 | { |
1211 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1212 | Standard_Integer argc = pilot->NbWords(); |
1213 | const Standard_CString arg1 = pilot->Arg(1); |
1214 | const Standard_CString arg2 = pilot->Arg(2); |
1215 | // **** DispSel **** |
0ebe5b0a |
1216 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1217 | if (argc < 3) { sout<<"Donner Noms Dispatch et Selection Finale"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1218 | DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1)); |
1219 | if (disp.IsNull()) |
0ebe5b0a |
1220 | { sout<<"Pas un nom de Dispatch : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1221 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2)); |
1222 | if (sel.IsNull()) |
0ebe5b0a |
1223 | { sout<<"Pas un nom de Selection : "<<arg2<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1224 | if (!WS->SetItemSelection(disp,sel)) return IFSelect_RetFail; |
1225 | return IFSelect_RetDone; |
1226 | } |
1227 | |
1228 | static IFSelect_ReturnStatus fun_dispone |
1229 | (const Handle(IFSelect_SessionPilot)& pilot) |
1230 | { |
1231 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1232 | // **** DispOne **** |
1233 | Handle(IFSelect_DispPerOne) disp = new IFSelect_DispPerOne; |
1234 | return pilot->RecordItem(disp); |
1235 | } |
1236 | |
1237 | static IFSelect_ReturnStatus fun_dispglob |
1238 | (const Handle(IFSelect_SessionPilot)& pilot) |
1239 | { |
1240 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1241 | // **** DispGlob **** |
1242 | Handle(IFSelect_DispGlobal) disp = new IFSelect_DispGlobal; |
1243 | return pilot->RecordItem(disp); |
1244 | } |
1245 | |
1246 | static IFSelect_ReturnStatus fun_dispcount |
1247 | (const Handle(IFSelect_SessionPilot)& pilot) |
1248 | { |
1249 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1250 | Standard_Integer argc = pilot->NbWords(); |
1251 | const Standard_CString arg1 = pilot->Arg(1); |
1252 | // **** DispCount **** |
0ebe5b0a |
1253 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1254 | if (argc < 2) { sout<<"Donner Nom IntParam pour Count"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1255 | DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1)); |
1256 | if (par.IsNull()) |
0ebe5b0a |
1257 | { sout<<"Pas un nom de IntParam : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1258 | Handle(IFSelect_DispPerCount) disp = new IFSelect_DispPerCount; |
1259 | disp->SetCount (par); |
1260 | return pilot->RecordItem(disp); |
1261 | } |
1262 | |
1263 | static IFSelect_ReturnStatus fun_dispfiles |
1264 | (const Handle(IFSelect_SessionPilot)& pilot) |
1265 | { |
1266 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1267 | Standard_Integer argc = pilot->NbWords(); |
1268 | const Standard_CString arg1 = pilot->Arg(1); |
1269 | // **** DispFiles **** |
0ebe5b0a |
1270 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1271 | if (argc < 2) { sout<<"Donner Nom IntParam pour NbFiles"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1272 | DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1)); |
1273 | if (par.IsNull()) |
0ebe5b0a |
1274 | { sout<<"Pas un nom de IntParam : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1275 | Handle(IFSelect_DispPerFiles) disp = new IFSelect_DispPerFiles; |
1276 | disp->SetCount (par); |
1277 | return pilot->RecordItem(disp); |
1278 | } |
1279 | |
1280 | |
1281 | static IFSelect_ReturnStatus fun_dispsign |
1282 | (const Handle(IFSelect_SessionPilot)& pilot) |
1283 | { |
1284 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1285 | Standard_Integer argc = pilot->NbWords(); |
1286 | const Standard_CString arg1 = pilot->Arg(1); |
1287 | // **** DispFiles **** |
0ebe5b0a |
1288 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1289 | if (argc < 2) { sout<<"Donner Nom Signature"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1290 | DeclareAndCast(IFSelect_Signature,sig,WS->NamedItem(arg1)); |
1291 | if (sig.IsNull()) |
0ebe5b0a |
1292 | { sout<<"Pas un nom de Signature : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1293 | Handle(IFSelect_DispPerSignature) disp = new IFSelect_DispPerSignature; |
1294 | disp->SetSignCounter (new IFSelect_SignCounter(sig)); |
1295 | return pilot->RecordItem(disp); |
1296 | } |
1297 | |
1298 | |
1299 | static IFSelect_ReturnStatus fun56 |
1300 | (const Handle(IFSelect_SessionPilot)& pilot) |
1301 | { |
1302 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1303 | Standard_Integer argc = pilot->NbWords(); |
1304 | const Standard_CString arg1 = pilot->Arg(1); |
1305 | // **** Dispatch **** |
0ebe5b0a |
1306 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1307 | if (argc < 2) { sout<<"Donner Nom du Dispatch"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1308 | DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1)); |
0ebe5b0a |
1309 | if (disp.IsNull()) { sout<<"Pas un dispatch : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1310 | Standard_Integer num = WS->DispatchRank(disp); |
1311 | sout<<"Dispatch de Nom : "<<arg1<<" , en ShareOut, Numero "<<num<<" : "; |
1312 | Handle(IFSelect_Selection) sel = WS->ItemSelection(disp); |
1313 | Handle(TCollection_HAsciiString) selname = WS->Name(sel); |
0ebe5b0a |
1314 | if (sel.IsNull()) sout<<"Pas de Selection Finale"<<std::endl; |
1315 | else if (selname.IsNull()) sout<<"Selection Finale : #"<<WS->ItemIdent(sel)<<std::endl; |
1316 | else sout<<"Selection Finale : "<<selname->ToCString()<<std::endl; |
7fd59977 |
1317 | if (disp->HasRootName()) sout<<"-- Racine nom de fichier : " |
0ebe5b0a |
1318 | <<disp->RootName()->ToCString()<<std::endl; |
7fd59977 |
1319 | return IFSelect_RetVoid; |
1320 | } |
1321 | |
1322 | static IFSelect_ReturnStatus fun57 |
1323 | (const Handle(IFSelect_SessionPilot)& pilot) |
1324 | { |
1325 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1326 | Standard_Integer argc = pilot->NbWords(); |
1327 | const Standard_CString arg1 = pilot->Arg(1); |
1328 | // **** Remove **** |
0ebe5b0a |
1329 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1330 | if (argc < 2) { sout<<"Give Name to Remove !"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1331 | if (!WS->RemoveNamedItem(arg1)) return IFSelect_RetFail; |
1332 | return IFSelect_RetDone; |
1333 | } |
1334 | |
1335 | static IFSelect_ReturnStatus fun58 |
1336 | (const Handle(IFSelect_SessionPilot)& pilot) |
1337 | { |
1338 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1339 | Standard_Integer argc = pilot->NbWords(); |
1340 | const Standard_CString arg1 = pilot->Arg(1); |
1341 | // **** EvalDisp **** |
0ebe5b0a |
1342 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1343 | if (argc < 3) { sout<<"evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n" |
0ebe5b0a |
1344 | <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<std::endl |
1345 | <<"See also : evaladisp writedisp xsplit"<<std::endl; |
7fd59977 |
1346 | return IFSelect_RetVoid; } |
1347 | Standard_Boolean OK = Standard_True; |
1348 | Standard_Integer i , mode = atoi(arg1); sout<<" Mode "<<mode<<"\n"; |
1349 | for (i = 2; i < argc; i ++) { |
1350 | DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i))); |
1351 | if (disp.IsNull()) |
0ebe5b0a |
1352 | { sout<<"Not a dispatch:"<<pilot->Arg(i)<<std::endl; OK = Standard_False; } |
7fd59977 |
1353 | } |
1354 | if (!OK) { |
0ebe5b0a |
1355 | sout<<"Some of the parameters are not correct"<<std::endl; |
7fd59977 |
1356 | return IFSelect_RetError; |
1357 | } |
1358 | |
1359 | WS->ClearShareOut(Standard_True); |
1360 | for (i = 2; i < argc; i ++) { |
1361 | DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i))); |
1362 | WS->SetActive(disp,Standard_True); |
1363 | } |
1364 | // WS->EvaluateDispatch(disp,mode); |
1365 | WS->EvaluateComplete(mode); |
1366 | return IFSelect_RetVoid; |
1367 | } |
1368 | |
1369 | |
1370 | static IFSelect_ReturnStatus fun_evaladisp |
1371 | (const Handle(IFSelect_SessionPilot)& pilot) |
1372 | { |
1373 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1374 | Standard_Integer argc = pilot->NbWords(); |
1375 | const Standard_CString arg1 = pilot->Arg(1); |
1376 | // **** EvalADisp [GiveList] **** |
0ebe5b0a |
1377 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1378 | if (argc < 3) { sout<<"evaladisp mode(=0-1-2-3) disp [givelist] : Mode + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch. Mode:\n" |
0ebe5b0a |
1379 | <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<std::endl |
1380 | <<"See also : writedisp"<<std::endl; |
7fd59977 |
1381 | return IFSelect_RetVoid; } |
0ebe5b0a |
1382 | if (arg1[1] != '\0') { sout<<"first parameter : mode, must be a number between 0 and 3"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1383 | Standard_Integer mode = atoi(arg1); sout<<" Mode "<<mode<<"\n"; |
1384 | // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2))); |
1385 | Handle(IFSelect_Dispatch) disp = IFSelect_Functions::GiveDispatch (WS,pilot->Arg(2),Standard_True); |
1386 | if (disp.IsNull()) |
0ebe5b0a |
1387 | { sout<<"Not a dispatch:"<<pilot->Arg(2)<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1388 | Handle(IFSelect_Selection) selsav = disp->FinalSelection(); |
1389 | Handle(IFSelect_Selection) sel; |
1390 | if (argc > 3) { |
1391 | Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; |
1392 | Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList |
1393 | (pilot->Session(),pilot->CommandPart(3)); |
1394 | Standard_Integer nb = (list.IsNull() ? 0 : list->Length()); |
1395 | if (nb > 0) { sp->AddList (list); sel = sp; } |
1396 | } |
1397 | |
1398 | if (sel.IsNull() && selsav.IsNull()) |
0ebe5b0a |
1399 | { sout<<"No Selection nor GiveList defined"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1400 | if (sel.IsNull() && !selsav.IsNull()) { |
0ebe5b0a |
1401 | if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<std::endl; |
7fd59977 |
1402 | sel = selsav; |
1403 | } |
1404 | disp->SetFinalSelection(sel); |
1405 | // WS->ClearShareOut(Standard_True); |
1406 | // WS->SetActive(disp,Standard_True); |
1407 | WS->EvaluateDispatch(disp,mode); |
1408 | disp->SetFinalSelection(selsav); |
1409 | |
1410 | return IFSelect_RetVoid; |
1411 | } |
1412 | |
1413 | static IFSelect_ReturnStatus fun_writedisp |
1414 | (const Handle(IFSelect_SessionPilot)& pilot) |
1415 | { |
1416 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1417 | Standard_Integer argc = pilot->NbWords(); |
1418 | const Standard_CString arg1 = pilot->Arg(1); |
1419 | // **** EvalADisp [GiveList] **** |
0ebe5b0a |
1420 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1421 | if (argc < 3) { sout<<"writedisp filename disp [givelist] : FileName + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch.\n" |
1422 | <<"FileName : rootname.ext will gives rootname_1.ext etc...\n" |
1423 | <<" path/rootname.ext gives path/rootname_1.ext etc...\n" |
0ebe5b0a |
1424 | <<"See also : evaladisp"<<std::endl; |
7fd59977 |
1425 | return IFSelect_RetVoid; } |
1426 | TCollection_AsciiString prefix,rootname,suffix; |
1427 | SplitFileName (arg1,prefix,rootname,suffix); |
1428 | if (rootname.Length() == 0 || suffix.Length() == 0) { |
0ebe5b0a |
1429 | sout<<"Empty Root Name or Extension"<<std::endl; |
7fd59977 |
1430 | return IFSelect_RetError; |
1431 | } |
1432 | |
1433 | // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2))); |
1434 | Handle(IFSelect_Dispatch) disp = IFSelect_Functions::GiveDispatch (WS,pilot->Arg(2),Standard_True); |
1435 | if (disp.IsNull()) |
0ebe5b0a |
1436 | { sout<<"Not a dispatch:"<<pilot->Arg(2)<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1437 | Handle(IFSelect_Selection) selsav = disp->FinalSelection(); |
1438 | Handle(IFSelect_Selection) sel; |
1439 | if (argc > 3) { |
1440 | Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; |
1441 | Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList |
1442 | (pilot->Session(),pilot->CommandPart(3)); |
1443 | Standard_Integer nb = (list.IsNull() ? 0 : list->Length()); |
1444 | if (nb > 0) { sp->AddList (list); sel = sp; } |
1445 | } |
1446 | |
1447 | if (sel.IsNull() && selsav.IsNull()) |
0ebe5b0a |
1448 | { sout<<"No Selection nor GiveList defined"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1449 | if (sel.IsNull() && !selsav.IsNull()) { |
0ebe5b0a |
1450 | if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<std::endl; |
7fd59977 |
1451 | sel = selsav; |
1452 | } |
1453 | |
1454 | WS->ClearShareOut(Standard_True); |
1455 | disp->SetFinalSelection(sel); |
1456 | WS->SetActive(disp,Standard_True); |
1457 | WS->BeginSentFiles(Standard_True); |
1458 | |
1459 | WS->SetFilePrefix (prefix.ToCString()); |
1460 | WS->SetFileExtension (suffix.ToCString()); |
1461 | WS->SetFileRoot(disp,rootname.ToCString()); |
1462 | |
1463 | Standard_Boolean OK = WS->SendSplit(); |
1464 | disp->SetFinalSelection(selsav); |
1465 | return (OK ? IFSelect_RetDone : IFSelect_RetFail); |
1466 | } |
1467 | |
1468 | |
1469 | static IFSelect_ReturnStatus fun59 |
1470 | (const Handle(IFSelect_SessionPilot)& pilot) |
1471 | { |
1472 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1473 | Standard_Integer argc = pilot->NbWords(); |
1474 | const Standard_CString arg1 = pilot->Arg(1); |
1475 | // **** EvalComplete **** |
1476 | Standard_Integer mode = 0; |
0ebe5b0a |
1477 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1478 | if (argc < 2) sout << " -- mode par defaut 0\n"; |
0ebe5b0a |
1479 | else { mode = atoi(arg1); sout << " -- mode : " << mode << std::endl; } |
7fd59977 |
1480 | WS->EvaluateComplete(mode); return IFSelect_RetVoid; |
1481 | } |
1482 | |
1483 | static IFSelect_ReturnStatus fun60 |
1484 | (const Handle(IFSelect_SessionPilot)& pilot) |
1485 | { |
1486 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1487 | // **** LastRunCheckList **** |
1488 | Interface_CheckIterator chlist = WS->LastRunCheckList(); |
1489 | Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0); |
1490 | counter->Analyse(chlist,WS->Model(),Standard_False); |
0ebe5b0a |
1491 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1492 | counter->PrintCount (sout); |
7fd59977 |
1493 | return IFSelect_RetVoid; |
1494 | } |
1495 | |
1496 | static IFSelect_ReturnStatus fun61 |
1497 | (const Handle(IFSelect_SessionPilot)& pilot) |
1498 | { |
1499 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1500 | Standard_Integer argc = pilot->NbWords(); |
1501 | const Standard_CString arg1 = pilot->Arg(1); |
1502 | // **** RunTransformer **** |
0ebe5b0a |
1503 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1504 | if (argc < 2) { sout<<"Donner Nom de Transformer"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1505 | DeclareAndCast(IFSelect_Transformer,tsf,WS->NamedItem(arg1)); |
1506 | Standard_Integer effect = WS->RunTransformer(tsf); |
1507 | switch (effect) { |
0ebe5b0a |
1508 | case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<std::endl; break; |
1509 | case -3 : sout<<"Erreur, Transformation ignoree"<<std::endl; break; |
1510 | case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<std::endl; break; |
1511 | case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<std::endl; break; |
7fd59977 |
1512 | case 0 : |
0ebe5b0a |
1513 | if (tsf.IsNull()) sout<<"Erreur, pas un Transformer: "<<arg1<<std::endl; |
1514 | else sout<<"Execution non faite"<<std::endl; |
7fd59977 |
1515 | break; |
0ebe5b0a |
1516 | case 1 : sout<<"Transformation locale (graphe non touche)"<<std::endl; break; |
1517 | case 2 : sout<<"Edition sur place (graphe recalcule)"<<std::endl; break; |
1518 | case 3 : sout<<"Modele reconstruit"<<std::endl; break; |
1519 | case 4 : sout<<"Edition sur place, nouveau Protocole"<<std::endl; break; |
1520 | case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<std::endl; break; |
7fd59977 |
1521 | default : break; |
1522 | } |
1523 | return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail); |
1524 | } |
1525 | |
1526 | static IFSelect_ReturnStatus fun62 |
1527 | (const Handle(IFSelect_SessionPilot)& pilot) |
1528 | { |
1529 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1530 | // **** TransformStandard Copy **** |
1531 | return pilot->RecordItem(WS->NewTransformStandard(Standard_True)); |
1532 | } |
1533 | |
1534 | static IFSelect_ReturnStatus fun63 |
1535 | (const Handle(IFSelect_SessionPilot)& pilot) |
1536 | { |
1537 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1538 | // **** TransformStandard OntheSpot **** |
1539 | return pilot->RecordItem(WS->NewTransformStandard(Standard_False)); |
1540 | } |
1541 | |
1542 | static IFSelect_ReturnStatus fun6465 |
1543 | (const Handle(IFSelect_SessionPilot)& pilot) |
1544 | { |
1545 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1546 | Standard_Integer argc = pilot->NbWords(); |
1547 | const Standard_CString arg1 = pilot->Arg(1); |
1548 | // **** Run Modifier avec Standard Copy **** |
1549 | // **** Run Modifier avec OnTheSpot **** |
1550 | Standard_Boolean runcopy = (pilot->Arg(0)[3] == 'c'); |
1551 | // soit c est un nom, sinon c est une commande |
1552 | Handle(IFSelect_Modifier) modif; |
1553 | if (WS->NameIdent(arg1) > 0) |
1554 | modif = GetCasted(IFSelect_Modifier,WS->NamedItem(arg1)); |
1555 | else { |
1556 | pilot->RemoveWord(0); // c etait la commande run |
1557 | pilot->Perform(); |
1558 | modif = GetCasted(IFSelect_Modifier,pilot->RecordedItem()); |
1559 | } |
0ebe5b0a |
1560 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1561 | if (modif.IsNull()) |
0ebe5b0a |
1562 | { sout<<"Pas un nom de Modifier : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1563 | |
1564 | Handle(TColStd_HSequenceOfTransient) list; |
1565 | Handle(IFSelect_SelectPointed) sp; |
1566 | if (argc > 2) { |
1567 | list = IFSelect_Functions::GiveList (WS,pilot->CommandPart(2)); |
1568 | sp = new IFSelect_SelectPointed; |
1569 | sp->SetList (list); |
1570 | } |
1571 | |
1572 | Standard_Integer effect = 0; |
1573 | effect = WS->RunModifierSelected (modif,sp,runcopy); |
04232180 |
1574 | // sout<<"Modifier applique sur TransformStandard #"<<WS->ItemIdent(tsf)<<std::endl; |
7fd59977 |
1575 | switch (effect) { |
0ebe5b0a |
1576 | case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<std::endl; break; |
1577 | case -3 : sout<<"Erreur, Transformation ignoree"<<std::endl; break; |
1578 | case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<std::endl; break; |
1579 | case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<std::endl; break; |
7fd59977 |
1580 | case 0 : |
0ebe5b0a |
1581 | if (modif.IsNull()) sout<<"Erreur, pas un Modifier: "<<arg1<<std::endl; |
1582 | else sout<<"Execution non faite"<<std::endl; |
7fd59977 |
1583 | break; |
0ebe5b0a |
1584 | case 1 : sout<<"Transformation locale (graphe non touche)"<<std::endl; break; |
1585 | case 2 : sout<<"Edition sur place (graphe recalcule)"<<std::endl; break; |
1586 | case 3 : sout<<"Modele reconstruit"<<std::endl; break; |
1587 | case 4 : sout<<"Edition sur place, nouveau Protocole"<<std::endl; break; |
1588 | case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<std::endl; break; |
7fd59977 |
1589 | default : break; |
1590 | } |
1591 | return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail); |
1592 | } |
1593 | |
1594 | static IFSelect_ReturnStatus fun66 |
1595 | (const Handle(IFSelect_SessionPilot)& pilot) |
1596 | { |
1597 | // **** (xset) ModifReorder **** |
1598 | char opt = ' '; |
1599 | Standard_Integer argc = pilot->NbWords(); |
1600 | if (argc >= 2) opt = pilot->Word(1).Value(1); |
0ebe5b0a |
1601 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1602 | if (opt != 'f' && opt != 'l') |
0ebe5b0a |
1603 | { sout<<"Donner option : f -> root-first l -> root-last"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1604 | return pilot->RecordItem(new IFSelect_ModifReorder(opt == 'l')); |
1605 | } |
1606 | |
1607 | static IFSelect_ReturnStatus fun70 |
1608 | (const Handle(IFSelect_SessionPilot)& pilot) |
1609 | { |
1610 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1611 | Standard_Integer argc = pilot->NbWords(); |
1612 | const Standard_CString arg1 = pilot->Arg(1); |
1613 | // **** SelToggle **** |
0ebe5b0a |
1614 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1615 | if (argc < 2) { sout<<"Donner Nom de Selection"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1616 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1)); |
1617 | if (!WS->ToggleSelectExtract(sel)) |
0ebe5b0a |
1618 | { sout<<"Pas une SelectExtract : "<<arg1<<std::endl; return IFSelect_RetFail; } |
1619 | if (WS->IsReversedSelectExtract(sel)) sout<<arg1<<" a present Reversed"<<std::endl; |
1620 | else sout<<arg1<<" a present Directe"<<std::endl; |
7fd59977 |
1621 | return IFSelect_RetDone; |
1622 | } |
1623 | |
1624 | static IFSelect_ReturnStatus fun71 |
1625 | (const Handle(IFSelect_SessionPilot)& pilot) |
1626 | { |
1627 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1628 | Standard_Integer argc = pilot->NbWords(); |
1629 | const Standard_CString arg1 = pilot->Arg(1); |
1630 | const Standard_CString arg2 = pilot->Arg(2); |
1631 | // **** SelInput **** |
0ebe5b0a |
1632 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1633 | if (argc < 3) { sout<<"Donner Noms Selections cible et input"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1634 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1)); |
1635 | DeclareAndCast(IFSelect_Selection,sou,WS->NamedItem(arg2)); |
1636 | if (sel.IsNull() || sou.IsNull()) |
0ebe5b0a |
1637 | { sout<<"Incorrect : "<<arg1<<","<<arg2<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1638 | if (!WS->SetInputSelection(sel,sou)) { |
0ebe5b0a |
1639 | sout<<"Nom incorrect ou Selection "<<arg1<<" ni Extract ni Deduct"<<std::endl; |
7fd59977 |
1640 | return IFSelect_RetFail; |
1641 | } |
1642 | return IFSelect_RetDone; |
1643 | } |
1644 | |
1645 | static IFSelect_ReturnStatus fun72 |
1646 | (const Handle(IFSelect_SessionPilot)& pilot) |
1647 | { |
1648 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1649 | // **** SelModelRoots **** |
1650 | return pilot->RecordItem (new IFSelect_SelectModelRoots); |
1651 | } |
1652 | |
1653 | static IFSelect_ReturnStatus fun73 |
1654 | (const Handle(IFSelect_SessionPilot)& pilot) |
1655 | { |
1656 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1657 | Standard_Integer argc = pilot->NbWords(); |
1658 | const Standard_CString arg1 = pilot->Arg(1); |
1659 | const Standard_CString arg2 = pilot->Arg(2); |
1660 | // **** SelRange **** |
0ebe5b0a |
1661 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1662 | if (argc >= 2 && arg1[0] == '?') argc = 1; |
1663 | if (argc < 2) { |
1664 | sout<<"Donner la description du SelectRange" |
1665 | <<" Formes admises :\n <n1> <n2> : Range de <n1> a <n2>\n" |
1666 | <<" <n1> tout seul : Range n0 <n1>\n from <n1> : Range From <n1>\n" |
0ebe5b0a |
1667 | <<" until <n2> : Range Until <n2>"<<std::endl; |
7fd59977 |
1668 | return IFSelect_RetVoid; |
1669 | } |
1670 | |
1671 | Handle(IFSelect_IntParam) low,up; |
1672 | Handle(IFSelect_SelectRange) sel; |
1673 | // Range From |
1674 | if (pilot->Word(1).IsEqual("from")) { |
0ebe5b0a |
1675 | if (argc < 3) { sout<<"Forme admise : from <i>"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1676 | low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2)); |
1677 | sel = new IFSelect_SelectRange; |
1678 | sel->SetFrom (low); |
1679 | // Range Until |
1680 | } else if (pilot->Word(1).IsEqual("until")) { |
0ebe5b0a |
1681 | if (argc < 3) { sout<<"Forme admise : until <i>"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1682 | up = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2)); |
1683 | sel = new IFSelect_SelectRange; |
1684 | sel->SetUntil (up); |
1685 | // Range One (n-th) |
1686 | } else if (argc < 3) { |
1687 | low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg1)); |
1688 | sel = new IFSelect_SelectRange; |
1689 | sel->SetOne (low); |
1690 | // Range (from-to) |
1691 | } else { |
1692 | low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg1)); |
1693 | up = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2)); |
1694 | sel = new IFSelect_SelectRange; |
1695 | sel->SetRange (low,up); |
1696 | } |
1697 | return pilot->RecordItem (sel); |
1698 | } |
1699 | |
1700 | static IFSelect_ReturnStatus fun74 |
1701 | (const Handle(IFSelect_SessionPilot)& pilot) |
1702 | { |
1703 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1704 | // **** SelRoots **** |
1705 | return pilot->RecordItem (new IFSelect_SelectRoots); |
1706 | } |
1707 | |
1708 | static IFSelect_ReturnStatus fun75 |
1709 | (const Handle(IFSelect_SessionPilot)& pilot) |
1710 | { |
1711 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1712 | // **** SelShared **** |
1713 | return pilot->RecordItem (new IFSelect_SelectShared); |
1714 | } |
1715 | |
1716 | static IFSelect_ReturnStatus fun76 |
1717 | (const Handle(IFSelect_SessionPilot)& pilot) |
1718 | { |
1719 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1720 | Standard_Integer argc = pilot->NbWords(); |
1721 | const Standard_CString arg1 = pilot->Arg(1); |
1722 | const Standard_CString arg2 = pilot->Arg(2); |
1723 | // **** SelDiff **** |
1724 | Handle(IFSelect_Selection) sel = new IFSelect_SelectDiff; |
1725 | if (sel.IsNull()) return IFSelect_RetFail; |
0ebe5b0a |
1726 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1727 | if (argc < 3) sout<<"Diff sans input : ne pas oublier de les definir (ctlmain, ctlsec)!"<<std::endl; |
7fd59977 |
1728 | DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg1)); |
1729 | DeclareAndCast(IFSelect_Selection,selsec ,WS->NamedItem(arg2)); |
1730 | if (argc >= 2) |
1731 | if (!WS->SetControl(sel,selmain,Standard_True)) |
0ebe5b0a |
1732 | sout<<"Echec ControlMain:"<<arg1<<" , a refaire (ctlmain)"<<std::endl; |
7fd59977 |
1733 | if (argc >= 3) |
1734 | if (!WS->SetControl(sel,selsec,Standard_False)) |
0ebe5b0a |
1735 | sout<<"Echec ControlSecond:"<<arg2<<" , a refaire (ctlsec)"<<std::endl; |
7fd59977 |
1736 | return pilot->RecordItem (sel); |
1737 | } |
1738 | |
1739 | static IFSelect_ReturnStatus fun77 |
1740 | (const Handle(IFSelect_SessionPilot)& pilot) |
1741 | { |
1742 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1743 | Standard_Integer argc = pilot->NbWords(); |
1744 | const Standard_CString arg1 = pilot->Arg(1); |
1745 | const Standard_CString arg2 = pilot->Arg(2); |
1746 | // **** SelControlMain **** |
0ebe5b0a |
1747 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1748 | if (argc < 3) { sout<<"Donner Noms de Control et MainInput"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1749 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1)); |
1750 | DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg2)); |
1751 | if (WS->SetControl(sel,selmain,Standard_True)) return IFSelect_RetDone; |
0ebe5b0a |
1752 | sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<std::endl; |
7fd59977 |
1753 | return IFSelect_RetFail; |
1754 | } |
1755 | |
1756 | static IFSelect_ReturnStatus fun78 |
1757 | (const Handle(IFSelect_SessionPilot)& pilot) |
1758 | { |
1759 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1760 | Standard_Integer argc = pilot->NbWords(); |
1761 | const Standard_CString arg1 = pilot->Arg(1); |
1762 | const Standard_CString arg2 = pilot->Arg(2); |
1763 | // **** SelControlSecond **** |
0ebe5b0a |
1764 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1765 | if (argc < 3) { sout<<"Donner Noms de Control et SecondInput"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1766 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1)); |
1767 | DeclareAndCast(IFSelect_Selection,seldif,WS->NamedItem(arg2)); |
1768 | if (WS->SetControl(sel,seldif,Standard_False)) return IFSelect_RetDone; |
0ebe5b0a |
1769 | sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<std::endl; |
7fd59977 |
1770 | return IFSelect_RetFail; |
1771 | } |
1772 | |
1773 | static IFSelect_ReturnStatus fun79 |
1774 | (const Handle(IFSelect_SessionPilot)& pilot) |
1775 | { |
1776 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1777 | // **** SelModelAll **** |
1778 | return pilot->RecordItem (new IFSelect_SelectModelEntities); |
1779 | } |
1780 | |
1781 | static IFSelect_ReturnStatus fun80 |
1782 | (const Handle(IFSelect_SessionPilot)& pilot) |
1783 | { |
1784 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1785 | Standard_Integer argc = pilot->NbWords(); |
1786 | const Standard_CString arg1 = pilot->Arg(1); |
1787 | const Standard_CString arg2 = pilot->Arg(2); |
1788 | // **** SelCombAdd **** |
0ebe5b0a |
1789 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1790 | if (argc < 3) { sout<<"Donner n0 Combine et une Input"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1791 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1)); |
1792 | DeclareAndCast(IFSelect_Selection,seladd,WS->NamedItem(arg2)); |
1793 | if (WS->CombineAdd(sel,seladd)) return IFSelect_RetDone; |
0ebe5b0a |
1794 | sout<<"Nom incorrect ou Selection "<<arg1<<" pas Combine"<<std::endl; |
7fd59977 |
1795 | return IFSelect_RetFail; |
1796 | } |
1797 | |
1798 | static IFSelect_ReturnStatus fun81 |
1799 | (const Handle(IFSelect_SessionPilot)& pilot) |
1800 | { |
1801 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1802 | Standard_Integer argc = pilot->NbWords(); |
1803 | const Standard_CString arg1 = pilot->Arg(1); |
1804 | const Standard_CString arg2 = pilot->Arg(2); |
1805 | // **** SelCombRem **** |
0ebe5b0a |
1806 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1807 | if (argc < 3) { sout<<"Donner n0 Combine et RANG a supprimer"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1808 | DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1)); |
1809 | DeclareAndCast(IFSelect_Selection,inp,WS->NamedItem(arg2)); |
1810 | if (WS->CombineRemove(sel,inp)) return IFSelect_RetDone; |
0ebe5b0a |
1811 | sout<<"Nom incorrect ou Selection "<<arg1<<" ni Union ni Intersection"<<std::endl; |
7fd59977 |
1812 | return IFSelect_RetFail; |
1813 | } |
1814 | |
1815 | static IFSelect_ReturnStatus fun82 |
1816 | (const Handle(IFSelect_SessionPilot)& pilot) |
1817 | { |
1818 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1819 | Standard_Integer argc = pilot->NbWords(); |
1820 | const Standard_CString arg1 = pilot->Arg(1); |
1821 | // **** SelEntNumber **** |
0ebe5b0a |
1822 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1823 | if (argc < 2) { sout<<"Donner Nom IntParam pour n0 Entite"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1824 | DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1)); |
1825 | Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber; |
1826 | sel->SetNumber(par); |
1827 | return pilot->RecordItem (sel); |
1828 | } |
1829 | |
1830 | static IFSelect_ReturnStatus fun83 |
1831 | (const Handle(IFSelect_SessionPilot)& pilot) |
1832 | { |
1833 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1834 | // **** SelUnion **** |
1835 | return pilot->RecordItem (new IFSelect_SelectUnion); |
1836 | } |
1837 | |
1838 | static IFSelect_ReturnStatus fun84 |
1839 | (const Handle(IFSelect_SessionPilot)& pilot) |
1840 | { |
1841 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1842 | // **** SelIntersection **** |
1843 | return pilot->RecordItem (new IFSelect_SelectIntersection); |
1844 | } |
1845 | |
1846 | static IFSelect_ReturnStatus fun85 |
1847 | (const Handle(IFSelect_SessionPilot)& pilot) |
1848 | { |
1849 | Standard_Integer argc = pilot->NbWords(); |
1850 | const Standard_CString arg1 = pilot->Arg(1); |
1851 | // **** SelTextType Exact **** |
0ebe5b0a |
1852 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1853 | if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1854 | return pilot->RecordItem (new IFSelect_SelectSignature |
1855 | (new IFSelect_SignType,arg1,Standard_True)); |
1856 | } |
1857 | |
1858 | static IFSelect_ReturnStatus fun86 |
1859 | (const Handle(IFSelect_SessionPilot)& pilot) |
1860 | { |
1861 | // **** SelErrorEntities **** |
1862 | return pilot->RecordItem (new IFSelect_SelectErrorEntities); |
1863 | } |
1864 | |
1865 | static IFSelect_ReturnStatus fun87 |
1866 | (const Handle(IFSelect_SessionPilot)& pilot) |
1867 | { |
1868 | // **** SelUnknownEntities ** |
1869 | return pilot->RecordItem (new IFSelect_SelectUnknownEntities); |
1870 | } |
1871 | |
1872 | static IFSelect_ReturnStatus fun88 |
1873 | (const Handle(IFSelect_SessionPilot)& pilot) |
1874 | { |
1875 | // **** SelSharing **** |
1876 | return pilot->RecordItem (new IFSelect_SelectSharing); |
1877 | } |
1878 | |
1879 | static IFSelect_ReturnStatus fun89 |
1880 | (const Handle(IFSelect_SessionPilot)& pilot) |
1881 | { |
1882 | Standard_Integer argc = pilot->NbWords(); |
1883 | const Standard_CString arg1 = pilot->Arg(1); |
1884 | // **** SelTextType Contain ** |
0ebe5b0a |
1885 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1886 | if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1887 | return pilot->RecordItem (new IFSelect_SelectSignature |
1888 | (new IFSelect_SignType,arg1,Standard_False)); |
1889 | } |
1890 | |
1891 | static IFSelect_ReturnStatus fun90 |
1892 | (const Handle(IFSelect_SessionPilot)& pilot) |
1893 | { |
1894 | // **** SelPointed **** |
1895 | Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; |
1896 | if (pilot->NbWords() > 1) { |
1897 | Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList |
1898 | (pilot->Session(),pilot->CommandPart(1)); |
1899 | if (list.IsNull()) return IFSelect_RetFail; |
0ebe5b0a |
1900 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1901 | sout<<"SelectPointed : "<<list->Length()<<" entities"<<std::endl; |
7fd59977 |
1902 | sp->AddList (list); |
1903 | } |
1904 | return pilot->RecordItem (sp); |
1905 | } |
1906 | |
1907 | static IFSelect_ReturnStatus fun91 |
1908 | (const Handle(IFSelect_SessionPilot)& pilot) |
1909 | { |
1910 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1911 | Standard_Integer argc = pilot->NbWords(); |
1912 | const Standard_CString arg1 = pilot->Arg(1); |
1913 | // **** SetPointed (edit) / SetList (edit) **** |
0ebe5b0a |
1914 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
1915 | if (argc < 2) { |
1916 | sout<<"Donner NOM SelectPointed + Option(s) :\n" |
1917 | <<" aucune : liste des entites pointees\n" |
0ebe5b0a |
1918 | <<" 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn"<<std::endl; |
7fd59977 |
1919 | return IFSelect_RetError; |
1920 | } |
1921 | DeclareAndCast(IFSelect_SelectPointed,sp,WS->NamedItem(arg1)); |
0ebe5b0a |
1922 | if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<<arg1<<std::endl; return IFSelect_RetError; } |
7f56eba8 |
1923 | const Handle(Interface_InterfaceModel) &model = WS->Model(); // pour Print |
7fd59977 |
1924 | if (argc == 2) { // listage simple |
1925 | Standard_Integer nb = sp->NbItems(); |
0ebe5b0a |
1926 | sout<<" SelectPointed : "<<arg1<<" : "<<nb<<" Items :"<<std::endl; |
7fd59977 |
1927 | for (Standard_Integer i = 1; i <= nb; i ++) { |
1928 | Handle(Standard_Transient) pointed = sp->Item(i); |
1929 | Standard_Integer id = WS->StartingNumber(pointed); |
1930 | if (id == 0) sout <<" (inconnu)"; |
0ebe5b0a |
1931 | else { sout <<" "; model->Print (pointed, sout); } |
7fd59977 |
1932 | } |
0ebe5b0a |
1933 | if (nb > 0) sout<<std::endl; |
7fd59977 |
1934 | return IFSelect_RetDone; |
1935 | } |
1936 | |
1937 | for (Standard_Integer ia = 2; ia < argc ; ia ++) { |
1938 | const TCollection_AsciiString argi = pilot->Word(ia); |
1939 | Standard_Integer id = pilot->Number(&(argi.ToCString())[1]); |
1940 | if (id == 0) { |
0ebe5b0a |
1941 | if (!argi.IsEqual("0")) sout<<"Incorrect,ignore:"<<argi<<std::endl; |
1942 | else { sout<<"Clear SelectPointed"<<std::endl; sp->Clear(); } |
7fd59977 |
1943 | } else if (argi.Value(1) == '-') { |
1944 | Handle(Standard_Transient) item = WS->StartingEntity(id); |
1945 | if (sp->Remove(item)) sout<<"Removed:no."<<id; |
1946 | else sout<<" Echec Remove "<<id; |
0ebe5b0a |
1947 | sout<<": " << std::endl; |
1948 | model->Print (item, sout); |
7fd59977 |
1949 | } else if (argi.Value(1) == '/') { |
1950 | Handle(Standard_Transient) item = WS->StartingEntity(id); |
1951 | if (sp->Remove(item)) sout<<"Toggled:n0."<<id; |
1952 | else sout<<" Echec Toggle "<<id; |
0ebe5b0a |
1953 | sout<<": " << std::endl; |
1954 | model->Print (item, sout); |
7fd59977 |
1955 | } else if (argi.Value(1) == '+') { |
1956 | Handle(Standard_Transient) item = WS->StartingEntity(id); |
1957 | if (sp->Add(item)) sout<<"Added:no."<<id; |
1958 | else sout<<" Echec Add "<<id; |
0ebe5b0a |
1959 | sout<<": " << std::endl; |
1960 | model->Print (item, sout); |
7fd59977 |
1961 | } else { |
0ebe5b0a |
1962 | sout<<"Ignore:"<<argi<<" , donner n0 PRECEDE de + ou - ou /"<<std::endl; |
7fd59977 |
1963 | } |
1964 | } |
1965 | return IFSelect_RetDone; |
1966 | } |
1967 | |
1968 | static IFSelect_ReturnStatus fun92 |
1969 | (const Handle(IFSelect_SessionPilot)& pilot) |
1970 | { |
1971 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1972 | // **** SelIncorrectEntities **** |
1973 | WS->ComputeCheck(); |
1974 | return pilot->RecordItem (new IFSelect_SelectIncorrectEntities); |
1975 | } |
1976 | |
1977 | static IFSelect_ReturnStatus fun93 |
1978 | (const Handle(IFSelect_SessionPilot)& pilot) |
1979 | { |
1980 | Standard_Integer argc = pilot->NbWords(); |
1981 | const Standard_CString arg1 = pilot->Arg(1); |
1982 | const Standard_CString arg2 = pilot->Arg(2); |
1983 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
1984 | // **** SelSignature **** |
0ebe5b0a |
1985 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
1986 | if (argc < 3) { sout<<"Give name of Signature or Counter, text + option exact(D) else contains"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1987 | Standard_Boolean exact = Standard_True; |
1988 | if (argc > 3) { if (pilot->Arg(3)[0] == 'c') exact = Standard_False; } |
1989 | |
1990 | DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1)); |
1991 | DeclareAndCast(IFSelect_SignCounter,cnt,WS->NamedItem(arg1)); |
1992 | Handle(IFSelect_SelectSignature) sel; |
1993 | |
1994 | if (!sign.IsNull()) sel = new IFSelect_SelectSignature (sign,arg2,exact); |
1995 | else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature (cnt,arg2,exact); |
0ebe5b0a |
1996 | else { sout<<arg1<<":neither Signature nor Counter"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
1997 | |
1998 | return pilot->RecordItem(sel); |
1999 | } |
2000 | |
2001 | static IFSelect_ReturnStatus fun94 |
2002 | (const Handle(IFSelect_SessionPilot)& pilot) |
2003 | { |
2004 | Standard_Integer argc = pilot->NbWords(); |
2005 | const Standard_CString arg1 = pilot->Arg(1); |
2006 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
2007 | // **** SignCounter **** |
0ebe5b0a |
2008 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
2009 | if (argc < 2) { sout<<"Donner nom signature"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
2010 | DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1)); |
0ebe5b0a |
2011 | if (sign.IsNull()) { sout<<arg1<<":pas une signature"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
2012 | Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter (sign,Standard_True,Standard_True); |
2013 | return pilot->RecordItem(cnt); |
2014 | } |
2015 | |
2016 | static IFSelect_ReturnStatus funbselected |
2017 | (const Handle(IFSelect_SessionPilot)& pilot) |
2018 | { |
2019 | Standard_Integer argc = pilot->NbWords(); |
2020 | const Standard_CString arg1 = pilot->Arg(1); |
2021 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
2022 | // **** NbSelected = GraphCounter **** |
0ebe5b0a |
2023 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
2024 | if (argc < 2) { sout<<"Donner nom selection (deduction) a appliquer"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
2025 | DeclareAndCast(IFSelect_SelectDeduct,applied,WS->GiveSelection(arg1)); |
0ebe5b0a |
2026 | if (applied.IsNull()) { sout<<arg1<<":pas une SelectDeduct"<<std::endl; return IFSelect_RetError; } |
7fd59977 |
2027 | Handle(IFSelect_GraphCounter) cnt = new IFSelect_GraphCounter (Standard_True,Standard_True); |
2028 | cnt->SetApplied (applied); |
2029 | return pilot->RecordItem(cnt); |
2030 | } |
2031 | |
2032 | // ######################################### |
2033 | // #### EDITOR - EDITFORM #### |
2034 | // ######################################### |
2035 | |
2036 | static IFSelect_ReturnStatus fun_editlist |
2037 | (const Handle(IFSelect_SessionPilot)& pilot) |
2038 | { |
2039 | Standard_Integer argc = pilot->NbWords(); |
0ebe5b0a |
2040 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
2041 | if (argc < 2) { sout<<"Give the name of an EditForm or an Editor"<<std::endl; |
7fd59977 |
2042 | return IFSelect_RetError; } |
2043 | const Standard_CString arg1 = pilot->Arg(1); |
2044 | const Standard_CString arg2 = pilot->Arg(2); |
2045 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
2046 | |
2047 | // EditForm |
2048 | |
2049 | DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1)); |
2050 | Handle(IFSelect_Editor) edt; |
2051 | if (!edf.IsNull()) { |
0ebe5b0a |
2052 | sout<<"Print EditForm "<<arg1<<std::endl; |
7fd59977 |
2053 | edt = edf->Editor(); |
2054 | if (argc < 3) { |
2055 | |
2056 | // DEFINITIONS : Editor (direct ou via EditForm) |
2057 | |
2058 | if (edt.IsNull()) edt = GetCasted(IFSelect_Editor,WS->NamedItem(arg1)); |
2059 | if (edt.IsNull()) return IFSelect_RetVoid; |
2060 | |
0ebe5b0a |
2061 | sout<<"Editor, Label : "<<edt->Label()<<std::endl; |
2062 | sout<<std::endl<<" -- Names (short - complete) + Labels of Values"<<std::endl; |
7fd59977 |
2063 | edt->PrintNames(sout); |
0ebe5b0a |
2064 | sout<<std::endl<<" -- Definitions --"<<std::endl; |
7fd59977 |
2065 | edt->PrintDefs (sout); |
2066 | if (!edf.IsNull()) { |
2067 | edf->PrintDefs(sout); |
0ebe5b0a |
2068 | sout<<std::endl<<"To display values, add an option : o original f final m modified"<<std::endl; |
7fd59977 |
2069 | } |
2070 | |
2071 | return IFSelect_RetVoid; |
2072 | |
2073 | } else { |
2074 | char opt = arg2[0]; |
2075 | Standard_Integer what = 0; |
2076 | if (opt == 'o') what = -1; |
2077 | else if (opt == 'f') what = 1; |
2078 | |
2079 | edf->PrintValues (sout,what,Standard_False); |
2080 | } |
2081 | } |
2082 | |
2083 | return IFSelect_RetVoid; |
2084 | } |
2085 | |
2086 | static IFSelect_ReturnStatus fun_editvalue |
2087 | (const Handle(IFSelect_SessionPilot)& pilot) |
2088 | { |
2089 | Standard_Integer argc = pilot->NbWords(); |
0ebe5b0a |
2090 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
2091 | if (argc < 3) { sout<<"Give the name of an EditForm + name of Value [+ newvalue or . to nullify]"<<std::endl; |
7fd59977 |
2092 | return IFSelect_RetError; } |
2093 | const Standard_CString arg1 = pilot->Arg(1); |
2094 | const Standard_CString arg2 = pilot->Arg(2); |
2095 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
2096 | DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1)); |
2097 | if (edf.IsNull()) |
0ebe5b0a |
2098 | { sout<<"Not an EditForm : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
2099 | Standard_Integer num = edf->NameNumber (arg2); |
0ebe5b0a |
2100 | if (num == 0) sout<<"Unknown Value Name : "<<arg2<<std::endl; |
2101 | if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<std::endl; |
7fd59977 |
2102 | if (num <= 0) return IFSelect_RetError; |
2103 | |
2104 | Standard_Boolean islist = edf->Editor()->IsList(num); |
2105 | Standard_CString name = edf->Editor()->Name(num,Standard_True); // vrai nom |
2106 | Handle(TColStd_HSequenceOfHAsciiString) listr; |
2107 | Handle(TCollection_HAsciiString) str; |
2108 | sout<<"Value Name : "<<name<<(edf->IsModified(num) ? "(already edited) : " : " : "); |
2109 | |
2110 | if (islist) { |
2111 | listr = edf->EditedList(num); |
0ebe5b0a |
2112 | if (listr.IsNull()) sout<<"(NULL LIST)"<<std::endl; |
7fd59977 |
2113 | else { |
2114 | Standard_Integer ilist,nblist = listr->Length(); |
0ebe5b0a |
2115 | sout<<"(List : "<<nblist<<" Items)"<<std::endl; |
7fd59977 |
2116 | for (ilist = 1; ilist <= nblist; ilist ++) { |
2117 | str = listr->Value(ilist); |
0ebe5b0a |
2118 | sout<<" ["<<ilist<<"] "<< (str.IsNull() ? "(NULL)" : str->ToCString())<<std::endl; |
7fd59977 |
2119 | } |
2120 | } |
0ebe5b0a |
2121 | if (argc < 4) sout<<"To Edit, options by editval edit-form value-name ?"<<std::endl; |
7fd59977 |
2122 | } else { |
2123 | str = edf->EditedValue (num); |
0ebe5b0a |
2124 | sout<<(str.IsNull() ? "(NULL)" : str->ToCString())<<std::endl; |
7fd59977 |
2125 | } |
2126 | if (argc < 4) return IFSelect_RetVoid; |
2127 | |
2128 | // Valeur simple ou liste ? |
2129 | Standard_Integer numarg = 3; |
2130 | str.Nullify(); |
2131 | |
2132 | const Standard_CString argval = pilot->Arg(numarg); |
2133 | if (islist) { |
2134 | if (argval[0] == '?') { |
0ebe5b0a |
2135 | sout<<"To Edit, options"<<std::endl<<" + val : add value at end (blanks allowed)" |
2136 | <<std::endl<<" +nn text : insert val before item nn"<<std::endl |
2137 | <<" nn text : replace item nn with a new value"<<std::endl |
2138 | <<" -nn : remove item nn"<<std::endl<<" . : clear the list"<<std::endl; |
7fd59977 |
2139 | return IFSelect_RetVoid; |
2140 | } |
2141 | Standard_Boolean stated = Standard_False; |
2142 | Handle(IFSelect_ListEditor) listed = edf->ListEditor (num); |
2143 | if (listed.IsNull()) return IFSelect_RetError; |
2144 | if (argval[0] == '.') { listr.Nullify(); stated = listed->LoadEdited(listr); } |
2145 | else if (argval[0] == '+') { |
2146 | Standard_Integer numadd = 0; |
2147 | if (argval[1] != '\0') numadd = atoi(argval); |
2148 | stated = listed->AddValue (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numadd); |
2149 | } |
2150 | else if (argval[0] == '-') { |
2151 | Standard_Integer numrem = atoi(argval); |
2152 | stated = listed->Remove(numrem); |
2153 | } |
2154 | else { |
2155 | Standard_Integer numset = atoi(argval); |
2156 | if (numset > 0) stated = listed->AddValue |
2157 | (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numset); |
2158 | } |
2159 | if (stated) stated = edf->ModifyList (num,listed,Standard_True); |
0ebe5b0a |
2160 | if (stated) sout<<"List Edition done"<<std::endl; |
2161 | else sout<<"List Edition not done, option"<<argval<<std::endl; |
7fd59977 |
2162 | } else { |
2163 | if (argval[0] == '.' && argval[1] == '\0') str.Nullify(); |
2164 | else str = new TCollection_HAsciiString (pilot->CommandPart(numarg)); |
2165 | if (edf->Modify (num,str,Standard_True)) { |
0ebe5b0a |
2166 | sout<<"Now set to "<<(str.IsNull() ? "(NULL)" : str->ToCString())<<std::endl; |
7fd59977 |
2167 | } else { |
0ebe5b0a |
2168 | sout<<"Modify not done"<<std::endl; return IFSelect_RetFail; |
7fd59977 |
2169 | } |
2170 | } |
2171 | return IFSelect_RetDone; |
2172 | } |
2173 | |
2174 | static IFSelect_ReturnStatus fun_editclear |
2175 | (const Handle(IFSelect_SessionPilot)& pilot) |
2176 | { |
2177 | Standard_Integer argc = pilot->NbWords(); |
0ebe5b0a |
2178 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
2179 | if (argc < 2) { sout<<"Give the name of an EditForm [+ name of Value else all]"<<std::endl; |
7fd59977 |
2180 | return IFSelect_RetError; } |
2181 | const Standard_CString arg1 = pilot->Arg(1); |
2182 | const Standard_CString arg2 = pilot->Arg(2); |
2183 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
2184 | DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1)); |
2185 | if (edf.IsNull()) |
0ebe5b0a |
2186 | { sout<<"Not an EditForm : "<<arg1<<std::endl; return IFSelect_RetError; } |
2187 | if (argc < 3) { edf->ClearEdit(); sout<<"All Modifications Cleared"<<std::endl; } |
7fd59977 |
2188 | else { |
2189 | Standard_Integer num = edf->NameNumber (arg2); |
0ebe5b0a |
2190 | if (num == 0) sout<<"Unknown Value Name : "<<arg2<<std::endl; |
2191 | if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<std::endl; |
7fd59977 |
2192 | if (num <= 0) return IFSelect_RetError; |
2193 | if (!edf->IsModified(num)) |
0ebe5b0a |
2194 | { sout<<"Value "<<arg2<<" was not modified"<<std::endl; return IFSelect_RetVoid; } |
7fd59977 |
2195 | edf->ClearEdit (num); |
0ebe5b0a |
2196 | sout<<"Modification on Value "<<arg2<<" Cleared"<<std::endl; |
7fd59977 |
2197 | } |
2198 | return IFSelect_RetDone; |
2199 | } |
2200 | |
2201 | static IFSelect_ReturnStatus fun_editapply |
2202 | (const Handle(IFSelect_SessionPilot)& pilot) |
2203 | { |
2204 | Standard_Integer argc = pilot->NbWords(); |
0ebe5b0a |
2205 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
2206 | if (argc < 2) { sout<<"Give the name of an EditForm [+ option keep to re-apply edited values]"<<std::endl; |
7fd59977 |
2207 | return IFSelect_RetError; } |
2208 | const Standard_CString arg1 = pilot->Arg(1); |
2209 | const Standard_CString arg2 = pilot->Arg(2); |
2210 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
2211 | DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1)); |
2212 | if (edf.IsNull()) |
0ebe5b0a |
2213 | { sout<<"Not an EditForm : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
2214 | |
2215 | Handle(Standard_Transient) ent = edf->Entity(); |
2216 | Handle(Interface_InterfaceModel) model = edf->Model(); |
2217 | if (!model.IsNull()) { |
0ebe5b0a |
2218 | if (ent.IsNull()) sout<<"Applying modifications on loaded model"<<std::endl; |
7fd59977 |
2219 | else { |
2220 | sout<<"Applying modifications on loaded entity : "; |
0ebe5b0a |
2221 | model->PrintLabel (ent, sout); |
7fd59977 |
2222 | } |
2223 | } |
0ebe5b0a |
2224 | else sout<<"Applying modifications"<<std::endl; |
7fd59977 |
2225 | |
2226 | if (!edf->ApplyData (edf->Entity(),edf->Model())) { |
0ebe5b0a |
2227 | sout<<"Modifications could not be applied"<<std::endl; |
7fd59977 |
2228 | return IFSelect_RetFail; |
2229 | } |
0ebe5b0a |
2230 | sout<<"Modifications have been applied"<<std::endl; |
7fd59977 |
2231 | |
2232 | Standard_Boolean stat = Standard_True; |
2233 | if (argc > 2 && arg2[0] == 'k') stat = Standard_False; |
2234 | if (stat) { |
2235 | edf->ClearEdit(); |
0ebe5b0a |
2236 | sout<<"Edited values are cleared"<<std::endl; |
7fd59977 |
2237 | } |
0ebe5b0a |
2238 | else sout<<"Edited values are kept for another loading/applying"<<std::endl; |
7fd59977 |
2239 | |
2240 | return IFSelect_RetDone; |
2241 | } |
2242 | |
2243 | static IFSelect_ReturnStatus fun_editload |
2244 | (const Handle(IFSelect_SessionPilot)& pilot) |
2245 | { |
2246 | Standard_Integer argc = pilot->NbWords(); |
0ebe5b0a |
2247 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
2248 | if (argc < 2) { sout<<"Give the name of an EditForm [+ Entity-Ident]"<<std::endl; |
7fd59977 |
2249 | return IFSelect_RetError; } |
2250 | const Standard_CString arg1 = pilot->Arg(1); |
2251 | const Standard_CString arg2 = pilot->Arg(2); |
2252 | Handle(IFSelect_WorkSession) WS = pilot->Session(); |
2253 | DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1)); |
2254 | if (edf.IsNull()) |
0ebe5b0a |
2255 | { sout<<"Not an EditForm : "<<arg1<<std::endl; return IFSelect_RetError; } |
7fd59977 |
2256 | |
2257 | Standard_Integer num = (argc < 3 ? 0 : pilot->Number (arg2)); |
2258 | Standard_Boolean stat = Standard_False; |
2259 | if (argc < 3) { |
0ebe5b0a |
2260 | sout<<"EditForm "<<arg1<<" : Loading Model"<<std::endl; |
7fd59977 |
2261 | stat = edf->LoadModel(WS->Model()); |
2262 | } else if (num <= 0) { |
0ebe5b0a |
2263 | sout<<"Not an entity ident : "<<arg2<<std::endl; |
7fd59977 |
2264 | return IFSelect_RetError; |
2265 | } else { |
0ebe5b0a |
2266 | sout<<"EditForm "<<arg1<<" : Loading Entity "<<arg2<<std::endl; |
7fd59977 |
2267 | stat = edf->LoadData (WS->StartingEntity(num),WS->Model()); |
2268 | } |
2269 | |
2270 | if (!stat) { |
0ebe5b0a |
2271 | sout<<"Loading not done"<<std::endl; |
7fd59977 |
2272 | return IFSelect_RetFail; |
2273 | } |
0ebe5b0a |
2274 | sout<<"Loading done"<<std::endl; |
7fd59977 |
2275 | return IFSelect_RetDone; |
2276 | } |
2277 | |
2278 | // ######################################### |
2279 | // #### FONCTIONS COMPLEMENTAIRES #### |
2280 | // ######################################### |
2281 | |
2282 | Handle(Standard_Transient) IFSelect_Functions::GiveEntity |
2283 | (const Handle(IFSelect_WorkSession)& WS, |
2284 | const Standard_CString name) |
2285 | { |
2286 | Handle(Standard_Transient) ent; // demarre a Null |
2287 | Standard_Integer num = GiveEntityNumber(WS,name); |
2288 | if (num > 0) ent = WS->StartingEntity(num); |
2289 | return ent; |
2290 | } |
2291 | |
2292 | Standard_Integer IFSelect_Functions::GiveEntityNumber |
2293 | (const Handle(IFSelect_WorkSession)& WS, |
2294 | const Standard_CString name) |
2295 | { |
2296 | Standard_Integer num = 0; |
2297 | if (!name || name[0] == '\0') { |
2298 | char ligne[80]; ligne[0] = '\0'; |
04232180 |
2299 | std::cin >> ligne; |
2300 | // std::cin.clear(); std::cin.getline (ligne,79); |
7fd59977 |
2301 | if (ligne[0] == '\0') return 0; |
2302 | num = WS->NumberFromLabel (ligne); |
2303 | } |
2304 | else num = WS->NumberFromLabel (name); |
2305 | return num; |
2306 | } |
2307 | |
2308 | Handle(TColStd_HSequenceOfTransient) IFSelect_Functions::GiveList |
2309 | (const Handle(IFSelect_WorkSession)& WS, |
2310 | const Standard_CString first, const Standard_CString second) |
2311 | { |
2312 | return WS->GiveList (first,second); |
2313 | } |
2314 | |
2315 | |
2316 | // Function which returns an EVALUATED DISPATCH |
2317 | // (could be added in WorkSession.cdl ...) |
2318 | // Two modes : returns dispatch as it is, or return with edition |
2319 | // Dispatch Name can be : an immediate name of already recorded Dispatch |
2320 | // Or a name of dispatch + a parameter : dispatch-name(param-value) |
2321 | // According to type of Dispatch : integer , signature name |
2322 | |
2323 | Handle(IFSelect_Dispatch) IFSelect_Functions::GiveDispatch |
2324 | (const Handle(IFSelect_WorkSession)& WS, |
2325 | const Standard_CString name, const Standard_Boolean mode) |
2326 | { |
2327 | DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(name)); |
2328 | if (!disp.IsNull()) return disp; // OK as it is given |
2329 | |
2330 | // Else, let s try special cases |
2331 | TCollection_AsciiString nam(name); |
2332 | Standard_Integer paro = nam.Location(1,'(',1,nam.Length()); |
2333 | Standard_Integer parf = nam.Location(1,')',1,nam.Length()); |
2334 | nam.SetValue(paro,'\0'); nam.SetValue(parf,'\0'); |
2335 | if (paro <= 0 &&parf <= 0) return disp; |
2336 | disp = GetCasted(IFSelect_Dispatch,WS->NamedItem(nam.ToCString())); |
2337 | if (disp.IsNull()) return disp; // KO anyway |
2338 | |
2339 | // According to the type of dispatch : |
0ebe5b0a |
2340 | Message_Messenger::StreamBuffer sout = Message::SendInfo(); |
7fd59977 |
2341 | DeclareAndCast(IFSelect_DispPerCount,dc,disp); |
2342 | if (!dc.IsNull()) { |
2343 | Standard_Integer nb = atoi( &(nam.ToCString())[paro]); |
2344 | if (nb <= 0) { |
0ebe5b0a |
2345 | sout<<" DispPerCount, count is not positive"<<std::endl; |
7fd59977 |
2346 | disp.Nullify(); |
2347 | return disp; |
2348 | } |
2349 | if (mode) { |
2350 | Handle(IFSelect_IntParam) val = new IFSelect_IntParam; |
2351 | val->SetValue(nb); |
2352 | dc->SetCount (val); |
2353 | } |
2354 | return dc; |
2355 | } |
2356 | DeclareAndCast(IFSelect_DispPerFiles,dp,disp); |
2357 | if (!dp.IsNull()) { |
2358 | Standard_Integer nb = atoi( &(nam.ToCString())[paro]); |
2359 | if (nb <= 0) { |
0ebe5b0a |
2360 | sout<<" DispPerFiles, count is not positive"<<std::endl; |
7fd59977 |
2361 | disp.Nullify(); |
2362 | return disp; |
2363 | } |
2364 | if (mode) { |
2365 | Handle(IFSelect_IntParam) val = new IFSelect_IntParam; |
2366 | val->SetValue(nb); |
2367 | dp->SetCount (val); |
2368 | } |
2369 | return dp; |
2370 | } |
2371 | DeclareAndCast(IFSelect_DispPerSignature,ds,disp); |
2372 | if (!ds.IsNull()) { |
2373 | DeclareAndCast(IFSelect_Signature,sg,WS->NamedItem( &(nam.ToCString())[paro])); |
2374 | if (sg.IsNull()) { |
0ebe5b0a |
2375 | sout<<"DispPerSignature "<<nam<<" , Signature not valid : "<<&(nam.ToCString())[paro]<<std::endl; |
7fd59977 |
2376 | disp.Nullify(); |
2377 | return disp; |
2378 | } |
2379 | if (mode) ds->SetSignCounter (new IFSelect_SignCounter(sg)); |
2380 | return ds; |
2381 | } |
0ebe5b0a |
2382 | sout<<"Dispatch : "<<name<<" , Parameter : "<<&(nam.ToCString())[paro]<<std::endl; |
7fd59977 |
2383 | return disp; |
2384 | } |
2385 | |
2386 | |
2387 | // ######################################### |
2388 | // #### INITIALISATIONS #### |
2389 | // ######################################### |
2390 | |
c48e2889 |
2391 | static int THE_IFSelect_Functions_initactor = 0; |
7fd59977 |
2392 | |
c48e2889 |
2393 | void IFSelect_Functions::Init() |
7fd59977 |
2394 | { |
c48e2889 |
2395 | if (THE_IFSelect_Functions_initactor) |
2396 | { |
2397 | return; |
2398 | } |
2399 | |
2400 | THE_IFSelect_Functions_initactor = 1; |
7fd59977 |
2401 | IFSelect_Act::SetGroup("DE: General"); |
2402 | IFSelect_Act::AddFunc("xstatus","Lists XSTEP Status : Version, System Name ...",funstatus); |
2403 | IFSelect_Act::AddFunc("handler","Toggle status catch Handler Error of the session",fun1); |
7fd59977 |
2404 | IFSelect_Act::AddFunc("xload","file:string : Read File -> Load Model",fun3); |
7fd59977 |
2405 | IFSelect_Act::AddFunc("xread","file:string : Read File -> Load Model",fun3); |
7fd59977 |
2406 | IFSelect_Act::AddFunc("writeall","file:string : Write all model (no split)",fun4); |
2407 | IFSelect_Act::AddFunc("writesel","file:string sel:Selection : Write Selected (no split)",fun5); |
2408 | IFSelect_Act::AddFunc("writeent","file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6); |
2409 | IFSelect_Act::AddFunc("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6); |
2410 | IFSelect_Act::AddFunc("elabel","nument:integer : Displays Label Model of an entity",fun7); |
2411 | IFSelect_Act::AddFunc("enum","label:string : Displays entities n0.s of which Label Model ends by..",fun8); |
2412 | |
2413 | IFSelect_Act::AddFunc("listtypes","List nb entities per type. Optional selection name else all model",fun9); |
2414 | IFSelect_Act::AddFunc("count","Count : counter [selection]",funcount); |
2415 | IFSelect_Act::AddFunc("listcount","List Counted : counter [selection [nument]]",funcount); |
2416 | IFSelect_Act::AddFunc("sumcount","Summary Counted : counter [selection [nument]]",funcount); |
2417 | IFSelect_Act::AddFunc("signtype","Sign Type [newone]",funsigntype); |
2418 | IFSelect_Act::AddFunc("signcase","signature : displays possible cases",funsigncase); |
2419 | |
2420 | IFSelect_Act::AddFunc("estatus","ent/nument : displays status of an entity",fun10); |
2421 | IFSelect_Act::AddFunc("data","Data (DumpModel); whole help : data tout court",fun11); |
2422 | IFSelect_Act::AddFunc("entity","give n0 ou id of entity [+ level]",fundumpent); |
2423 | IFSelect_Act::AddFunc("signature","signature name + n0/ident entity",funsign); |
2424 | IFSelect_Act::AddFunc("queryparent"," give 2 n0s/labels of entities : dad son",funqp); |
2425 | |
2426 | IFSelect_Act::AddFunc("dumpshare","Dump Share (dispatches, IntParams)",fun12); |
2427 | IFSelect_Act::AddFunc("listitems","List Items [label else all] ->Type,Label[,Name]",fun13); |
2428 | IFSelect_Act::AddFSet("integer","value:integer : cree un IntParam",fun14); |
2429 | IFSelect_Act::AddFunc("setint","name:IntParam newValue:integer : Change valeur IntParam",fun15); |
2430 | IFSelect_Act::AddFSet("text","value:string : cree un TextParam",fun16); |
2431 | IFSelect_Act::AddFunc("settext","Name:TextParam newValue:string : Change valeur TextParam",fun17); |
2432 | IFSelect_Act::AddFunc("dumpsel","Dump Selection suivi du Nom de la Selection a dumper",fun19); |
2433 | IFSelect_Act::AddFunc("evalsel","name:Selection [num/sel] : Evalue une Selection",fun20); |
2434 | IFSelect_Act::AddFunc("givelist","num/sel [num/sel ...] : Evaluates GiveList",fun20); |
2435 | IFSelect_Act::AddFunc("giveshort","num/sel [num/sel ...] : GiveList in short form",fun20); |
2436 | IFSelect_Act::AddFunc("givepointed","num/sel [num/sel ...] : GiveList to fill a SelectPointed",fun20); |
2437 | IFSelect_Act::AddFunc("makelist","listname [givelist] : Makes a List(SelectPointed) from GiveList",fun20); |
2438 | IFSelect_Act::AddFunc("givecount","num/sel [num/sel ...] : Counts GiveList",fun20c); |
2439 | IFSelect_Act::AddFSet("selsuite","sel sel ... : Creates a SelectSuite",funselsuite); |
2440 | IFSelect_Act::AddFunc("clearitems","Clears all items (selections, dispatches, etc)",fun21); |
2441 | IFSelect_Act::AddFunc("cleardata","mode:a-g-c-p : Clears all or some data (model, check...)",fun22); |
2442 | |
2443 | IFSelect_Act::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24); |
2444 | IFSelect_Act::AddFunc("xsave","filename:string : sauve items-session",fun25); |
2445 | IFSelect_Act::AddFunc("xrestore","filename:string : restaure items-session",fun26); |
2446 | IFSelect_Act::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27); |
7fd59977 |
2447 | |
2448 | IFSelect_Act::AddFunc("sentfiles","Lists files sent from last Load",fun29); |
2449 | IFSelect_Act::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30); |
2450 | IFSelect_Act::AddFunc("fileext","extent:string : definit File Extension",fun31); |
2451 | IFSelect_Act::AddFunc("fileroot","disp:Dispatch root:string : definit File Root sur un Dispatch",fun32); |
2452 | IFSelect_Act::AddFunc("filedef","defroot:string : definit File DefaultRoot",fun33); |
2453 | IFSelect_Act::AddFunc("evalfile","Evaluation du FileNaming et memorisation",fun34); |
2454 | IFSelect_Act::AddFunc("clearfile","Efface la liste d'EvalFile",fun35); |
2455 | IFSelect_Act::AddFunc("xsplit","[disp:Dispatch sinon tout] : Split, la grande affaire !",fun36); |
2456 | IFSelect_Act::AddFunc("remaining","options... : Remaining Entities, help complet par remaining ?",fun37); |
2457 | IFSelect_Act::AddFunc("setcontent","sel:Selection mode:k ou r : Restreint contenu du modele",fun38); |
2458 | |
2459 | IFSelect_Act::AddFunc("listmodif","List Final Modifiers",fun40); |
2460 | IFSelect_Act::AddFunc("dumpmodif","modif:Modifier : Affiche le Statut d'un Modifier",fun41); |
2461 | IFSelect_Act::AddFunc("modifsel","modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier",fun42); |
2462 | IFSelect_Act::AddFunc("setapplied","modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier",fun43); |
2463 | IFSelect_Act::AddFunc("resetapplied","modif:Modifier : Enleve un Modifier de la sortie fichier",fun44); |
2464 | IFSelect_Act::AddFunc("modifmove","modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)",fun45); |
2465 | |
2466 | IFSelect_Act::AddFunc("dispsel","disp:Dispatch sel:Selection -> Selection Finale de Dispatch",fun51); |
2467 | IFSelect_Act::AddFSet("dispone","cree DispPerOne",fun_dispone); |
2468 | IFSelect_Act::AddFSet("dispglob","cree DispGlobal",fun_dispglob); |
2469 | IFSelect_Act::AddFSet("dispcount","count:IntParam : cree DispPerCount",fun_dispcount); |
2470 | IFSelect_Act::AddFSet("dispfile","files:IntParam : cree DispPerFiles",fun_dispfiles); |
2471 | IFSelect_Act::AddFSet("dispsign","sign:Signature : cree DispPerSignature",fun_dispsign); |
2472 | IFSelect_Act::AddFunc("dumpdisp","disp:Dispatch : Affiche le Statut d'un Dispatch",fun56); |
2473 | |
2474 | IFSelect_Act::AddFunc("xremove","nom : Remove a Control Item de la Session",fun57); |
2475 | IFSelect_Act::AddFunc("evaldisp","mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)",fun58); |
2476 | IFSelect_Act::AddFunc("evaladisp","mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)",fun_evaladisp); |
2477 | IFSelect_Act::AddFunc("writedisp","filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch",fun_writedisp); |
2478 | IFSelect_Act::AddFunc("evalcomplete","Evaluation Complete de la Repartition",fun59); |
2479 | |
2480 | IFSelect_Act::AddFunc("runcheck","affiche LastRunCheckList (write,modif)",fun60); |
2481 | IFSelect_Act::AddFunc("runtranformer","transf:Transformer : Applique un Transformer",fun61); |
2482 | IFSelect_Act::AddFSet("copy","cree TransformStandard, option Copy, vide",fun62); |
2483 | IFSelect_Act::AddFSet("onthespot","cree TransformStandard, option OntheSpot, vide",fun63); |
2484 | IFSelect_Act::AddFunc("runcopy","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy",fun6465); |
2485 | IFSelect_Act::AddFunc("runonthespot","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot",fun6465); |
2486 | IFSelect_Act::AddFSet("reorder","[f ou t] reordonne le modele",fun66); |
2487 | |
2488 | IFSelect_Act::AddFunc("toggle","sel:Selection genre Extract : Toggle Direct/Reverse",fun70); |
2489 | IFSelect_Act::AddFunc("input","sel:Selection genre Deduct ou Extract input:Selection : Set Input",fun71); |
2490 | IFSelect_Act::AddFSet("modelroots","cree SelectModelRoots",fun72); |
2491 | IFSelect_Act::AddFSet("range","options... : cree SelectRange ...; tout court pour help",fun73); |
2492 | IFSelect_Act::AddFSet("roots","cree SelectRoots (local roots)",fun74); |
2493 | IFSelect_Act::AddFSet("shared","cree SelectShared",fun75); |
2494 | IFSelect_Act::AddFSet("diff","[main:Selection diff:Selection] : cree SelectDiff",fun76); |
2495 | IFSelect_Act::AddFunc("selmain","sel:Selection genre Control main:Selection : Set Main Input",fun77); |
2496 | IFSelect_Act::AddFunc("selsecond","sel:Selection genre Control sec:Selection : Set Second Input",fun78); |
2497 | IFSelect_Act::AddFSet("modelall","cree SelectModelAll",fun79); |
2498 | IFSelect_Act::AddFunc("seladd","sel:Selection genre Combine input:Selection : Add Selection",fun80); |
2499 | IFSelect_Act::AddFunc("selrem","sel:Selection genre Combine input:Selection : Remove Selection",fun81); |
2500 | IFSelect_Act::AddFSet("number","num:IntParam : Cree SelectEntityNumber",fun82); |
2501 | |
2502 | IFSelect_Act::AddFSet("union","cree SelectUnion (vide), cf aussi combadd, combrem",fun83); |
2503 | IFSelect_Act::AddFSet("intersect","cree SelectIntersection (vide), cf aussi combadd, combrem",fun84); |
2504 | IFSelect_Act::AddFSet("typexact","type:string : cree SelectTextType Exact",fun85); |
2505 | IFSelect_Act::AddFSet("errors","cree SelectErrorEntities (from file)",fun86); |
2506 | IFSelect_Act::AddFSet("unknown","cree SelectUnknownEntities",fun87); |
2507 | IFSelect_Act::AddFSet("sharing","cree SelectSharing",fun88); |
2508 | IFSelect_Act::AddFSet("typecontain","type:string : cree SelectTextType Contains",fun89); |
2509 | IFSelect_Act::AddFSet("pointed","cree SelectPointed [num/sel num/sel]",fun90); |
2510 | IFSelect_Act::AddFunc("setpointed","sel:SelectPointed : edition SelectPointed. tout court pour help",fun91); |
2511 | IFSelect_Act::AddFunc("setlist","sel:SelectPointed : edition SelectPointed. tout court pour help",fun91); |
2512 | IFSelect_Act::AddFSet("incorrect","cree SelectIncorrectEntities (computed)",fun92); |
2513 | |
2514 | IFSelect_Act::AddFSet("signsel","sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature",fun93); |
2515 | IFSelect_Act::AddFSet("signcounter","sign:Signature : cree SignCounter",fun94); |
2516 | IFSelect_Act::AddFSet("nbselected","applied:Selection : cree GraphCounter(=NbSelected)",funbselected); |
2517 | |
2518 | IFSelect_Act::AddFunc("editlist","editor or editform : lists defs + values",fun_editlist); |
2519 | IFSelect_Act::AddFunc("editvalue","editform paramname [newval or .] : lists-changes a value",fun_editvalue); |
2520 | IFSelect_Act::AddFunc("editclear","editform [paramname] : clears edition on all or one param",fun_editclear); |
2521 | IFSelect_Act::AddFunc("editload","editform [entity-id] : loads from model or an entity",fun_editload); |
2522 | IFSelect_Act::AddFunc("editapply","editform [keep] : applies on loaded data",fun_editapply); |
2523 | } |