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