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 CORBA::String_var entry=thePnt->GetEntry();
251 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
252 (thePnt->GetStudyID(), entry);
254 if (aPnt.IsNull()) return aGEOMObject._retn();
257 Handle(GEOM_Object) anObject =
258 GetOperations()->MakeSpherePntR(aPnt, theR);
259 if (!GetOperations()->IsDone() || anObject.IsNull())
260 return aGEOMObject._retn();
262 return GetObject(anObject);
265 //=============================================================================
269 //=============================================================================
270 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
271 (CORBA::Double theRMajor, CORBA::Double theRMinor)
273 GEOM::GEOM_Object_var aGEOMObject;
275 //Set a not done flag
276 GetOperations()->SetNotDone();
279 Handle(GEOM_Object) anObject =
280 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
281 if (!GetOperations()->IsDone() || anObject.IsNull())
282 return aGEOMObject._retn();
284 return GetObject(anObject);
287 //=============================================================================
291 //=============================================================================
292 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
293 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
294 CORBA::Double theRMajor, CORBA::Double theRMinor)
296 GEOM::GEOM_Object_var aGEOMObject;
298 //Set a not done flag
299 GetOperations()->SetNotDone();
301 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
303 //Get the reference points
304 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
305 (thePnt->GetStudyID(), thePnt->GetEntry());
306 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
307 (theVec->GetStudyID(), theVec->GetEntry());
309 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
312 Handle(GEOM_Object) anObject =
313 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
314 if (!GetOperations()->IsDone() || anObject.IsNull())
315 return aGEOMObject._retn();
317 return GetObject(anObject);
320 //=============================================================================
324 //=============================================================================
325 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
326 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
329 GEOM::GEOM_Object_var aGEOMObject;
331 //Set a not done flag
332 GetOperations()->SetNotDone();
334 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
336 //Get the reference objects
337 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
338 (theBase->GetStudyID(), theBase->GetEntry());
339 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
340 (theVec->GetStudyID(), theVec->GetEntry());
342 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
345 Handle(GEOM_Object) anObject =
346 GetOperations()->MakePrismVecH(aBase, aVec, theH);
347 if (!GetOperations()->IsDone() || anObject.IsNull())
348 return aGEOMObject._retn();
350 return GetObject(anObject);
353 //=============================================================================
357 //=============================================================================
358 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
359 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
362 GEOM::GEOM_Object_var aGEOMObject;
364 //Set a not done flag
365 GetOperations()->SetNotDone();
367 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
369 //Get the reference objects
370 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
371 (theBase->GetStudyID(), theBase->GetEntry());
372 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
373 (theVec->GetStudyID(), theVec->GetEntry());
375 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
378 Handle(GEOM_Object) anObject =
379 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
380 if (!GetOperations()->IsDone() || anObject.IsNull())
381 return aGEOMObject._retn();
383 return GetObject(anObject);
386 //=============================================================================
390 //=============================================================================
391 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
392 (GEOM::GEOM_Object_ptr theBase,
393 GEOM::GEOM_Object_ptr thePoint1,
394 GEOM::GEOM_Object_ptr thePoint2)
396 GEOM::GEOM_Object_var aGEOMObject;
398 //Set a not done flag
399 GetOperations()->SetNotDone();
401 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
402 return aGEOMObject._retn();
404 //Get the reference objects
405 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
406 (theBase->GetStudyID(), theBase->GetEntry());
407 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
408 (thePoint1->GetStudyID(), thePoint1->GetEntry());
409 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
410 (thePoint2->GetStudyID(), thePoint2->GetEntry());
412 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
413 return aGEOMObject._retn();
416 Handle(GEOM_Object) anObject =
417 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
418 if (!GetOperations()->IsDone() || anObject.IsNull())
419 return aGEOMObject._retn();
421 return GetObject(anObject);
424 //=============================================================================
426 * MakePrismTwoPnt2Ways
428 //=============================================================================
429 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
430 (GEOM::GEOM_Object_ptr theBase,
431 GEOM::GEOM_Object_ptr thePoint1,
432 GEOM::GEOM_Object_ptr thePoint2)
434 GEOM::GEOM_Object_var aGEOMObject;
436 //Set a not done flag
437 GetOperations()->SetNotDone();
439 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
440 return aGEOMObject._retn();
442 //Get the reference objects
443 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
444 (theBase->GetStudyID(), theBase->GetEntry());
445 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
446 (thePoint1->GetStudyID(), thePoint1->GetEntry());
447 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
448 (thePoint2->GetStudyID(), thePoint2->GetEntry());
450 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
451 return aGEOMObject._retn();
454 Handle(GEOM_Object) anObject =
455 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
456 if (!GetOperations()->IsDone() || anObject.IsNull())
457 return aGEOMObject._retn();
459 return GetObject(anObject);
462 //=============================================================================
466 //=============================================================================
467 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
468 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
470 GEOM::GEOM_Object_var aGEOMObject;
472 //Set a not done flag
473 GetOperations()->SetNotDone();
475 if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
477 //Get the reference objects
478 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
479 (theBase->GetStudyID(), theBase->GetEntry());
480 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
481 (thePath->GetStudyID(), thePath->GetEntry());
483 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
486 Handle(GEOM_Object) anObject =
487 GetOperations()->MakePipe(aBase, aPath);
488 if (!GetOperations()->IsDone() || anObject.IsNull())
489 return aGEOMObject._retn();
491 return GetObject(anObject);
494 //=============================================================================
496 * MakeRevolutionAxisAngle
498 //=============================================================================
499 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
500 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
501 CORBA::Double theAngle)
503 GEOM::GEOM_Object_var aGEOMObject;
505 //Set a not done flag
506 GetOperations()->SetNotDone();
508 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
510 //Get the reference objects
511 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
512 (theBase->GetStudyID(), theBase->GetEntry());
513 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
514 (theAxis->GetStudyID(), theAxis->GetEntry());
516 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
518 //Create the Revolution
519 Handle(GEOM_Object) anObject =
520 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
521 if (!GetOperations()->IsDone() || anObject.IsNull())
522 return aGEOMObject._retn();
524 return GetObject(anObject);
527 //=============================================================================
529 * MakeRevolutionAxisAngle2Ways
531 //=============================================================================
532 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
533 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
534 CORBA::Double theAngle)
536 GEOM::GEOM_Object_var aGEOMObject;
538 //Set a not done flag
539 GetOperations()->SetNotDone();
541 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
543 //Get the reference objects
544 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
545 (theBase->GetStudyID(), theBase->GetEntry());
546 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
547 (theAxis->GetStudyID(), theAxis->GetEntry());
549 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
551 //Create the Revolution
552 Handle(GEOM_Object) anObject =
553 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
554 if (!GetOperations()->IsDone() || anObject.IsNull())
555 return aGEOMObject._retn();
557 return GetObject(anObject);
560 //=============================================================================
564 //=============================================================================
565 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
566 CORBA::Long theMinDeg,
567 CORBA::Long theMaxDeg,
568 CORBA::Double theTol2D,
569 CORBA::Double theTol3D,
570 CORBA::Long theNbIter,
571 CORBA::Boolean theApprox)
573 GEOM::GEOM_Object_var aGEOMObject;
575 //Set a not done flag
576 GetOperations()->SetNotDone();
578 if (theShape == NULL) return aGEOMObject._retn();
580 //Get the reference objects
581 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
582 (theShape->GetStudyID(), theShape->GetEntry());
584 if (aShape.IsNull()) return aGEOMObject._retn();
587 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox);
588 if (!GetOperations()->IsDone() || anObject.IsNull())
589 return aGEOMObject._retn();
591 return GetObject(anObject);
594 //=============================================================================
598 //=============================================================================
599 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
600 CORBA::Boolean theModeSolid,
601 CORBA::Double thePreci,
602 CORBA::Boolean theRuled)
604 GEOM::GEOM_Object_var aGEOMObject;
606 //Set a not done flag
607 GetOperations()->SetNotDone();
608 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
612 aLen = theSeqSections.length();
613 for (ind = 0; ind < aLen; ind++) {
614 if (theSeqSections[ind] == NULL) continue;
615 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
616 (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
618 aSeqSections->Append(aSh);
620 if(!aSeqSections->Length())
621 return aGEOMObject._retn();
623 // Make shell or solid
624 Handle(GEOM_Object) anObject =
625 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
626 if (!GetOperations()->IsDone() || anObject.IsNull())
627 return aGEOMObject._retn();
629 return GetObject(anObject);
632 //=============================================================================
634 * MakePipeWithDifferentSections
636 //=============================================================================
637 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
638 const GEOM::ListOfGO& theLocations,
639 GEOM::GEOM_Object_ptr thePath,
640 CORBA::Boolean theWithContact,
641 CORBA::Boolean theWithCorrections)
643 GEOM::GEOM_Object_var aGEOMObject;
645 //Set a not done flag
646 GetOperations()->SetNotDone();
647 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
648 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
649 int ind=0, aNbBases =0,aNbLocs=0;
652 aNbBases = theBases.length();
653 aNbLocs = theLocations.length();
655 if( aNbLocs && aNbBases != aNbLocs)
656 return aGEOMObject._retn();
658 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
659 (thePath->GetStudyID(), thePath->GetEntry());
661 return aGEOMObject._retn();
663 for (ind = 0; ind < aNbBases; ind++) {
664 if (theBases[ind] == NULL) continue;
665 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(),
666 theBases[ind]->GetEntry());
671 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
672 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
675 aSeqLocations->Append(aLoc);
677 aSeqBases->Append(aBase);
679 if(!aSeqBases->Length())
680 return aGEOMObject._retn();
683 Handle(GEOM_Object) anObject =
684 GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
685 theWithContact,theWithCorrections);
686 if (!GetOperations()->IsDone() || anObject.IsNull())
687 return aGEOMObject._retn();
689 return GetObject(anObject);
693 //=============================================================================
695 * MakePipeWithShellSections
697 //=============================================================================
698 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
699 (const GEOM::ListOfGO& theBases,
700 const GEOM::ListOfGO& theSubBases,
701 const GEOM::ListOfGO& theLocations,
702 GEOM::GEOM_Object_ptr thePath,
703 CORBA::Boolean theWithContact,
704 CORBA::Boolean theWithCorrections)
706 GEOM::GEOM_Object_var aGEOMObject;
708 //Set a not done flag
709 GetOperations()->SetNotDone();
710 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
711 Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
712 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
713 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
716 aNbBases = theBases.length();
717 aNbSubBases = theSubBases.length();
718 aNbLocs = theLocations.length();
720 if( aNbLocs && aNbBases != aNbLocs)
721 return aGEOMObject._retn();
723 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
724 (thePath->GetStudyID(), thePath->GetEntry());
726 return aGEOMObject._retn();
728 for (ind = 0; ind < aNbBases; ind++) {
729 if (theBases[ind] == NULL) continue;
730 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
731 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
735 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
736 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
739 aSeqLocations->Append(aLoc);
741 aSeqBases->Append(aBase);
743 if(aNbSubBases>=aNbBases) {
744 Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
745 GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
746 if(aSubBase.IsNull()) {
747 aSeqSubBases->Clear();
751 aSeqSubBases->Append(aSubBase);
755 if(!aSeqBases->Length())
756 return aGEOMObject._retn();
759 Handle(GEOM_Object) anObject =
760 GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
761 aSeqLocations, aPath,
762 theWithContact, theWithCorrections);
763 if (!GetOperations()->IsDone() || anObject.IsNull())
764 return aGEOMObject._retn();
766 return GetObject(anObject);
770 //=============================================================================
772 * MakePipeShellsWithoutPath
774 //=============================================================================
775 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
776 (const GEOM::ListOfGO& theBases,
777 const GEOM::ListOfGO& theLocations)
779 GEOM::GEOM_Object_var aGEOMObject;
781 //Set a not done flag
782 GetOperations()->SetNotDone();
783 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
784 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
785 int ind=0, aNbBases=0, aNbLocs=0;
788 aNbBases = theBases.length();
789 aNbLocs = theLocations.length();
791 if( aNbLocs && aNbBases != aNbLocs)
792 return aGEOMObject._retn();
794 for (ind = 0; ind < aNbBases; ind++) {
795 if (theBases[ind] == NULL) continue;
796 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
797 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
801 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
802 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
805 aSeqLocations->Append(aLoc);
807 aSeqBases->Append(aBase);
810 if(!aSeqBases->Length())
811 return aGEOMObject._retn();
814 Handle(GEOM_Object) anObject =
815 GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
817 if (!GetOperations()->IsDone() || anObject.IsNull())
818 return aGEOMObject._retn();
820 return GetObject(anObject);