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::MakeFaceHW (CORBA::Double theH,
113 CORBA::Short theOrientation)
115 GEOM::GEOM_Object_var aGEOMObject;
117 //Set a not done flag
118 GetOperations()->SetNotDone();
120 if (theH == 0 || theW == 0)
121 return aGEOMObject._retn();
124 Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
125 if (!GetOperations()->IsDone() || anObject.IsNull())
126 return aGEOMObject._retn();
128 return GetObject(anObject);
131 //=============================================================================
135 //=============================================================================
136 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
137 (GEOM::GEOM_Object_ptr theObj,
141 GEOM::GEOM_Object_var aGEOMObject;
143 //Set a not done flag
144 GetOperations()->SetNotDone();
146 if (theObj == NULL || theH == 0 || theW == 0)
147 return aGEOMObject._retn();
149 //Get the reference points
150 Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject
151 (theObj->GetStudyID(), theObj->GetEntry());
154 return aGEOMObject._retn();
157 Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
158 if (!GetOperations()->IsDone() || anObject.IsNull())
159 return aGEOMObject._retn();
161 return GetObject(anObject);
164 //=============================================================================
168 //=============================================================================
169 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
170 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
173 GEOM::GEOM_Object_var aGEOMObject;
175 //Set a not done flag
176 GetOperations()->SetNotDone();
178 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
180 //Get the reference points
181 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
182 (thePnt->GetStudyID(), thePnt->GetEntry());
183 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
184 (theVec->GetStudyID(), theVec->GetEntry());
186 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
189 Handle(GEOM_Object) anObject =
190 GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
191 if (!GetOperations()->IsDone() || anObject.IsNull())
192 return aGEOMObject._retn();
194 return GetObject(anObject);
197 //=============================================================================
201 //=============================================================================
202 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
203 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
204 GEOM::GEOM_Object_ptr thePnt3)
206 GEOM::GEOM_Object_var aGEOMObject;
208 //Set a not done flag
209 GetOperations()->SetNotDone();
211 if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
213 //Get the reference points
214 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
215 (thePnt1->GetStudyID(), thePnt1->GetEntry());
216 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
217 (thePnt2->GetStudyID(), thePnt2->GetEntry());
218 Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
219 (thePnt3->GetStudyID(), thePnt3->GetEntry());
221 if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
224 Handle(GEOM_Object) anObject =
225 GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
226 if (!GetOperations()->IsDone() || anObject.IsNull())
227 return aGEOMObject._retn();
229 return GetObject(anObject);
232 //=============================================================================
236 //=============================================================================
237 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
238 CORBA::Short theOrientation)
240 GEOM::GEOM_Object_var aGEOMObject;
242 //Set a not done flag
243 GetOperations()->SetNotDone();
246 return aGEOMObject._retn();
249 Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
250 if (!GetOperations()->IsDone() || anObject.IsNull())
251 return aGEOMObject._retn();
253 return GetObject(anObject);
256 //=============================================================================
260 //=============================================================================
261 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
264 GEOM::GEOM_Object_var aGEOMObject;
266 //Set a not done flag
267 GetOperations()->SetNotDone();
269 //Create the Cylinder
270 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
271 if (!GetOperations()->IsDone() || anObject.IsNull())
272 return aGEOMObject._retn();
274 return GetObject(anObject);
277 //=============================================================================
279 * MakeCylinderPntVecRH
281 //=============================================================================
282 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
283 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
284 CORBA::Double theR, CORBA::Double theH)
286 GEOM::GEOM_Object_var aGEOMObject;
288 //Set a not done flag
289 GetOperations()->SetNotDone();
291 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
293 //Get the reference points
294 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
295 (thePnt->GetStudyID(), thePnt->GetEntry());
296 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
297 (theVec->GetStudyID(), theVec->GetEntry());
299 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
301 //Create the Cylinder
302 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
303 if (!GetOperations()->IsDone() || anObject.IsNull())
304 return aGEOMObject._retn();
306 return GetObject(anObject);
309 //=============================================================================
313 //=============================================================================
314 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
318 GEOM::GEOM_Object_var aGEOMObject;
320 //Set a not done flag
321 GetOperations()->SetNotDone();
324 Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
325 if (!GetOperations()->IsDone() || anObject.IsNull())
326 return aGEOMObject._retn();
328 return GetObject(anObject);
331 //=============================================================================
333 * MakeConePntVecR1R2H
335 //=============================================================================
336 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
337 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
338 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
340 GEOM::GEOM_Object_var aGEOMObject;
342 //Set a not done flag
343 GetOperations()->SetNotDone();
345 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
347 //Get the reference points
348 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
349 (thePnt->GetStudyID(), thePnt->GetEntry());
350 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
351 (theVec->GetStudyID(), theVec->GetEntry());
353 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
356 Handle(GEOM_Object) anObject =
357 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
358 if (!GetOperations()->IsDone() || anObject.IsNull())
359 return aGEOMObject._retn();
361 return GetObject(anObject);
364 //=============================================================================
368 //=============================================================================
369 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
371 GEOM::GEOM_Object_var aGEOMObject;
373 //Set a not done flag
374 GetOperations()->SetNotDone();
377 Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
378 if (!GetOperations()->IsDone() || anObject.IsNull())
379 return aGEOMObject._retn();
381 return GetObject(anObject);
384 //=============================================================================
388 //=============================================================================
389 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
390 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
392 GEOM::GEOM_Object_var aGEOMObject;
394 //Set a not done flag
395 GetOperations()->SetNotDone();
397 if (thePnt == NULL) return aGEOMObject._retn();
399 //Get the reference point
400 CORBA::String_var entry=thePnt->GetEntry();
401 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
402 (thePnt->GetStudyID(), entry);
404 if (aPnt.IsNull()) return aGEOMObject._retn();
407 Handle(GEOM_Object) anObject =
408 GetOperations()->MakeSpherePntR(aPnt, theR);
409 if (!GetOperations()->IsDone() || anObject.IsNull())
410 return aGEOMObject._retn();
412 return GetObject(anObject);
415 //=============================================================================
419 //=============================================================================
420 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
421 (CORBA::Double theRMajor, CORBA::Double theRMinor)
423 GEOM::GEOM_Object_var aGEOMObject;
425 //Set a not done flag
426 GetOperations()->SetNotDone();
429 Handle(GEOM_Object) anObject =
430 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
431 if (!GetOperations()->IsDone() || anObject.IsNull())
432 return aGEOMObject._retn();
434 return GetObject(anObject);
437 //=============================================================================
441 //=============================================================================
442 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
443 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
444 CORBA::Double theRMajor, CORBA::Double theRMinor)
446 GEOM::GEOM_Object_var aGEOMObject;
448 //Set a not done flag
449 GetOperations()->SetNotDone();
451 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
453 //Get the reference points
454 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
455 (thePnt->GetStudyID(), thePnt->GetEntry());
456 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
457 (theVec->GetStudyID(), theVec->GetEntry());
459 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
462 Handle(GEOM_Object) anObject =
463 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
464 if (!GetOperations()->IsDone() || anObject.IsNull())
465 return aGEOMObject._retn();
467 return GetObject(anObject);
470 //=============================================================================
474 //=============================================================================
475 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
476 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
479 GEOM::GEOM_Object_var aGEOMObject;
481 //Set a not done flag
482 GetOperations()->SetNotDone();
484 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
486 //Get the reference objects
487 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
488 (theBase->GetStudyID(), theBase->GetEntry());
489 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
490 (theVec->GetStudyID(), theVec->GetEntry());
492 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
495 Handle(GEOM_Object) anObject =
496 GetOperations()->MakePrismVecH(aBase, aVec, theH);
497 if (!GetOperations()->IsDone() || anObject.IsNull())
498 return aGEOMObject._retn();
500 return GetObject(anObject);
503 //=============================================================================
507 //=============================================================================
508 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
509 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
512 GEOM::GEOM_Object_var aGEOMObject;
514 //Set a not done flag
515 GetOperations()->SetNotDone();
517 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
519 //Get the reference objects
520 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
521 (theBase->GetStudyID(), theBase->GetEntry());
522 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
523 (theVec->GetStudyID(), theVec->GetEntry());
525 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
528 Handle(GEOM_Object) anObject =
529 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
530 if (!GetOperations()->IsDone() || anObject.IsNull())
531 return aGEOMObject._retn();
533 return GetObject(anObject);
536 //=============================================================================
540 //=============================================================================
541 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
542 (GEOM::GEOM_Object_ptr theBase,
543 GEOM::GEOM_Object_ptr thePoint1,
544 GEOM::GEOM_Object_ptr thePoint2)
546 GEOM::GEOM_Object_var aGEOMObject;
548 //Set a not done flag
549 GetOperations()->SetNotDone();
551 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
552 return aGEOMObject._retn();
554 //Get the reference objects
555 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
556 (theBase->GetStudyID(), theBase->GetEntry());
557 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
558 (thePoint1->GetStudyID(), thePoint1->GetEntry());
559 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
560 (thePoint2->GetStudyID(), thePoint2->GetEntry());
562 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
563 return aGEOMObject._retn();
566 Handle(GEOM_Object) anObject =
567 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
568 if (!GetOperations()->IsDone() || anObject.IsNull())
569 return aGEOMObject._retn();
571 return GetObject(anObject);
574 //=============================================================================
576 * MakePrismTwoPnt2Ways
578 //=============================================================================
579 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
580 (GEOM::GEOM_Object_ptr theBase,
581 GEOM::GEOM_Object_ptr thePoint1,
582 GEOM::GEOM_Object_ptr thePoint2)
584 GEOM::GEOM_Object_var aGEOMObject;
586 //Set a not done flag
587 GetOperations()->SetNotDone();
589 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
590 return aGEOMObject._retn();
592 //Get the reference objects
593 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
594 (theBase->GetStudyID(), theBase->GetEntry());
595 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
596 (thePoint1->GetStudyID(), thePoint1->GetEntry());
597 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
598 (thePoint2->GetStudyID(), thePoint2->GetEntry());
600 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
601 return aGEOMObject._retn();
604 Handle(GEOM_Object) anObject =
605 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
606 if (!GetOperations()->IsDone() || anObject.IsNull())
607 return aGEOMObject._retn();
609 return GetObject(anObject);
612 //=============================================================================
616 //=============================================================================
617 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
618 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
619 CORBA::Double theDY, CORBA::Double theDZ)
621 GEOM::GEOM_Object_var aGEOMObject;
623 //Set a not done flag
624 GetOperations()->SetNotDone();
626 if (theBase == NULL) return aGEOMObject._retn();
628 //Get the reference objects
629 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
630 (theBase->GetStudyID(), theBase->GetEntry());
632 if (aBase.IsNull()) return aGEOMObject._retn();
635 Handle(GEOM_Object) anObject =
636 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
637 if (!GetOperations()->IsDone() || anObject.IsNull())
638 return aGEOMObject._retn();
640 return GetObject(anObject);
643 //=============================================================================
645 * MakePrismDXDYDZ2Ways
647 //=============================================================================
648 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
649 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
650 CORBA::Double theDY, CORBA::Double theDZ)
652 GEOM::GEOM_Object_var aGEOMObject;
654 //Set a not done flag
655 GetOperations()->SetNotDone();
657 if (theBase == NULL) return aGEOMObject._retn();
659 //Get the reference objects
660 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
661 (theBase->GetStudyID(), theBase->GetEntry());
663 if (aBase.IsNull()) return aGEOMObject._retn();
666 Handle(GEOM_Object) anObject =
667 GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
668 if (!GetOperations()->IsDone() || anObject.IsNull())
669 return aGEOMObject._retn();
671 return GetObject(anObject);
674 //=============================================================================
678 //=============================================================================
679 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
680 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
682 GEOM::GEOM_Object_var aGEOMObject;
684 //Set a not done flag
685 GetOperations()->SetNotDone();
687 if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
689 //Get the reference objects
690 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
691 (theBase->GetStudyID(), theBase->GetEntry());
692 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
693 (thePath->GetStudyID(), thePath->GetEntry());
695 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
698 Handle(GEOM_Object) anObject =
699 GetOperations()->MakePipe(aBase, aPath);
700 if (!GetOperations()->IsDone() || anObject.IsNull())
701 return aGEOMObject._retn();
703 return GetObject(anObject);
706 //=============================================================================
708 * MakeRevolutionAxisAngle
710 //=============================================================================
711 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
712 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
713 CORBA::Double theAngle)
715 GEOM::GEOM_Object_var aGEOMObject;
717 //Set a not done flag
718 GetOperations()->SetNotDone();
720 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
722 //Get the reference objects
723 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
724 (theBase->GetStudyID(), theBase->GetEntry());
725 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
726 (theAxis->GetStudyID(), theAxis->GetEntry());
728 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
730 //Create the Revolution
731 Handle(GEOM_Object) anObject =
732 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
733 if (!GetOperations()->IsDone() || anObject.IsNull())
734 return aGEOMObject._retn();
736 return GetObject(anObject);
739 //=============================================================================
741 * MakeRevolutionAxisAngle2Ways
743 //=============================================================================
744 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
745 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
746 CORBA::Double theAngle)
748 GEOM::GEOM_Object_var aGEOMObject;
750 //Set a not done flag
751 GetOperations()->SetNotDone();
753 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
755 //Get the reference objects
756 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
757 (theBase->GetStudyID(), theBase->GetEntry());
758 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
759 (theAxis->GetStudyID(), theAxis->GetEntry());
761 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
763 //Create the Revolution
764 Handle(GEOM_Object) anObject =
765 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
766 if (!GetOperations()->IsDone() || anObject.IsNull())
767 return aGEOMObject._retn();
769 return GetObject(anObject);
772 //=============================================================================
776 //=============================================================================
777 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
778 CORBA::Long theMinDeg,
779 CORBA::Long theMaxDeg,
780 CORBA::Double theTol2D,
781 CORBA::Double theTol3D,
782 CORBA::Long theNbIter,
783 CORBA::Boolean theApprox)
785 GEOM::GEOM_Object_var aGEOMObject;
787 //Set a not done flag
788 GetOperations()->SetNotDone();
790 if (theShape == NULL) return aGEOMObject._retn();
792 //Get the reference objects
793 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
794 (theShape->GetStudyID(), theShape->GetEntry());
796 if (aShape.IsNull()) return aGEOMObject._retn();
799 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox);
800 if (!GetOperations()->IsDone() || anObject.IsNull())
801 return aGEOMObject._retn();
803 return GetObject(anObject);
806 //=============================================================================
810 //=============================================================================
811 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
812 CORBA::Boolean theModeSolid,
813 CORBA::Double thePreci,
814 CORBA::Boolean theRuled)
816 GEOM::GEOM_Object_var aGEOMObject;
818 //Set a not done flag
819 GetOperations()->SetNotDone();
820 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
824 aLen = theSeqSections.length();
825 for (ind = 0; ind < aLen; ind++) {
826 if (theSeqSections[ind] == NULL) continue;
827 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
828 (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
830 aSeqSections->Append(aSh);
832 if(!aSeqSections->Length())
833 return aGEOMObject._retn();
835 // Make shell or solid
836 Handle(GEOM_Object) anObject =
837 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
838 if (!GetOperations()->IsDone() || anObject.IsNull())
839 return aGEOMObject._retn();
841 return GetObject(anObject);
844 //=============================================================================
846 * MakePipeWithDifferentSections
848 //=============================================================================
849 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
850 const GEOM::ListOfGO& theLocations,
851 GEOM::GEOM_Object_ptr thePath,
852 CORBA::Boolean theWithContact,
853 CORBA::Boolean theWithCorrections)
855 GEOM::GEOM_Object_var aGEOMObject;
857 //Set a not done flag
858 GetOperations()->SetNotDone();
859 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
860 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
861 int ind=0, aNbBases =0,aNbLocs=0;
864 aNbBases = theBases.length();
865 aNbLocs = theLocations.length();
867 if( aNbLocs && aNbBases != aNbLocs)
868 return aGEOMObject._retn();
870 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
871 (thePath->GetStudyID(), thePath->GetEntry());
873 return aGEOMObject._retn();
875 for (ind = 0; ind < aNbBases; ind++) {
876 if (theBases[ind] == NULL) continue;
877 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(),
878 theBases[ind]->GetEntry());
883 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
884 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
887 aSeqLocations->Append(aLoc);
889 aSeqBases->Append(aBase);
891 if(!aSeqBases->Length())
892 return aGEOMObject._retn();
895 Handle(GEOM_Object) anObject =
896 GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
897 theWithContact,theWithCorrections);
898 if (!GetOperations()->IsDone() || anObject.IsNull())
899 return aGEOMObject._retn();
901 return GetObject(anObject);
905 //=============================================================================
907 * MakePipeWithShellSections
909 //=============================================================================
910 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
911 (const GEOM::ListOfGO& theBases,
912 const GEOM::ListOfGO& theSubBases,
913 const GEOM::ListOfGO& theLocations,
914 GEOM::GEOM_Object_ptr thePath,
915 CORBA::Boolean theWithContact,
916 CORBA::Boolean theWithCorrections)
918 GEOM::GEOM_Object_var aGEOMObject;
920 //Set a not done flag
921 GetOperations()->SetNotDone();
922 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
923 Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
924 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
925 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
928 aNbBases = theBases.length();
929 aNbSubBases = theSubBases.length();
930 aNbLocs = theLocations.length();
932 if( aNbLocs && aNbBases != aNbLocs)
933 return aGEOMObject._retn();
935 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
936 (thePath->GetStudyID(), thePath->GetEntry());
938 return aGEOMObject._retn();
940 for (ind = 0; ind < aNbBases; ind++) {
941 if (theBases[ind] == NULL) continue;
942 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
943 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
947 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
948 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
951 aSeqLocations->Append(aLoc);
953 aSeqBases->Append(aBase);
955 if(aNbSubBases>=aNbBases) {
956 Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
957 GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
958 if(aSubBase.IsNull()) {
959 aSeqSubBases->Clear();
963 aSeqSubBases->Append(aSubBase);
967 if(!aSeqBases->Length())
968 return aGEOMObject._retn();
971 Handle(GEOM_Object) anObject =
972 GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
973 aSeqLocations, aPath,
974 theWithContact, theWithCorrections);
975 if (!GetOperations()->IsDone() || anObject.IsNull())
976 return aGEOMObject._retn();
978 return GetObject(anObject);
982 //=============================================================================
984 * MakePipeShellsWithoutPath
986 //=============================================================================
987 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
988 (const GEOM::ListOfGO& theBases,
989 const GEOM::ListOfGO& theLocations)
991 GEOM::GEOM_Object_var aGEOMObject;
993 //Set a not done flag
994 GetOperations()->SetNotDone();
995 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
996 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
997 int ind=0, aNbBases=0, aNbLocs=0;
1000 aNbBases = theBases.length();
1001 aNbLocs = theLocations.length();
1003 if( aNbLocs && aNbBases != aNbLocs)
1004 return aGEOMObject._retn();
1006 for (ind = 0; ind < aNbBases; ind++) {
1007 if (theBases[ind] == NULL) continue;
1008 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
1009 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
1013 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
1014 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
1017 aSeqLocations->Append(aLoc);
1019 aSeqBases->Append(aBase);
1022 if(!aSeqBases->Length())
1023 return aGEOMObject._retn();
1026 Handle(GEOM_Object) anObject =
1027 GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1029 if (!GetOperations()->IsDone() || anObject.IsNull())
1030 return aGEOMObject._retn();
1032 return GetObject(anObject);