0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IGESToBRep / IGESToBRep_Reader.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14//pdn 11.01.99 including <stdio.h> for compilation on NT
15//#70 rln 03.03.99 syntax correction
16// sln 11.06.2002 OCC448 : Initialize "read.onlyvisiable" parameter to control transfering invisiable sub entities which logicaly depend on the grouping entities
7fd59977 17
7fd59977 18#include <BRep_Builder.hxx>
19#include <BRepLib.hxx>
20#include <BRepTools_Modifier.hxx>
42cf5bc1 21#include <gp_Trsf.hxx>
22#include <IGESAppli.hxx>
23#include <IGESAppli_Protocol.hxx>
7fd59977 24#include <IGESData_FileProtocol.hxx>
25#include <IGESData_GlobalSection.hxx>
26#include <IGESData_IGESEntity.hxx>
42cf5bc1 27#include <IGESData_IGESModel.hxx>
28#include <IGESFile_Read.hxx>
7fd59977 29#include <IGESSolid.hxx>
30#include <IGESSolid_Protocol.hxx>
7fd59977 31#include <IGESToBRep.hxx>
32#include <IGESToBRep_Actor.hxx>
33#include <IGESToBRep_CurveAndSurface.hxx>
42cf5bc1 34#include <IGESToBRep_Reader.hxx>
35#include <Interface_Check.hxx>
36#include <Interface_CheckIterator.hxx>
37#include <Interface_CheckTool.hxx>
38#include <Interface_Macros.hxx>
39#include <Interface_ShareFlags.hxx>
40#include <Interface_Static.hxx>
41#include <Message_Messenger.hxx>
42#include <Message_Msg.hxx>
43#include <Message_ProgressSentry.hxx>
44#include <OSD_Timer.hxx>
45#include <ShapeAlgo.hxx>
46#include <ShapeAlgo_AlgoContainer.hxx>
7fd59977 47#include <ShapeExtend_Explorer.hxx>
48#include <ShapeFix_ShapeTolerance.hxx>
42cf5bc1 49#include <Standard_ErrorHandler.hxx>
50#include <Standard_Failure.hxx>
51#include <TopAbs.hxx>
52#include <TopoDS_Compound.hxx>
53#include <TopoDS_Shape.hxx>
7fd59977 54#include <Transfer_IteratorOfProcessForTransient.hxx>
42cf5bc1 55#include <Transfer_TransferOutput.hxx>
56#include <Transfer_TransientProcess.hxx>
7fd59977 57#include <TransferBRep.hxx>
58#include <TransferBRep_ShapeBinder.hxx>
59#include <TransferBRep_ShapeListBinder.hxx>
60#include <XSAlgo.hxx>
61#include <XSAlgo_AlgoContainer.hxx>
62
42cf5bc1 63#include <stdio.h>
64//#include <ShapeCustom.hxx>
57c28b61 65#ifdef _MSC_VER
7fd59977 66#include <stdlib.h>
67#else
68#include <errno.h>
69#endif
70//extern int errno;
71
72static Handle(IGESData_FileProtocol) protocol;
73
74
75//=======================================================================
76//function : IGESToBRep_Reader
77//purpose :
78//=======================================================================
79 IGESToBRep_Reader::IGESToBRep_Reader ()
80{
81 theDone = Standard_False;
82 if (protocol.IsNull()) {
83 IGESAppli::Init(); IGESSolid::Init();
84 protocol = new IGESData_FileProtocol;
85 protocol->Add(IGESAppli::Protocol());
86 protocol->Add(IGESSolid::Protocol());
87 }
88 theActor = new IGESToBRep_Actor;
89 theProc = new Transfer_TransientProcess;
90}
91
92
93//=======================================================================
94//function : LoadFile
95//purpose : loads a Model from a file
96//=======================================================================
97
98Standard_Integer IGESToBRep_Reader::LoadFile (const Standard_CString filename)
99{
100 if ( theProc.IsNull() )
101 theProc = new Transfer_TransientProcess;
102 Handle(Message_Messenger) TF = theProc->Messenger();
103
104 // Message for Diagnostic file.
105 Message_Msg msg2000("IGES_2000");
106 msg2000.Arg(filename);
107 TF->Send (msg2000, Message_Info);
108 //Message_Msg msg2001("IGES_2001"); // Date
109 Message_Msg msg2005("IGES_2005");
110 msg2005.Arg(theProc->TraceLevel());
111 TF->Send (msg2005, Message_Info);
112 /////////////////////////////////////////////////////////
113 Handle(IGESData_IGESModel) model = new IGESData_IGESModel;
114
115 OSD_Timer c; c.Reset(); c.Start();
116 char *pfilename=(char *)filename;
117 Standard_Integer StatusFile = IGESFile_Read(pfilename,model,protocol);
118 if (StatusFile != 0) {
119 // Sending of message : IGES file opening error
120 Message_Msg Msg2("XSTEP_2");
121 TF->Send (Msg2, Message_Info);
122 //Message_Msg Msg3("XSTEP_3");
123 //Message_Msg Msg4("XSTEP_4");
124 //Message_Msg Msg5("XSTEP_5");
125 //Message_Msg Msg6("XSTEP_6");
126 //Message_Msg Msg7("XSTEP_7");
127 // Reasons of the file opening error
128 switch(errno)
129 {
130 case 2 : // Sending of message : No such file or directory
131 {
132 Message_Msg Msg3("XSTEP_3");
133 TF->Send (Msg3, Message_Info);
134 }
135 break;
136 case 12 : // Sending of message : Not enough space
137 {
138 Message_Msg Msg4("XSTEP_4");
139 TF->Send (Msg4, Message_Info);
140 }
141 break;
142 case 13 : // Sending of message : Permission Denied
143 {
144 Message_Msg Msg5("XSTEP_5");
145 TF->Send (Msg5, Message_Info);
146 }
147 break;
148 case 24 : // Sending of message : Too many open files
149 {
150 Message_Msg Msg6("XSTEP_6");
151 TF->Send (Msg6, Message_Info);
152 }
153 break;
154 default : // Sending of message : No determined
155 {
156 Message_Msg Msg7("XSTEP_7");
157 TF->Send (Msg7, Message_Info);
158 }
159 break;
160 }
161 }
162
163 Message_Msg Msg8 ("XSTEP_8");
164 Message_Msg Msg25 ("XSTEP_25");
165 Message_Msg Msg26 ("XSTEP_26");
166 // Nb warning in global section.
167
168 Standard_Integer nbWarn = 0,nbFail = 0;
169 // Add the number of warning on enities :
170 Interface_CheckTool cht (model,protocol);
171 Interface_CheckIterator anIter = cht.CompleteCheckList();
172 for(anIter.Start(); anIter.More(); anIter.Next()) {
173 const Handle(Interface_Check) ach = anIter.Value();
174 nbWarn += ach->NbWarnings();
175 nbFail += ach->NbFails();
176 }
177// Messages nbWarn and nbFail;
178 Msg25.Arg(nbFail);
179 Msg26.Arg(nbWarn);
180 TF->Send (Msg25, Message_Info);
181 TF->Send (Msg26, Message_Info);
182
183 // Message fin de loading iGES file (elapsed time %s)
184 char t[20];
185 t[0]='\0';
186 Standard_Real second, cpu;
187 Standard_Integer minute, hour;
188 c.Show(second, minute, hour,cpu);
189 if (hour > 0)
91322f44 190 Sprintf(t,"%dh:%dm:%.2fs",hour,minute,second);
7fd59977 191 else if (minute > 0)
91322f44 192 Sprintf(t,"%dm:%.2fs",minute,second);
7fd59977 193 else
91322f44 194 Sprintf(t,"%.2fs",second);
7fd59977 195 // Sending of message : End of Loading
196 Msg8.Arg(t);
197 TF->Send (Msg8, Message_Info);
198
199 SetModel(model);
200 return StatusFile;
201}
202
203
204//=======================================================================
205//function : SetModel
206//purpose : Specifies a Model to work on
207//=======================================================================
208 void IGESToBRep_Reader::SetModel (const Handle(IGESData_IGESModel)& model)
209{
210 theModel = model;
211 theDone = Standard_False;
212 theShapes.Clear();
213 if ( theProc.IsNull() )
214 theProc = new Transfer_TransientProcess (theModel->NbEntities());
215 else
216 theProc->Clear();
217}
218
219
220//=======================================================================
221//function : Model
222//purpose : returns the Model to be worked on
223//=======================================================================
224 Handle(IGESData_IGESModel) IGESToBRep_Reader::Model () const
225 { return theModel; }
226
227
228//=======================================================================
229//function : SetTransientProcess
230//purpose : Specifies a TransferProcess
231//=======================================================================
232 void IGESToBRep_Reader::SetTransientProcess
233 (const Handle(Transfer_TransientProcess)& TP)
234 { theProc = TP; }
235
236//=======================================================================
237//function : TransientProcess
238//purpose : Returns the TransferProcess
239//=======================================================================
240 Handle(Transfer_TransientProcess) IGESToBRep_Reader::TransientProcess () const
241 { return theProc; }
242
243//=======================================================================
244//function : Actor
245//purpose : returns theActor
246//=======================================================================
247 Handle(IGESToBRep_Actor) IGESToBRep_Reader::Actor () const
248 { return theActor; }
249
250
251//=======================================================================
252//function : Clear
253//purpose : Clears the result and Done status
254//=======================================================================
255 void IGESToBRep_Reader::Clear ()
256{
257 theDone = Standard_False;
258 theShapes.Clear();
259}
260
261
262//=======================================================================
263//function : Check
264//purpose : Checks the Model
265//=======================================================================
266 Standard_Boolean IGESToBRep_Reader::Check
267 (const Standard_Boolean withprint) const
268{
269 Interface_CheckTool cht (theModel,protocol);
270 Interface_CheckIterator chl = cht.CompleteCheckList();
271 if (withprint && !theProc.IsNull())
272 cht.Print(chl, theProc->Messenger());
273 return chl.IsEmpty(Standard_True);
274}
275
276
277//=======================================================================
278//function : IsDone
279//purpose : returns True if the last transfert was a success
280//=======================================================================
281 Standard_Boolean IGESToBRep_Reader::IsDone () const
282 { return theDone; }
283
284
285//=======================================================================
286//function : EncodeRegul
287//purpose : INTERNAL to encode regularity on edges
288//=======================================================================
289
290static Standard_Boolean EncodeRegul (const TopoDS_Shape& sh)
291{
292 Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
293 if (sh.IsNull()) return Standard_True;
294 if (tolang <= 0) return Standard_True;
295 try {
296 OCC_CATCH_SIGNALS
297 BRepLib::EncodeRegularity (sh,tolang);
298 }
299 catch(Standard_Failure) {
300 return Standard_False;
301 }
302 return Standard_True;
303}
304
305//=======================================================================
306//function : UpdateMap
307//purpose : Updates the correspondence map (Transfer_TransientProcess),
308// setting as translation results, the shapes received after
309// modification by modifier (BRepTools_Modifier)
310//warning : BRepTools_Modifier raises exception when it cannot find input
311// shape in its internal list
312//=======================================================================
313
314// coment as unused PTV 18.09.2000
315// static void UpdateMap (const Handle(Transfer_TransientProcess)& map,
316// const BRepTools_Modifier& modifier)
317// {
318// Transfer_IteratorOfProcessForTransient iterator = map->CompleteResult(Standard_True);
319// for (iterator.Start(); iterator.More(); iterator.Next()) {
320// const Handle(Transfer_Binder) binder = iterator.Value();
321// try { //to avoid exception in BRepTools_Modifier
322// OCC_CATCH_SIGNALS
323// if (binder->IsKind (STANDARD_TYPE (TransferBRep_ShapeBinder))) {
324// DeclareAndCast(TransferBRep_ShapeBinder, shapebinder, binder);
325// if (shapebinder->HasResult()) {
326// TopoDS_Shape result = shapebinder->Result();
327// TopoDS_Shape modified = modifier.ModifiedShape (result);
328// if (shapebinder->Status() != Transfer_StatusUsed) //to avoid exception
329// shapebinder->SetResult (modified);
330// }
331// }
332// else if (binder->IsKind (STANDARD_TYPE (TransferBRep_ShapeListBinder))) {
333// DeclareAndCast(TransferBRep_ShapeListBinder, shapelistbinder, binder);
334// for (Standard_Integer i = 1; i <= shapelistbinder->NbShapes(); i++) {
335// TopoDS_Shape result = shapelistbinder->Shape (i);
336// TopoDS_Shape modified = modifier.ModifiedShape (result);
337// shapelistbinder->SetResult (i, modified);
338// }
339// }
340// }
341// catch(Standard_Failure) {
342// continue;
343// }
344// }
345// }
346
347//=======================================================================
348//function : TrimTolerances
349//purpose : Trims tolerances of the shape according to static parameters
350//
351//=======================================================================
352
353static void TrimTolerances (const TopoDS_Shape& shape,
354 const Standard_Real tol)
355{
356 if( Interface_Static::IVal("read.maxprecision.mode")==1) {
357 ShapeFix_ShapeTolerance SFST;
358 SFST.LimitTolerance (shape, 0, Max(tol,Interface_Static::RVal ("read.maxprecision.val")));
359 }
360}
361
362//=======================================================================
363//function : TransferRoots
364//purpose : Transfers all Roots Entities
365//=======================================================================
366void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible)
367{
368 if (theModel.IsNull() || theProc.IsNull()) return;
369
370 Handle(Message_Messenger) TF = theProc->Messenger();
371 // Declaration of messages.
372 Message_Msg msg2030("IGES_2030");
373 TF->Send (msg2030, Message_Info);
374 Message_Msg msg2065("IGES_2065");
375 OSD_Timer c; c.Reset(); c.Start(); // Initialisation du CHRONO
376 theDone = Standard_False;
377 theShapes.Clear();
378
379 Standard_Integer level = theProc->TraceLevel();
380 theProc->SetErrorHandle(Standard_True);
381 theProc->SetRootManagement(Standard_True);
382// PrepareTransfer(); -> protocol, actor
383 theActor->SetModel(theModel);
384 Standard_Integer continuity = Interface_Static::IVal("read.iges.bspline.continuity");
385 theActor->SetContinuity (continuity);
386 theProc->SetModel (theModel);
387 theProc->SetActor (theActor);
388 Transfer_TransferOutput TP (theProc,theModel);
389
543a9964 390 const Handle(Interface_Protocol) aProtocol = protocol; // to avoid ambiguity
391 Interface_ShareFlags SH (theModel, aProtocol);
7fd59977 392 Standard_Integer nb = theModel->NbEntities();
393 ShapeExtend_Explorer SBE;
394
395
396 Standard_Integer precisionMode = Interface_Static::IVal("read.precision.mode");
397 Message_Msg msg2035("IGES_2035");
398 msg2035.Arg(precisionMode);
399 TF->Send (msg2035, Message_Info);
400 if (precisionMode==1) {
401 Message_Msg msg2040("IGES_2040");
402 msg2040.Arg(Interface_Static::RVal("read.precision.val"));//#70 rln 03.03.99
403 TF->Send (msg2040, Message_Info);
404 }
405 Message_Msg msg2045("IGES_2045");
406 msg2045.Arg(continuity);
407 TF->Send (msg2045, Message_Info);
408 Message_Msg msg2050("IGES_2050");
409 msg2050.Arg(Interface_Static::IVal("read.surfacecurve.mode"));
410 TF->Send (msg2050, Message_Info);
411
412 // sln 11.06.2002 OCC448
413 Interface_Static::SetIVal("read.iges.onlyvisible",onlyvisible);
414
415 Message_ProgressSentry PS ( theProc->GetProgress(), "Root", 0, nb, 1 );
416 for (Standard_Integer i = 1; i <= nb && PS.More(); i++, PS.Next()) {
417 Handle(IGESData_IGESEntity) ent = theModel->Entity(i);
418 if ( SH.IsShared(ent) || ! theActor->Recognize (ent) ) continue;
419 if (level > 0) {
420 Message_Msg msg2070("IGES_2070");
421 msg2070.Arg(2*i-1);
422 msg2070.Arg(ent->TypeNumber());
423 TF->Send (msg2070, Message_Info);
424 }
425 // on ajoute un traitement pour ne prendre que les entites visibles
426 if ( ! onlyvisible || ent->BlankStatus() == 0 ) {
427 TopoDS_Shape shape;
428 theDone = Standard_True;
429 try {
430 OCC_CATCH_SIGNALS
431 TP.Transfer(ent);
432 shape = TransferBRep::ShapeResult (theProc,ent);
433 }
434 catch(Standard_Failure) {
435 Message_Msg msg1005("IGES_1005");
436 TF->Send (msg1005, Message_Info);
437 continue;
438 }
439 if (shape.IsNull()) {
440 Message_Msg msg2076("IGES_2076");
441 TF->Send (msg2076, Message_Info);
442 }
443 else {
444 if (SBE.ShapeType(shape,Standard_True) != TopAbs_SHAPE) {
445 if (!shape.IsNull()) {
446 EncodeRegul (shape);
447 //#74 rln 03.03.99 S4135
448 TrimTolerances (shape, theActor->UsedTolerance());
449 theShapes.Append(shape);
450 }
451 }
452 }
453 }
454 }
455 char t [20];
456 t[0]='\0';
457 Standard_Real second, cpu;
458 Standard_Integer minute, hour;
459 c.Show(second, minute, hour,cpu);
460 if (hour > 0)
91322f44 461 Sprintf(t,"%dh:%dm:%.2fs",hour,minute,second);
7fd59977 462 else if (minute > 0)
91322f44 463 Sprintf(t,"%dm:%.2fs",minute,second);
7fd59977 464 else
91322f44 465 Sprintf(t,"%.2fs",second);
7fd59977 466 // Sending of message : End of Loading
467 msg2065.Arg(t);
468 TF->Send (msg2065, Message_Info);
469}
470
471
472//=======================================================================
473//function : Transfer
474//purpose : Transfers an Entity given
475//=======================================================================
476Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num)
477{
478 Handle(Message_Messenger) TF = theProc->Messenger();
479 theDone = Standard_False;
480 if (theModel.IsNull()) {
481 Message_Msg msg2031("IGES_2031");
482 TF->Send (msg2031, Message_Info);
483 return Standard_False;
484 }
485 if (num <= 0 || num > theModel->NbEntities()) {
486 Message_Msg msg2032("IGES_2032");
487 msg2032.Arg(num);
488 TF->Send (msg2032, Message_Info);
489 return Standard_False;
490 }
491 // declaration of messages
492 Message_Msg msg2030("IGES_2030");
493 TF->Send (msg2030, Message_Info);
494 Message_Msg msg2065("IGES_2065");
495 OSD_Timer c; c.Reset(); c.Start(); // Initialisation du CHRONO
496
497 Handle(IGESData_IGESEntity) ent = theModel->Entity(num);
498
499 Message_ProgressSentry PS ( theProc->GetProgress(), "OneEnt", 0, 1, 1 ); //skl
500
501 XSAlgo::AlgoContainer()->PrepareForTransfer();
502 IGESToBRep_CurveAndSurface CAS;
503 CAS.SetModel(theModel);
504 Standard_Real eps;
505 Standard_Integer Ival = Interface_Static::IVal("read.precision.mode");
506 Message_Msg msg2035("IGES_2035");
507 msg2035.Arg(Ival);
508 TF->Send (msg2035, Message_Info);
509 if ( Ival == 0)
510 eps = theModel->GlobalSection().Resolution();
511 else {
512 //mjm : modif du 19/12/97 pour prise en compte effective du parametre
513 eps = Interface_Static::RVal("read.precision.val");
514 Message_Msg msg2040("IGES_2040");
515 msg2040.Arg(eps);//#70 rln 03.03.99
516 TF->Send (msg2040, Message_Info);
517
518 }
519 Ival = Interface_Static::IVal("read.iges.bspline.approxd1.mode");
520 CAS.SetModeApprox ( (Ival > 0) );
521 Message_Msg msg2045("IGES_2045");
522 Ival = Interface_Static::IVal("read.iges.bspline.continuity");
523 msg2045.Arg(Ival);
524 TF->Send (msg2045, Message_Info);
525 CAS.SetContinuity(Ival);
526 Message_Msg msg2050("IGES_2050");
527 Ival = Interface_Static::IVal("read.surfacecurve.mode");
528 msg2050.Arg(Ival);
529 TF->Send (msg2050, Message_Info);
530 CAS.SetSurfaceCurve (Ival);
531
532 if (eps > 1.E-08) CAS.SetEpsGeom(eps);
533 CAS.SetTransferProcess(theProc);
534
535 Standard_Boolean exceptionRaised = Standard_False;
536 TopoDS_Shape shape;
537 Standard_Integer nbTPitems = theProc->NbMapped();
538 {
539 try {
540 OCC_CATCH_SIGNALS
541 shape = CAS.TransferGeometry (ent);
542 }
543 catch(Standard_Failure) {
544 Message_Msg msg1015("IGES_1015");
545 TF->Send (msg1015, Message_Info);
546 exceptionRaised = Standard_True;
547 }
548 }
549 if (!exceptionRaised) {
550 // fixing shape
551// shape = XSAlgo::AlgoContainer()->PerformFixShape ( shape, theProc, eps*CAS.GetUnitFactor(), CAS.GetMaxTol() );
552
553 Handle(Standard_Transient) info;
554 shape = XSAlgo::AlgoContainer()->ProcessShape( shape, eps*CAS.GetUnitFactor(), CAS.GetMaxTol(),
555 "read.iges.resource.name",
b485ee79
KD
556 "read.iges.sequence", info,
557 theProc->GetProgress() );
7fd59977 558 XSAlgo::AlgoContainer()->MergeTransferInfo(theProc, info, nbTPitems);
559
560 ShapeExtend_Explorer SBE;
561 if (SBE.ShapeType (shape,Standard_True) != TopAbs_SHAPE) {
562 TransferBRep::SetShapeResult (theProc,ent,shape);
563 theProc->SetRoot (ent);
564 if (!shape.IsNull()) {
565 theDone = Standard_True;
566 EncodeRegul (shape);
567 //#74 rln 03.03.99 S4135
568 TrimTolerances (shape, CAS.GetMaxTol());
569 theShapes.Append(shape);
570 }
571 }
572 }
573
574 PS.Relieve(); //skl
575
576 char t [20];
577 t[0]='\0';
578 Standard_Real second, cpu;
579 Standard_Integer minute, hour;
580 c.Show(second, minute, hour,cpu);
581 if (hour > 0)
91322f44 582 Sprintf(t,"%dh:%dm:%.2fs",hour,minute,second);
7fd59977 583 else if (minute > 0)
91322f44 584 Sprintf(t,"%dm:%.2fs",minute,second);
7fd59977 585 else
91322f44 586 Sprintf(t,"%.2fs",second);
7fd59977 587 // Sending of message : End of Loading
588 msg2065.Arg(t);
589 TF->Send (msg2065, Message_Info);
590 return Standard_True;
591}
592
593
594//=======================================================================
595//function : UsedTolerance
596//purpose : Returns the used tolerance (input)
597//=======================================================================
598 Standard_Real IGESToBRep_Reader::UsedTolerance () const
599 { return theActor->UsedTolerance(); }
600
601//=======================================================================
602//function : NbShapes
603//purpose : Returns the count of produced Shapes
604//=======================================================================
605 Standard_Integer IGESToBRep_Reader::NbShapes () const
606 { return theShapes.Length(); }
607
608
609//=======================================================================
610//function : Shape
611//purpose : Returns a Shape given its rank
612//=======================================================================
613 TopoDS_Shape IGESToBRep_Reader::Shape (const Standard_Integer num) const
614{
615 TopoDS_Shape res;
616 if (num > 0 && num <= theShapes.Length()) res = theShapes.Value(num);
617 return res;
618}
619
620
621//=======================================================================
622//function : OneShape
623//purpose : Returns a unique Shape
624//=======================================================================
625 TopoDS_Shape IGESToBRep_Reader::OneShape () const
626{
627 TopoDS_Shape res;
628 Standard_Integer nb = theShapes.Length();
629 if (nb == 0) return res;
630 else if (nb == 1) return theShapes.Value(1);
631 else {
632 TopoDS_Compound C;
633 BRep_Builder B;
634 B.MakeCompound(C);
635 for (Standard_Integer i = 1; i <= nb; i ++) B.Add (C,theShapes.Value(i));
636 return C;
637 }
638}