1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 //gka 06.01.99 S3767 new function TPSTAT (first version)
15 //pdn 11.01.99 putting "return" statement for compilation on NT
16 #include <XSDRAWIGES.ixx>
18 #include <Standard_ErrorHandler.hxx>
19 #include <Standard_Failure.hxx>
20 #include <Interface_Static.hxx>
22 #include <IGESControl_Writer.hxx>
23 #include <IGESControl_Controller.hxx>
24 #include <IGESData_BasicEditor.hxx>
26 #include <IGESData.hxx>
27 #include <IGESData_Protocol.hxx>
28 // #include <IGESData_IGESWriter.hxx>
29 #include <IGESData_IGESEntity.hxx> // pour igeslist
30 #include <IGESData_IGESModel.hxx>
32 #include <Interface_Check.hxx>
33 #include <Interface_CheckTool.hxx>
34 #include <Interface_CheckIterator.hxx>
37 #include <TCollection_HAsciiString.hxx>
38 #include <TCollection_AsciiString.hxx>
39 #include <TColStd_HSequenceOfTransient.hxx>
42 #include <TopoDS_Shape.hxx>
44 #include <IGESToBRep.hxx>
45 #include <IGESToBRep_Actor.hxx>
46 #include <IGESToBRep_Reader.hxx>
48 #include <Geom_Curve.hxx>
49 #include <Geom_Surface.hxx>
51 #include <Interface_Macros.hxx>
52 #include <Message.hxx>
53 #include <Message_Messenger.hxx>
55 #include <Draw_Appli.hxx>
56 #include <DrawTrSurf.hxx>
58 //#include <GeometryTest.hxx> essai CKY 4-AUT-1998
59 //#include <BRepTest.hxx> essai CKY 4-AUT-1998
60 //#include <MeshTest.hxx> essai CKY 4-AUT-1998
64 #include <IGESSelect_Activator.hxx>
66 #include <XSDRAW_Commands.hxx>
67 #include <Transfer_TransientProcess.hxx>
68 #include <Transfer_TransferOutput.hxx>
69 #include <Transfer_FinderProcess.hxx>
70 #include <XSControl_WorkSession.hxx>
73 #include <IFSelect_SessionPilot.hxx>
74 #include <XSControl.hxx>
75 #include <Transfer_IteratorOfProcessForTransient.hxx>
76 #include <TColStd_MapOfTransient.hxx>
77 #include <IFSelect_Functions.hxx>
78 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
79 #include <IGESControl_Reader.hxx>
80 #include <Interface_InterfaceModel.hxx>
81 #include <Draw_ProgressIndicator.hxx>
82 #include <TopExp_Explorer.hxx>
83 #include <Message_ProgressSentry.hxx>
85 //--------------------------------------------------------------
86 // Function : igesbrep
87 //--------------------------------------------------------------
89 static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
91 DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
92 if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
95 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
96 progress->SetScale ( 0, 100, 1 );
99 IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
100 Standard_Boolean aFullMode = Standard_True;
101 Reader.WS()->SetModeStat(aFullMode);
103 ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
105 TCollection_AsciiString fnom,rnom;
107 Standard_Boolean modfic = XSDRAW::FileAndVar
108 (argv[1],argv[2],"IGESBREP",fnom,rnom);
109 if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
110 else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
111 di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
112 IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
115 OSD_Timer Chr; Chr.Reset();
121 progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
124 if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
125 else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
127 progress->EndScope();
130 if (readstat != IFSelect_RetDone) {
131 if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
132 else di<<"No model loaded"<<"\n";
135 // Choice of treatment
136 Standard_Boolean fromtcl = (argc > 3);
137 Standard_Integer modepri = 1, nent, nbs;
138 if (fromtcl) modepri = 4;
141 //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
142 //mode OnlyVisible does not work.
143 // nent = Reader.NbRootsForTransfer();
145 cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
148 // amv 26.09.2003 : this is used to avoid error of enter's simbol
151 modepri = Draw::Atoi(str);
154 if (modepri == 0) { //fin
155 di << "Bye and good luck! " << "\n";
159 else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
160 di << "All Geometry Transfer"<<"\n";
161 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
162 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
163 Handle(XSControl_WorkSession) thesession = Reader.WS();
164 thesession->ClearContext();
165 XSDRAW::SetTransferProcess (thesession->MapReader());
166 progress->NewScope ( 80, "Translation" );
168 thesession->MapReader()->SetProgress ( progress );
170 if (modepri == 1) Reader.SetReadVisible (Standard_True);
171 Reader.TransferRoots();
173 thesession->MapReader()->SetProgress ( 0 );
174 progress->EndScope();
176 // result in only one shape for all the roots
177 // or in one shape for one root.
178 di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
179 Standard_Integer answer = 1;
180 if (Reader.NbShapes() > 1) {
181 cout << " pass(0) one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
186 answer = Draw::Atoi(str_a);
188 if ( answer == 0) continue;
189 if ( answer == 1 || answer == 3) {
190 TopoDS_Shape shape = Reader.OneShape();
192 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
194 Sprintf(fname, "%s", rnom.ToCString());
195 di << "Saving shape in variable Draw : " << fname << "\n";
196 if (answer == 3) IGESToBRep::WriteShape (shape,1);
199 DBRep::Set(fname,shape);
201 catch(Standard_Failure) {
202 di << "** Exception : ";
203 di << Standard_Failure::Caught()->GetMessageString();
204 di<<" ** Skip"<<"\n";
205 di << "Saving shape in variable Draw : " << fname << "\n";
206 IGESToBRep::WriteShape (shape,1);
210 else if (answer == 2 || answer == 4) {
211 Standard_Integer numshape = Reader.NbShapes();
212 for (Standard_Integer inum = 1; inum <= numshape; inum++) {
213 // save all the shapes
214 TopoDS_Shape shape = Reader.Shape(inum);
215 if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
217 Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
218 di << "Saving shape in variable Draw : " << fname << "\n";
219 if (answer == 4) IGESToBRep::WriteShape (shape,inum);
222 DBRep::Set(fname,shape);
224 catch(Standard_Failure) {
225 di << "** Exception : ";
226 di << Standard_Failure::Caught()->GetMessageString();
227 di<<" ** Skip"<<"\n";
234 else if (modepri == 3) { // One Entity
235 cout << "Only One Entity"<<endl;
236 cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
237 cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
238 cout << " give the number of the Entity : " << flush;
239 nent = XSDRAW::GetEntityNumber();
241 if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
243 nbs = Reader.NbShapes();
244 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
245 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
246 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
247 TopoDS_Shape sh = Reader.Shape(nbs);
248 DBRep::Set (shname,sh);
252 else if (modepri == 4) { // Selection
253 Standard_Integer answer = 1;
254 Handle(TColStd_HSequenceOfTransient) list;
256 // Selection, nommee ou via tcl. tcl : raccourcis admis
257 // * donne iges-visible + xst-transferrable-roots
258 // *r donne xst-model-roots (TOUTES racines)
260 if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
261 di << "All Geometry Transfer"<<"\n";
262 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
263 di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
264 Handle(XSControl_WorkSession) thesession = Reader.WS();
265 thesession->ClearContext();
266 XSDRAW::SetTransferProcess (thesession->MapReader());
267 progress->NewScope ( 80, "Translation" );
269 thesession->MapReader()->SetProgress ( progress );
271 Reader.SetReadVisible (Standard_True);
272 Reader.TransferRoots();
274 thesession->MapReader()->SetProgress ( 0 );
275 progress->EndScope();
278 // result in only one shape for all the roots
279 TopoDS_Shape shape = Reader.OneShape();
282 Sprintf(fname, "%s", rnom.ToCString());
283 di << "Saving shape in variable Draw : " << fname << "\n";
286 DBRep::Set(fname,shape);
288 catch(Standard_Failure) {
289 di << "** Exception : ";
290 di << Standard_Failure::Caught()->GetMessageString();
291 di<<" ** Skip"<<"\n";
292 di << "Saving shape in variable Draw : " << fname << "\n";
293 IGESToBRep::WriteShape (shape,1);
299 modepri = 0; // d office, une seule passe
300 if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
302 list = XSDRAW::GetList ("xst-model-roots");
305 TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
306 di<<"List given by "<<compart.ToCString()<<" : ";
307 list = XSDRAW::GetList (compart.ToCString());
310 di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
315 cout<<"Name of Selection :"<<flush;
316 list = XSDRAW::GetList();
317 if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
320 Standard_Integer nbl = list->Length();
321 di<<"Nb entities selected : "<<nbl<<"\n";
322 if (nbl == 0) continue;
325 cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
330 answer = Draw::Atoi(str_answer);
332 if (answer <= 0 || answer > 3) continue;
334 for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
335 Handle(Standard_Transient) ent = list->Value(ill);
336 di<<" ";// model->Print(ent,di);
340 if (answer == 1 || answer == 2) {
341 Standard_Integer nbt = 0;
342 Handle(XSControl_WorkSession) thesession = Reader.WS();
344 XSDRAW::SetTransferProcess (thesession->MapReader());
345 progress->NewScope ( 80, "Translation" );
347 thesession->MapReader()->SetProgress ( progress );
349 Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
350 for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
352 nent = Reader.Model()->Number(list->Value(ill));
353 if (nent == 0) continue;
354 if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
356 nbs = Reader.NbShapes();
357 char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
358 di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
359 di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
360 TopoDS_Shape sh = Reader.Shape(nbs);
361 DBRep::Set (shname,sh);
365 thesession->MapReader()->SetProgress ( 0 );
366 progress->EndScope();
368 di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
369 answer = 0; // on ne reboucle pas
373 else di<<"Unknown mode n0 "<<modepri<<"\n";
378 //--------------------------------------------------------------
379 // Function : testreadiges
381 //--------------------------------------------------------------
382 static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
386 di << "ERROR in " << argv[0] << "Wrong Number of Arguments."<<"\n";
387 di << " Usage : " << argv[0] <<" file_name shape_name"<< "\n";
390 IGESControl_Reader Reader;
391 Standard_CString filename = argv[1];
392 IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
393 di<<"Status from reading IGES file "<<filename<<" : ";
395 case IFSelect_RetVoid : { di<<"empty file"<<"\n"; return 1; }
396 case IFSelect_RetDone : { di<<"file read"<<"\n"; break; }
397 case IFSelect_RetError : { di<<"file not found"<<"\n"; return 1; }
398 case IFSelect_RetFail : { di<<"error during read"<<"\n"; return 1; }
399 default : { di<<"failure"<<"\n"; return 1; }
401 Reader.TransferRoots();
402 TopoDS_Shape shape = Reader.OneShape();
403 DBRep::Set(argv[2],shape);
404 di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
408 //--------------------------------------------------------------
409 // Function : brepiges
411 //--------------------------------------------------------------
413 static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, const char** a)
415 XSDRAW::SetNorm ("IGES");
416 // ecriture dans le model d'une entite :
417 // - model_AddEntity(ent) : ecriture de l`entite seule
418 // - model->AddWithRefs(ent, protocol): ecriture de l`entite et eventuellement
419 // . de sa matrice de transformation
420 // . de ses sous-elements
422 IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"),
423 Interface_Static::IVal("write.iges.brep.mode"));
424 di<<"unit (write) : "<<Interface_Static::CVal("write.iges.unit")<<"\n";
425 di<<"mode write : "<<Interface_Static::CVal("write.iges.brep.mode")<<"\n";
426 di<<" To modifiy : command param"<<"\n";
428 // Mode d emploi (K4B ->) : brepiges shape [+shape][ +shape] nomfic
429 // c a d tant qu il y a des + on ajoute ce qui suit
430 const char* nomfic = NULL;
431 Standard_Integer npris = 0;
433 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
434 progress->NewScope(90,"Translating");
436 ICW.TransferProcess()->SetProgress(progress);
438 for ( Standard_Integer i = 1; i < n; i++) {
439 const char* nomvar = a[i];
440 if (a[i][0] == '+') nomvar = &(a[i])[1];
441 else if (i > 1) { nomfic = a[i]; break; }
442 TopoDS_Shape Shape = DBRep::Get(nomvar);
443 if (ICW.AddShape (Shape)) npris ++;
444 else if (ICW.AddGeom (DrawTrSurf::GetCurve (nomvar)) ) npris ++;
445 else if (ICW.AddGeom (DrawTrSurf::GetSurface (nomvar)) ) npris ++;
448 XSDRAW::SetModel(ICW.Model());
449 XSDRAW::SetTransferProcess (ICW.TransferProcess());
451 ICW.TransferProcess()->SetProgress(0);
452 progress->EndScope();
454 progress->NewScope(10,"Writing");
457 di<<npris<<" Shapes written, giving "<<XSDRAW::Model()->NbEntities()<<" Entities"<<"\n";
459 if ( ! nomfic ) // delayed write
461 di<<" Now, to write a file, command : writeall filename"<<"\n";
466 if (! ICW.Write(nomfic)) di<<" Error: could not write file " << nomfic;
467 else di<<" File " << nomfic << " written";
469 progress->EndScope();
475 //--------------------------------------------------------------
476 // Function : testwriteiges
478 //--------------------------------------------------------------
480 static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer n, const char** a)
484 di << "ERROR in " << a[0] << "Wrong Number of Arguments."<<"\n";
485 di << " Usage : " << a[0] <<" file_name shape_name"<< "\n";
488 IGESControl_Writer Writer;
489 Standard_CString filename = a[1];
490 TopoDS_Shape shape = DBRep::Get(a[2]);
491 Standard_Boolean ok = Writer.AddShape(shape);
493 di<<"Shape not add"<<"\n";
497 if(!(Writer.Write(filename))){
498 di<<"Error on writing file"<<"\n";
501 di<<"File Is Written"<<"\n";
504 //--------------------------------------------------------------
505 // Function : igesparam
507 //--------------------------------------------------------------
510 static Standard_Integer igesparam (Draw_Interpretor& di, Standard_Integer , const char** )
512 // liste des parametres
513 di<<"List of parameters which control IGES :"<<"\n";
514 di<<" unit : write.iges.unit\n mode write : write.iges.brep.mode\n spline_continuity (read) : read.iges.bspline.continuity\nSee definition by defparam, read/edit value by param"<<"\n";
515 di<<"unit (write) : "<<Interface_Static::CVal("write.iges.unit")<<"\n";
516 di<<"mode write : "<<Interface_Static::CVal("write.iges.brep.mode")<<"\n";
517 di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
518 di<<"\n"<<" To modifier, param nom_param new_val"<<"\n";
523 //--------------------------------------------------------------
524 // Function : tplosttrim
526 //--------------------------------------------------------------
528 static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_Integer n, const char** a)
530 Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
532 // Standard_Integer narg = pilot->NbWords();
533 Standard_Integer narg = n;
535 Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->MapReader();
536 TColStd_Array1OfAsciiString strarg(1, 3);
537 TColStd_Array1OfAsciiString typarg(1, 3);
538 strarg.SetValue(1,"xst-type(CurveOnSurface)");
539 strarg.SetValue(2,"xst-type(Boundary)");
540 strarg.SetValue(3,"xst-type(Loop)");
541 typarg.SetValue(1,"IGESGeom_TrimmedSurface");
542 typarg.SetValue(2,"IGESGeom_BoundedSurface");
543 typarg.SetValue(3,"IGESSolid_Face");
544 if (TP.IsNull()) { di<<"No Transfer Read"<<"\n"; return 1; }
545 Standard_Integer nbFaces = 0, totFaces = 0 ;
546 Handle(IFSelect_WorkSession) WS = pilot->Session();
547 Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult();
548 Standard_Integer k=0;
550 // TCollection_AsciiString Arg = pilot->Word(1);
551 TCollection_AsciiString Arg(a[1]);
552 for(k=1 ; k<=3;k++ ) {
553 if(typarg.Value(k).Location(Arg,1,typarg.Value(k).Length()) != 0) break;
556 if( k == 4) {di<< "Invalid argument"<<"\n"; return 0; }
557 for(Standard_Integer j = 1 ; j <= 3; j++) {
558 TColStd_MapOfTransient aMap;
560 Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(),strarg.Value(k).ToCString());
561 if (!list.IsNull()) itrp.Filter (list);
563 di << "No untrimmed faces" << "\n";
566 for (itrp.Start(); itrp.More(); itrp.Next()) {
567 Handle(Standard_Transient) ent = itrp.Starting();
568 Handle(TColStd_HSequenceOfTransient) super = WS->Sharings (ent);
569 if (!super.IsNull()) {
570 Standard_Integer nb = super->Length();
572 for (Standard_Integer i = 1; i <= nb; i++)
573 if (super->Value(i)->IsKind (typarg.Value(k).ToCString())) {
574 if(aMap.Add(super->Value(i))) nbFaces++;
580 if( j == 1 ) di << "Number of untrimmed faces: " << "\n";
583 di << "Trimmed Surface: " << "\n"; break;
585 di << "Bounded Surface: " << "\n"; break;
587 di << "Face: " << "\n"; break;
590 TColStd_MapIteratorOfMapOfTransient itmap;
591 for(itmap.Initialize(aMap); itmap.More(); itmap.Next()) {
592 XSDRAW::Model()->Print (itmap.Key(), Message::DefaultMessenger());
596 di << "\n" << "Number:"<< nbFaces << "\n";
603 if(totFaces == 0) di << "No untrimmed faces" << "\n";
604 else di << "Total number :" << totFaces << "\n";
607 //-------------------------------------------------------------------
608 //--------------------------------------------------------------
611 //--------------------------------------------------------------
612 static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& di,Standard_Integer n, const char** a)
614 Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
615 Standard_Integer argc = n;//= pilot->NbWords();
616 const Standard_CString arg1 = a[1];//pilot->Arg(1);
617 //IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
618 Handle(Transfer_TransientProcess) TP= XSControl::Session(pilot)->MapReader();
619 IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
620 //read.SetTransientProcess(TP);
622 // if (TP.IsNull()) { di<<"No Transfer Read"<<"\n"; return IFSelect_RetError;}
623 Handle(Interface_InterfaceModel) model = TP->Model();
624 //Handle(Interface_InterfaceModel) model = read.Model();
625 if (model.IsNull()) {di<<"No Transfer Read"<<"\n"; return -1;}
626 //DeclareAndCast(IGESData_IGESModel,modelig,model);
627 // read.SetModel(modelig);
628 Handle(XSControl_WorkSession) thesession = read.WS();
629 thesession->SetMapReader(TP);
630 //read.SetModel(model);
631 Standard_Integer mod1 = 0;
633 char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
635 case 'g' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_GeneralInfo);break;
636 case 'c' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_CountByItem); break;
637 case 'C' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_ListByItem); break;
638 case 'r' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_ResultCount);break;
639 case 's' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_Mapping);break;
640 case '?' : mod1 = -1; break;
641 default : mod1 = -2; break;
644 if (mod1 < -1) di<<"Unknown Mode"<<"\n";
646 di<<"Modes available :\n"
647 <<"g : general c : checks (count) C (list)"<<"\n"
648 <<"r : number of CasCade resulting shapes"<<"\n"
649 <<"s : mapping between IGES entities and CasCade shapes"<<"\n";
650 if (mod1 < -1) return -1;
656 static Standard_Integer etest(Draw_Interpretor& di, Standard_Integer argc, const char** a)
659 di<<"etest igesfile shape"<<"\n";
662 IGESControl_Reader aReader;
663 aReader.ReadFile(a[1]);
664 aReader.SetReadVisible(Standard_True);
665 aReader.TransferRoots();
666 TopoDS_Shape shape = aReader.OneShape();
667 DBRep::Set(a[2],shape);
672 static void cleanpilot ()
674 XSDRAW::Session()->ClearData(1);
679 //--------------------------------------------------------------
680 // Function : Init(s)
682 //--------------------------------------------------------------
684 void XSDRAWIGES::InitSelect ()
686 Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator;
687 IGESControl_Controller::Init();
688 // XSDRAW::SetNorm ("IGES"); trop tot
689 XSDRAW::SetController (XSControl_Controller::Recorded("iges"));
695 //=======================================================================
696 //function : InitToBRep
698 //=======================================================================
700 void XSDRAWIGES::InitToBRep (Draw_Interpretor& theCommands)
702 const char* g = "DE: IGES";
703 theCommands.Add("igesbrep", "igesbrep [file else already loaded model] [name DRAW]", __FILE__, igesbrep, g);
704 theCommands.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread, g);
705 theCommands.Add("igesread", "igesread [file else already loaded model] [name DRAW]", __FILE__, igesbrep, g);
706 theCommands.Add("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, g);
707 theCommands.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, g);
708 theCommands.Add("tplosttrim", "number of untrimmed faces during last transfer", __FILE__, XSDRAWIGES_tplosttrim, g);
709 theCommands.Add("etest", "test of eviewer", __FILE__, etest, g);
714 //=======================================================================
715 //function : InitFromBRep
717 //=======================================================================
719 void XSDRAWIGES::InitFromBRep (Draw_Interpretor& theCommands)
721 const char* g = "DE: IGES";
722 theCommands.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, g);
723 theCommands.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, g);