1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include <Standard_Stream.hxx>
24 #include "GEOM_I3DPrimOperations_i.hh"
26 #include "utilities.h"
28 #include "Utils_ExceptHandlers.hxx"
30 #include "GEOM_Engine.hxx"
31 #include "GEOM_Object.hxx"
33 //=============================================================================
37 //=============================================================================
38 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
39 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
41 MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
44 //=============================================================================
48 //=============================================================================
49 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
51 MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
55 //=============================================================================
59 //=============================================================================
60 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
64 GEOM::GEOM_Object_var aGEOMObject;
67 GetOperations()->SetNotDone();
70 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
71 if (!GetOperations()->IsDone() || anObject.IsNull())
72 return aGEOMObject._retn();
74 return GetObject(anObject);
77 //=============================================================================
81 //=============================================================================
82 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
83 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
85 GEOM::GEOM_Object_var aGEOMObject;
88 GetOperations()->SetNotDone();
90 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
92 //Get the reference points
93 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
94 (thePnt1->GetStudyID(), thePnt1->GetEntry());
95 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
96 (thePnt2->GetStudyID(), thePnt2->GetEntry());
98 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
101 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
102 if (!GetOperations()->IsDone() || anObject.IsNull())
103 return aGEOMObject._retn();
105 return GetObject(anObject);
108 //=============================================================================
112 //=============================================================================
113 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
115 CORBA::Short theOrientation)
117 GEOM::GEOM_Object_var aGEOMObject;
119 //Set a not done flag
120 GetOperations()->SetNotDone();
122 if (theH == 0 || theW == 0)
123 return aGEOMObject._retn();
126 Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
127 if (!GetOperations()->IsDone() || anObject.IsNull())
128 return aGEOMObject._retn();
130 return GetObject(anObject);
133 //=============================================================================
137 //=============================================================================
138 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
139 (GEOM::GEOM_Object_ptr theObj,
143 GEOM::GEOM_Object_var aGEOMObject;
145 //Set a not done flag
146 GetOperations()->SetNotDone();
148 if (theObj == NULL || theH == 0 || theW == 0)
149 return aGEOMObject._retn();
151 //Get the reference points
152 Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject
153 (theObj->GetStudyID(), theObj->GetEntry());
156 return aGEOMObject._retn();
159 Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
160 if (!GetOperations()->IsDone() || anObject.IsNull())
161 return aGEOMObject._retn();
163 return GetObject(anObject);
166 //=============================================================================
170 //=============================================================================
171 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
172 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
175 GEOM::GEOM_Object_var aGEOMObject;
177 //Set a not done flag
178 GetOperations()->SetNotDone();
180 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
182 //Get the reference points
183 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
184 (thePnt->GetStudyID(), thePnt->GetEntry());
185 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
186 (theVec->GetStudyID(), theVec->GetEntry());
188 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
191 Handle(GEOM_Object) anObject =
192 GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
193 if (!GetOperations()->IsDone() || anObject.IsNull())
194 return aGEOMObject._retn();
196 return GetObject(anObject);
199 //=============================================================================
203 //=============================================================================
204 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
205 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
206 GEOM::GEOM_Object_ptr thePnt3)
208 GEOM::GEOM_Object_var aGEOMObject;
210 //Set a not done flag
211 GetOperations()->SetNotDone();
213 if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
215 //Get the reference points
216 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
217 (thePnt1->GetStudyID(), thePnt1->GetEntry());
218 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
219 (thePnt2->GetStudyID(), thePnt2->GetEntry());
220 Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
221 (thePnt3->GetStudyID(), thePnt3->GetEntry());
223 if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
226 Handle(GEOM_Object) anObject =
227 GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
228 if (!GetOperations()->IsDone() || anObject.IsNull())
229 return aGEOMObject._retn();
231 return GetObject(anObject);
234 //=============================================================================
238 //=============================================================================
239 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
240 CORBA::Short theOrientation)
242 GEOM::GEOM_Object_var aGEOMObject;
244 //Set a not done flag
245 GetOperations()->SetNotDone();
248 return aGEOMObject._retn();
251 Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
252 if (!GetOperations()->IsDone() || anObject.IsNull())
253 return aGEOMObject._retn();
255 return GetObject(anObject);
258 //=============================================================================
262 //=============================================================================
263 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
266 GEOM::GEOM_Object_var aGEOMObject;
268 //Set a not done flag
269 GetOperations()->SetNotDone();
271 //Create the Cylinder
272 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
273 if (!GetOperations()->IsDone() || anObject.IsNull())
274 return aGEOMObject._retn();
276 return GetObject(anObject);
279 //=============================================================================
281 * MakeCylinderPntVecRH
283 //=============================================================================
284 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
285 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
286 CORBA::Double theR, CORBA::Double theH)
288 GEOM::GEOM_Object_var aGEOMObject;
290 //Set a not done flag
291 GetOperations()->SetNotDone();
293 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
295 //Get the reference points
296 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
297 (thePnt->GetStudyID(), thePnt->GetEntry());
298 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
299 (theVec->GetStudyID(), theVec->GetEntry());
301 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
303 //Create the Cylinder
304 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
305 if (!GetOperations()->IsDone() || anObject.IsNull())
306 return aGEOMObject._retn();
308 return GetObject(anObject);
311 //=============================================================================
315 //=============================================================================
316 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
320 GEOM::GEOM_Object_var aGEOMObject;
322 //Set a not done flag
323 GetOperations()->SetNotDone();
326 Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
327 if (!GetOperations()->IsDone() || anObject.IsNull())
328 return aGEOMObject._retn();
330 return GetObject(anObject);
333 //=============================================================================
335 * MakeConePntVecR1R2H
337 //=============================================================================
338 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
339 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
340 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
342 GEOM::GEOM_Object_var aGEOMObject;
344 //Set a not done flag
345 GetOperations()->SetNotDone();
347 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
349 //Get the reference points
350 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
351 (thePnt->GetStudyID(), thePnt->GetEntry());
352 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
353 (theVec->GetStudyID(), theVec->GetEntry());
355 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
358 Handle(GEOM_Object) anObject =
359 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
360 if (!GetOperations()->IsDone() || anObject.IsNull())
361 return aGEOMObject._retn();
363 return GetObject(anObject);
366 //=============================================================================
370 //=============================================================================
371 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
373 GEOM::GEOM_Object_var aGEOMObject;
375 //Set a not done flag
376 GetOperations()->SetNotDone();
379 Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
380 if (!GetOperations()->IsDone() || anObject.IsNull())
381 return aGEOMObject._retn();
383 return GetObject(anObject);
386 //=============================================================================
390 //=============================================================================
391 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
392 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
394 GEOM::GEOM_Object_var aGEOMObject;
396 //Set a not done flag
397 GetOperations()->SetNotDone();
399 if (thePnt == NULL) return aGEOMObject._retn();
401 //Get the reference point
402 CORBA::String_var entry=thePnt->GetEntry();
403 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
404 (thePnt->GetStudyID(), entry);
406 if (aPnt.IsNull()) return aGEOMObject._retn();
409 Handle(GEOM_Object) anObject =
410 GetOperations()->MakeSpherePntR(aPnt, theR);
411 if (!GetOperations()->IsDone() || anObject.IsNull())
412 return aGEOMObject._retn();
414 return GetObject(anObject);
417 //=============================================================================
421 //=============================================================================
422 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
423 (CORBA::Double theRMajor, CORBA::Double theRMinor)
425 GEOM::GEOM_Object_var aGEOMObject;
427 //Set a not done flag
428 GetOperations()->SetNotDone();
431 Handle(GEOM_Object) anObject =
432 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
433 if (!GetOperations()->IsDone() || anObject.IsNull())
434 return aGEOMObject._retn();
436 return GetObject(anObject);
439 //=============================================================================
443 //=============================================================================
444 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
445 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
446 CORBA::Double theRMajor, CORBA::Double theRMinor)
448 GEOM::GEOM_Object_var aGEOMObject;
450 //Set a not done flag
451 GetOperations()->SetNotDone();
453 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
455 //Get the reference points
456 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
457 (thePnt->GetStudyID(), thePnt->GetEntry());
458 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
459 (theVec->GetStudyID(), theVec->GetEntry());
461 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
464 Handle(GEOM_Object) anObject =
465 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
466 if (!GetOperations()->IsDone() || anObject.IsNull())
467 return aGEOMObject._retn();
469 return GetObject(anObject);
472 //=============================================================================
476 //=============================================================================
477 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
478 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
481 GEOM::GEOM_Object_var aGEOMObject;
483 //Set a not done flag
484 GetOperations()->SetNotDone();
486 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
488 //Get the reference objects
489 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
490 (theBase->GetStudyID(), theBase->GetEntry());
491 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
492 (theVec->GetStudyID(), theVec->GetEntry());
494 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
497 Handle(GEOM_Object) anObject =
498 GetOperations()->MakePrismVecH(aBase, aVec, theH);
499 if (!GetOperations()->IsDone() || anObject.IsNull())
500 return aGEOMObject._retn();
502 return GetObject(anObject);
505 //=============================================================================
509 //=============================================================================
510 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
511 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
514 GEOM::GEOM_Object_var aGEOMObject;
516 //Set a not done flag
517 GetOperations()->SetNotDone();
519 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
521 //Get the reference objects
522 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
523 (theBase->GetStudyID(), theBase->GetEntry());
524 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
525 (theVec->GetStudyID(), theVec->GetEntry());
527 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
530 Handle(GEOM_Object) anObject =
531 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
532 if (!GetOperations()->IsDone() || anObject.IsNull())
533 return aGEOMObject._retn();
535 return GetObject(anObject);
538 //=============================================================================
542 //=============================================================================
543 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
544 (GEOM::GEOM_Object_ptr theBase,
545 GEOM::GEOM_Object_ptr thePoint1,
546 GEOM::GEOM_Object_ptr thePoint2)
548 GEOM::GEOM_Object_var aGEOMObject;
550 //Set a not done flag
551 GetOperations()->SetNotDone();
553 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
554 return aGEOMObject._retn();
556 //Get the reference objects
557 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
558 (theBase->GetStudyID(), theBase->GetEntry());
559 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
560 (thePoint1->GetStudyID(), thePoint1->GetEntry());
561 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
562 (thePoint2->GetStudyID(), thePoint2->GetEntry());
564 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
565 return aGEOMObject._retn();
568 Handle(GEOM_Object) anObject =
569 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
570 if (!GetOperations()->IsDone() || anObject.IsNull())
571 return aGEOMObject._retn();
573 return GetObject(anObject);
576 //=============================================================================
578 * MakePrismTwoPnt2Ways
580 //=============================================================================
581 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
582 (GEOM::GEOM_Object_ptr theBase,
583 GEOM::GEOM_Object_ptr thePoint1,
584 GEOM::GEOM_Object_ptr thePoint2)
586 GEOM::GEOM_Object_var aGEOMObject;
588 //Set a not done flag
589 GetOperations()->SetNotDone();
591 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
592 return aGEOMObject._retn();
594 //Get the reference objects
595 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
596 (theBase->GetStudyID(), theBase->GetEntry());
597 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
598 (thePoint1->GetStudyID(), thePoint1->GetEntry());
599 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
600 (thePoint2->GetStudyID(), thePoint2->GetEntry());
602 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
603 return aGEOMObject._retn();
606 Handle(GEOM_Object) anObject =
607 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
608 if (!GetOperations()->IsDone() || anObject.IsNull())
609 return aGEOMObject._retn();
611 return GetObject(anObject);
614 //=============================================================================
618 //=============================================================================
619 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
620 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
621 CORBA::Double theDY, CORBA::Double theDZ)
623 GEOM::GEOM_Object_var aGEOMObject;
625 //Set a not done flag
626 GetOperations()->SetNotDone();
628 if (theBase == NULL) return aGEOMObject._retn();
630 //Get the reference objects
631 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
632 (theBase->GetStudyID(), theBase->GetEntry());
634 if (aBase.IsNull()) return aGEOMObject._retn();
637 Handle(GEOM_Object) anObject =
638 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
639 if (!GetOperations()->IsDone() || anObject.IsNull())
640 return aGEOMObject._retn();
642 return GetObject(anObject);
645 //=============================================================================
647 * MakePrismDXDYDZ2Ways
649 //=============================================================================
650 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
651 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
652 CORBA::Double theDY, CORBA::Double theDZ)
654 GEOM::GEOM_Object_var aGEOMObject;
656 //Set a not done flag
657 GetOperations()->SetNotDone();
659 if (theBase == NULL) return aGEOMObject._retn();
661 //Get the reference objects
662 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
663 (theBase->GetStudyID(), theBase->GetEntry());
665 if (aBase.IsNull()) return aGEOMObject._retn();
668 Handle(GEOM_Object) anObject =
669 GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
670 if (!GetOperations()->IsDone() || anObject.IsNull())
671 return aGEOMObject._retn();
673 return GetObject(anObject);
676 //=============================================================================
680 //=============================================================================
681 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
682 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
684 GEOM::GEOM_Object_var aGEOMObject;
686 //Set a not done flag
687 GetOperations()->SetNotDone();
689 if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
691 //Get the reference objects
692 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
693 (theBase->GetStudyID(), theBase->GetEntry());
694 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
695 (thePath->GetStudyID(), thePath->GetEntry());
697 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
700 Handle(GEOM_Object) anObject =
701 GetOperations()->MakePipe(aBase, aPath);
702 if (!GetOperations()->IsDone() || anObject.IsNull())
703 return aGEOMObject._retn();
705 return GetObject(anObject);
708 //=============================================================================
710 * MakeRevolutionAxisAngle
712 //=============================================================================
713 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
714 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
715 CORBA::Double theAngle)
717 GEOM::GEOM_Object_var aGEOMObject;
719 //Set a not done flag
720 GetOperations()->SetNotDone();
722 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
724 //Get the reference objects
725 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
726 (theBase->GetStudyID(), theBase->GetEntry());
727 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
728 (theAxis->GetStudyID(), theAxis->GetEntry());
730 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
732 //Create the Revolution
733 Handle(GEOM_Object) anObject =
734 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
735 if (!GetOperations()->IsDone() || anObject.IsNull())
736 return aGEOMObject._retn();
738 return GetObject(anObject);
741 //=============================================================================
743 * MakeRevolutionAxisAngle2Ways
745 //=============================================================================
746 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
747 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
748 CORBA::Double theAngle)
750 GEOM::GEOM_Object_var aGEOMObject;
752 //Set a not done flag
753 GetOperations()->SetNotDone();
755 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
757 //Get the reference objects
758 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
759 (theBase->GetStudyID(), theBase->GetEntry());
760 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
761 (theAxis->GetStudyID(), theAxis->GetEntry());
763 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
765 //Create the Revolution
766 Handle(GEOM_Object) anObject =
767 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
768 if (!GetOperations()->IsDone() || anObject.IsNull())
769 return aGEOMObject._retn();
771 return GetObject(anObject);
774 //=============================================================================
778 //=============================================================================
779 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
780 CORBA::Long theMinDeg,
781 CORBA::Long theMaxDeg,
782 CORBA::Double theTol2D,
783 CORBA::Double theTol3D,
784 CORBA::Long theNbIter,
785 CORBA::Boolean theApprox)
787 GEOM::GEOM_Object_var aGEOMObject;
789 //Set a not done flag
790 GetOperations()->SetNotDone();
792 if (theShape == NULL) return aGEOMObject._retn();
794 //Get the reference objects
795 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
796 (theShape->GetStudyID(), theShape->GetEntry());
798 if (aShape.IsNull()) return aGEOMObject._retn();
801 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox);
802 if (!GetOperations()->IsDone() || anObject.IsNull())
803 return aGEOMObject._retn();
805 return GetObject(anObject);
808 //=============================================================================
812 //=============================================================================
813 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
814 CORBA::Boolean theModeSolid,
815 CORBA::Double thePreci,
816 CORBA::Boolean theRuled)
818 GEOM::GEOM_Object_var aGEOMObject;
820 //Set a not done flag
821 GetOperations()->SetNotDone();
822 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
826 aLen = theSeqSections.length();
827 for (ind = 0; ind < aLen; ind++) {
828 if (theSeqSections[ind] == NULL) continue;
829 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
830 (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
832 aSeqSections->Append(aSh);
834 if(!aSeqSections->Length())
835 return aGEOMObject._retn();
837 // Make shell or solid
838 Handle(GEOM_Object) anObject =
839 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
840 if (!GetOperations()->IsDone() || anObject.IsNull())
841 return aGEOMObject._retn();
843 return GetObject(anObject);
846 //=============================================================================
848 * MakePipeWithDifferentSections
850 //=============================================================================
851 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
852 const GEOM::ListOfGO& theLocations,
853 GEOM::GEOM_Object_ptr thePath,
854 CORBA::Boolean theWithContact,
855 CORBA::Boolean theWithCorrections)
857 GEOM::GEOM_Object_var aGEOMObject;
859 //Set a not done flag
860 GetOperations()->SetNotDone();
861 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
862 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
863 int ind=0, aNbBases =0,aNbLocs=0;
866 aNbBases = theBases.length();
867 aNbLocs = theLocations.length();
869 if( aNbLocs && aNbBases != aNbLocs)
870 return aGEOMObject._retn();
872 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
873 (thePath->GetStudyID(), thePath->GetEntry());
875 return aGEOMObject._retn();
877 for (ind = 0; ind < aNbBases; ind++) {
878 if (theBases[ind] == NULL) continue;
879 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(),
880 theBases[ind]->GetEntry());
885 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
886 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
889 aSeqLocations->Append(aLoc);
891 aSeqBases->Append(aBase);
893 if(!aSeqBases->Length())
894 return aGEOMObject._retn();
897 Handle(GEOM_Object) anObject =
898 GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
899 theWithContact,theWithCorrections);
900 if (!GetOperations()->IsDone() || anObject.IsNull())
901 return aGEOMObject._retn();
903 return GetObject(anObject);
907 //=============================================================================
909 * MakePipeWithShellSections
911 //=============================================================================
912 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
913 (const GEOM::ListOfGO& theBases,
914 const GEOM::ListOfGO& theSubBases,
915 const GEOM::ListOfGO& theLocations,
916 GEOM::GEOM_Object_ptr thePath,
917 CORBA::Boolean theWithContact,
918 CORBA::Boolean theWithCorrections)
920 GEOM::GEOM_Object_var aGEOMObject;
922 //Set a not done flag
923 GetOperations()->SetNotDone();
924 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
925 Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
926 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
927 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
930 aNbBases = theBases.length();
931 aNbSubBases = theSubBases.length();
932 aNbLocs = theLocations.length();
934 if( aNbLocs && aNbBases != aNbLocs)
935 return aGEOMObject._retn();
937 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
938 (thePath->GetStudyID(), thePath->GetEntry());
940 return aGEOMObject._retn();
942 for (ind = 0; ind < aNbBases; ind++) {
943 if (theBases[ind] == NULL) continue;
944 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
945 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
949 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
950 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
953 aSeqLocations->Append(aLoc);
955 aSeqBases->Append(aBase);
957 if(aNbSubBases>=aNbBases) {
958 Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
959 GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
960 if(aSubBase.IsNull()) {
961 aSeqSubBases->Clear();
965 aSeqSubBases->Append(aSubBase);
969 if(!aSeqBases->Length())
970 return aGEOMObject._retn();
973 Handle(GEOM_Object) anObject =
974 GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
975 aSeqLocations, aPath,
976 theWithContact, theWithCorrections);
977 if (!GetOperations()->IsDone() || anObject.IsNull())
978 return aGEOMObject._retn();
980 return GetObject(anObject);
984 //=============================================================================
986 * MakePipeShellsWithoutPath
988 //=============================================================================
989 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
990 (const GEOM::ListOfGO& theBases,
991 const GEOM::ListOfGO& theLocations)
993 GEOM::GEOM_Object_var aGEOMObject;
995 //Set a not done flag
996 GetOperations()->SetNotDone();
997 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
998 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
999 int ind=0, aNbBases=0, aNbLocs=0;
1002 aNbBases = theBases.length();
1003 aNbLocs = theLocations.length();
1005 if( aNbLocs && aNbBases != aNbLocs)
1006 return aGEOMObject._retn();
1008 for (ind = 0; ind < aNbBases; ind++) {
1009 if (theBases[ind] == NULL) continue;
1010 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
1011 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
1015 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
1016 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
1019 aSeqLocations->Append(aLoc);
1021 aSeqBases->Append(aBase);
1024 if(!aSeqBases->Length())
1025 return aGEOMObject._retn();
1028 Handle(GEOM_Object) anObject =
1029 GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1031 if (!GetOperations()->IsDone() || anObject.IsNull())
1032 return aGEOMObject._retn();
1034 return GetObject(anObject);
1038 //=============================================================================
1040 * MakePipeBiNormalAlongVector
1042 //=============================================================================
1043 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1044 (GEOM::GEOM_Object_ptr theBase,
1045 GEOM::GEOM_Object_ptr thePath,
1046 GEOM::GEOM_Object_ptr theVec)
1048 GEOM::GEOM_Object_var aGEOMObject;
1050 //Set a not done flag
1051 GetOperations()->SetNotDone();
1053 if (theBase == NULL || thePath == NULL || theVec == NULL) return aGEOMObject._retn();
1055 //Get the reference objects
1056 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
1057 (theBase->GetStudyID(), theBase->GetEntry());
1058 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
1059 (thePath->GetStudyID(), thePath->GetEntry());
1060 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
1061 (theVec->GetStudyID(), theVec->GetEntry());
1063 if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
1066 Handle(GEOM_Object) anObject =
1067 GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
1068 if (!GetOperations()->IsDone() || anObject.IsNull())
1069 return aGEOMObject._retn();
1071 return GetObject(anObject);