1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <Standard_Stream.hxx>
22 #include "GEOM_I3DPrimOperations_i.hh"
24 #include "utilities.h"
26 #include "Utils_ExceptHandlers.hxx"
28 #include "GEOM_Engine.hxx"
29 #include "GEOM_Object.hxx"
31 //=============================================================================
35 //=============================================================================
36 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
37 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
39 MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
42 //=============================================================================
46 //=============================================================================
47 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
49 MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
53 //=============================================================================
57 //=============================================================================
58 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
62 GEOM::GEOM_Object_var aGEOMObject;
65 GetOperations()->SetNotDone();
68 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
69 if (!GetOperations()->IsDone() || anObject.IsNull())
70 return aGEOMObject._retn();
72 return GetObject(anObject);
75 //=============================================================================
79 //=============================================================================
80 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
81 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
83 GEOM::GEOM_Object_var aGEOMObject;
86 GetOperations()->SetNotDone();
88 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
90 //Get the reference points
91 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
92 (thePnt1->GetStudyID(), thePnt1->GetEntry());
93 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
94 (thePnt2->GetStudyID(), thePnt2->GetEntry());
96 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
99 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
100 if (!GetOperations()->IsDone() || anObject.IsNull())
101 return aGEOMObject._retn();
103 return GetObject(anObject);
106 //=============================================================================
110 //=============================================================================
111 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
114 GEOM::GEOM_Object_var aGEOMObject;
116 //Set a not done flag
117 GetOperations()->SetNotDone();
119 //Create the Cylinder
120 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
121 if (!GetOperations()->IsDone() || anObject.IsNull())
122 return aGEOMObject._retn();
124 return GetObject(anObject);
127 //=============================================================================
129 * MakeCylinderPntVecRH
131 //=============================================================================
132 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
133 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
134 CORBA::Double theR, CORBA::Double theH)
136 GEOM::GEOM_Object_var aGEOMObject;
138 //Set a not done flag
139 GetOperations()->SetNotDone();
141 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
143 //Get the reference points
144 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
145 (thePnt->GetStudyID(), thePnt->GetEntry());
146 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
147 (theVec->GetStudyID(), theVec->GetEntry());
149 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
151 //Create the Cylinder
152 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
153 if (!GetOperations()->IsDone() || anObject.IsNull())
154 return aGEOMObject._retn();
156 return GetObject(anObject);
159 //=============================================================================
163 //=============================================================================
164 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
168 GEOM::GEOM_Object_var aGEOMObject;
170 //Set a not done flag
171 GetOperations()->SetNotDone();
174 Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
175 if (!GetOperations()->IsDone() || anObject.IsNull())
176 return aGEOMObject._retn();
178 return GetObject(anObject);
181 //=============================================================================
183 * MakeConePntVecR1R2H
185 //=============================================================================
186 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
187 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
188 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
190 GEOM::GEOM_Object_var aGEOMObject;
192 //Set a not done flag
193 GetOperations()->SetNotDone();
195 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
197 //Get the reference points
198 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
199 (thePnt->GetStudyID(), thePnt->GetEntry());
200 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
201 (theVec->GetStudyID(), theVec->GetEntry());
203 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
206 Handle(GEOM_Object) anObject =
207 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
208 if (!GetOperations()->IsDone() || anObject.IsNull())
209 return aGEOMObject._retn();
211 return GetObject(anObject);
214 //=============================================================================
218 //=============================================================================
219 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
221 GEOM::GEOM_Object_var aGEOMObject;
223 //Set a not done flag
224 GetOperations()->SetNotDone();
227 Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
228 if (!GetOperations()->IsDone() || anObject.IsNull())
229 return aGEOMObject._retn();
231 return GetObject(anObject);
234 //=============================================================================
238 //=============================================================================
239 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
240 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
242 GEOM::GEOM_Object_var aGEOMObject;
244 //Set a not done flag
245 GetOperations()->SetNotDone();
247 if (thePnt == NULL) return aGEOMObject._retn();
249 //Get the reference point
250 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
251 (thePnt->GetStudyID(), thePnt->GetEntry());
253 if (aPnt.IsNull()) return aGEOMObject._retn();
256 Handle(GEOM_Object) anObject =
257 GetOperations()->MakeSpherePntR(aPnt, theR);
258 if (!GetOperations()->IsDone() || anObject.IsNull())
259 return aGEOMObject._retn();
261 return GetObject(anObject);
264 //=============================================================================
268 //=============================================================================
269 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
270 (CORBA::Double theRMajor, CORBA::Double theRMinor)
272 GEOM::GEOM_Object_var aGEOMObject;
274 //Set a not done flag
275 GetOperations()->SetNotDone();
278 Handle(GEOM_Object) anObject =
279 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
280 if (!GetOperations()->IsDone() || anObject.IsNull())
281 return aGEOMObject._retn();
283 return GetObject(anObject);
286 //=============================================================================
290 //=============================================================================
291 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
292 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
293 CORBA::Double theRMajor, CORBA::Double theRMinor)
295 GEOM::GEOM_Object_var aGEOMObject;
297 //Set a not done flag
298 GetOperations()->SetNotDone();
300 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
302 //Get the reference points
303 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
304 (thePnt->GetStudyID(), thePnt->GetEntry());
305 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
306 (theVec->GetStudyID(), theVec->GetEntry());
308 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
311 Handle(GEOM_Object) anObject =
312 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
313 if (!GetOperations()->IsDone() || anObject.IsNull())
314 return aGEOMObject._retn();
316 return GetObject(anObject);
319 //=============================================================================
323 //=============================================================================
324 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
325 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
328 GEOM::GEOM_Object_var aGEOMObject;
330 //Set a not done flag
331 GetOperations()->SetNotDone();
333 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
335 //Get the reference objects
336 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
337 (theBase->GetStudyID(), theBase->GetEntry());
338 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
339 (theVec->GetStudyID(), theVec->GetEntry());
341 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
344 Handle(GEOM_Object) anObject =
345 GetOperations()->MakePrismVecH(aBase, aVec, theH);
346 if (!GetOperations()->IsDone() || anObject.IsNull())
347 return aGEOMObject._retn();
349 return GetObject(anObject);
352 //=============================================================================
356 //=============================================================================
357 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
358 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
361 GEOM::GEOM_Object_var aGEOMObject;
363 //Set a not done flag
364 GetOperations()->SetNotDone();
366 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
368 //Get the reference objects
369 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
370 (theBase->GetStudyID(), theBase->GetEntry());
371 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
372 (theVec->GetStudyID(), theVec->GetEntry());
374 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
377 Handle(GEOM_Object) anObject =
378 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
379 if (!GetOperations()->IsDone() || anObject.IsNull())
380 return aGEOMObject._retn();
382 return GetObject(anObject);
385 //=============================================================================
389 //=============================================================================
390 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
391 (GEOM::GEOM_Object_ptr theBase,
392 GEOM::GEOM_Object_ptr thePoint1,
393 GEOM::GEOM_Object_ptr thePoint2)
395 GEOM::GEOM_Object_var aGEOMObject;
397 //Set a not done flag
398 GetOperations()->SetNotDone();
400 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
401 return aGEOMObject._retn();
403 //Get the reference objects
404 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
405 (theBase->GetStudyID(), theBase->GetEntry());
406 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
407 (thePoint1->GetStudyID(), thePoint1->GetEntry());
408 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
409 (thePoint2->GetStudyID(), thePoint2->GetEntry());
411 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
412 return aGEOMObject._retn();
415 Handle(GEOM_Object) anObject =
416 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
417 if (!GetOperations()->IsDone() || anObject.IsNull())
418 return aGEOMObject._retn();
420 return GetObject(anObject);
423 //=============================================================================
425 * MakePrismTwoPnt2Ways
427 //=============================================================================
428 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
429 (GEOM::GEOM_Object_ptr theBase,
430 GEOM::GEOM_Object_ptr thePoint1,
431 GEOM::GEOM_Object_ptr thePoint2)
433 GEOM::GEOM_Object_var aGEOMObject;
435 //Set a not done flag
436 GetOperations()->SetNotDone();
438 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
439 return aGEOMObject._retn();
441 //Get the reference objects
442 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
443 (theBase->GetStudyID(), theBase->GetEntry());
444 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
445 (thePoint1->GetStudyID(), thePoint1->GetEntry());
446 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
447 (thePoint2->GetStudyID(), thePoint2->GetEntry());
449 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
450 return aGEOMObject._retn();
453 Handle(GEOM_Object) anObject =
454 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
455 if (!GetOperations()->IsDone() || anObject.IsNull())
456 return aGEOMObject._retn();
458 return GetObject(anObject);
461 //=============================================================================
465 //=============================================================================
466 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
467 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
469 GEOM::GEOM_Object_var aGEOMObject;
471 //Set a not done flag
472 GetOperations()->SetNotDone();
474 if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
476 //Get the reference objects
477 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
478 (theBase->GetStudyID(), theBase->GetEntry());
479 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
480 (thePath->GetStudyID(), thePath->GetEntry());
482 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
485 Handle(GEOM_Object) anObject =
486 GetOperations()->MakePipe(aBase, aPath);
487 if (!GetOperations()->IsDone() || anObject.IsNull())
488 return aGEOMObject._retn();
490 return GetObject(anObject);
493 //=============================================================================
495 * MakeRevolutionAxisAngle
497 //=============================================================================
498 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
499 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
500 CORBA::Double theAngle)
502 GEOM::GEOM_Object_var aGEOMObject;
504 //Set a not done flag
505 GetOperations()->SetNotDone();
507 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
509 //Get the reference objects
510 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
511 (theBase->GetStudyID(), theBase->GetEntry());
512 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
513 (theAxis->GetStudyID(), theAxis->GetEntry());
515 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
517 //Create the Revolution
518 Handle(GEOM_Object) anObject =
519 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
520 if (!GetOperations()->IsDone() || anObject.IsNull())
521 return aGEOMObject._retn();
523 return GetObject(anObject);
526 //=============================================================================
528 * MakeRevolutionAxisAngle2Ways
530 //=============================================================================
531 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
532 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
533 CORBA::Double theAngle)
535 GEOM::GEOM_Object_var aGEOMObject;
537 //Set a not done flag
538 GetOperations()->SetNotDone();
540 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
542 //Get the reference objects
543 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
544 (theBase->GetStudyID(), theBase->GetEntry());
545 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
546 (theAxis->GetStudyID(), theAxis->GetEntry());
548 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
550 //Create the Revolution
551 Handle(GEOM_Object) anObject =
552 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
553 if (!GetOperations()->IsDone() || anObject.IsNull())
554 return aGEOMObject._retn();
556 return GetObject(anObject);
559 //=============================================================================
563 //=============================================================================
564 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
565 CORBA::Long theMinDeg,
566 CORBA::Long theMaxDeg,
567 CORBA::Double theTol2D,
568 CORBA::Double theTol3D,
569 CORBA::Long theNbIter)
571 GEOM::GEOM_Object_var aGEOMObject;
573 //Set a not done flag
574 GetOperations()->SetNotDone();
576 if (theShape == NULL) return aGEOMObject._retn();
578 //Get the reference objects
579 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
580 (theShape->GetStudyID(), theShape->GetEntry());
582 if (aShape.IsNull()) return aGEOMObject._retn();
585 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter);
586 if (!GetOperations()->IsDone() || anObject.IsNull())
587 return aGEOMObject._retn();
589 return GetObject(anObject);
592 //=============================================================================
596 //=============================================================================
597 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
598 CORBA::Boolean theModeSolid,
599 CORBA::Double thePreci,
600 CORBA::Boolean theRuled)
602 GEOM::GEOM_Object_var aGEOMObject;
604 //Set a not done flag
605 GetOperations()->SetNotDone();
606 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
610 aLen = theSeqSections.length();
611 for (ind = 0; ind < aLen; ind++) {
612 if (theSeqSections[ind] == NULL) continue;
613 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
614 (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
616 aSeqSections->Append(aSh);
618 if(!aSeqSections->Length())
619 return aGEOMObject._retn();
621 // Make shell or solid
622 Handle(GEOM_Object) anObject =
623 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
624 if (!GetOperations()->IsDone() || anObject.IsNull())
625 return aGEOMObject._retn();
627 return GetObject(anObject);
630 //=============================================================================
632 * MakePipeWithDifferentSections
634 //=============================================================================
635 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
636 const GEOM::ListOfGO& theLocations,
637 GEOM::GEOM_Object_ptr thePath,
638 CORBA::Boolean theWithContact,
639 CORBA::Boolean theWithCorrections)
641 GEOM::GEOM_Object_var aGEOMObject;
643 //Set a not done flag
644 GetOperations()->SetNotDone();
645 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
646 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
647 int ind=0, aNbBases =0,aNbLocs=0;
650 aNbBases = theBases.length();
651 aNbLocs = theLocations.length();
653 if( aNbLocs && aNbBases != aNbLocs)
654 return aGEOMObject._retn();
656 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
657 (thePath->GetStudyID(), thePath->GetEntry());
659 return aGEOMObject._retn();
661 for (ind = 0; ind < aNbBases; ind++) {
662 if (theBases[ind] == NULL) continue;
663 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(),
664 theBases[ind]->GetEntry());
669 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
670 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
673 aSeqLocations->Append(aLoc);
675 aSeqBases->Append(aBase);
677 if(!aSeqBases->Length())
678 return aGEOMObject._retn();
681 Handle(GEOM_Object) anObject =
682 GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
683 theWithContact,theWithCorrections);
684 if (!GetOperations()->IsDone() || anObject.IsNull())
685 return aGEOMObject._retn();
687 return GetObject(anObject);
691 //=============================================================================
693 * MakePipeWithShellSections
695 //=============================================================================
696 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
697 (const GEOM::ListOfGO& theBases,
698 const GEOM::ListOfGO& theSubBases,
699 const GEOM::ListOfGO& theLocations,
700 GEOM::GEOM_Object_ptr thePath,
701 CORBA::Boolean theWithContact,
702 CORBA::Boolean theWithCorrections)
704 GEOM::GEOM_Object_var aGEOMObject;
706 //Set a not done flag
707 GetOperations()->SetNotDone();
708 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
709 Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
710 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
711 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
714 aNbBases = theBases.length();
715 aNbSubBases = theSubBases.length();
716 aNbLocs = theLocations.length();
718 if( aNbLocs && aNbBases != aNbLocs)
719 return aGEOMObject._retn();
721 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
722 (thePath->GetStudyID(), thePath->GetEntry());
724 return aGEOMObject._retn();
726 for (ind = 0; ind < aNbBases; ind++) {
727 if (theBases[ind] == NULL) continue;
728 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
729 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
733 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
734 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
737 aSeqLocations->Append(aLoc);
739 aSeqBases->Append(aBase);
741 if(aNbSubBases>=aNbBases) {
742 Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
743 GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
744 if(aSubBase.IsNull()) {
745 aSeqSubBases->Clear();
749 aSeqSubBases->Append(aSubBase);
753 if(!aSeqBases->Length())
754 return aGEOMObject._retn();
757 Handle(GEOM_Object) anObject =
758 GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
759 aSeqLocations, aPath,
760 theWithContact, theWithCorrections);
761 if (!GetOperations()->IsDone() || anObject.IsNull())
762 return aGEOMObject._retn();
764 return GetObject(anObject);
768 //=============================================================================
770 * MakePipeShellsWithoutPath
772 //=============================================================================
773 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
774 (const GEOM::ListOfGO& theBases,
775 const GEOM::ListOfGO& theLocations)
777 GEOM::GEOM_Object_var aGEOMObject;
779 //Set a not done flag
780 GetOperations()->SetNotDone();
781 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
782 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
783 int ind=0, aNbBases=0, aNbLocs=0;
786 aNbBases = theBases.length();
787 aNbLocs = theLocations.length();
789 if( aNbLocs && aNbBases != aNbLocs)
790 return aGEOMObject._retn();
792 for (ind = 0; ind < aNbBases; ind++) {
793 if (theBases[ind] == NULL) continue;
794 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
795 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
799 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
800 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
803 aSeqLocations->Append(aLoc);
805 aSeqBases->Append(aBase);
808 if(!aSeqBases->Length())
809 return aGEOMObject._retn();
812 Handle(GEOM_Object) anObject =
813 GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
815 if (!GetOperations()->IsDone() || anObject.IsNull())
816 return aGEOMObject._retn();
818 return GetObject(anObject);