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