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();
71 GetObject(anObject)->SetParameters(GetParameters());
73 return GetObject(anObject);
76 //=============================================================================
80 //=============================================================================
81 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
82 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
84 GEOM::GEOM_Object_var aGEOMObject;
87 GetOperations()->SetNotDone();
89 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
91 //Get the reference points
92 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
93 (thePnt1->GetStudyID(), thePnt1->GetEntry());
94 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
95 (thePnt2->GetStudyID(), thePnt2->GetEntry());
97 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
100 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
101 if (!GetOperations()->IsDone() || anObject.IsNull())
102 return aGEOMObject._retn();
104 return GetObject(anObject);
107 //=============================================================================
111 //=============================================================================
112 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
114 CORBA::Short theOrientation)
116 GEOM::GEOM_Object_var aGEOMObject;
118 //Set a not done flag
119 GetOperations()->SetNotDone();
121 if (theH == 0 || theW == 0)
122 return aGEOMObject._retn();
125 Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
126 if (!GetOperations()->IsDone() || anObject.IsNull())
127 return aGEOMObject._retn();
129 return GetObject(anObject);
132 //=============================================================================
136 //=============================================================================
137 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
138 (GEOM::GEOM_Object_ptr theObj,
142 GEOM::GEOM_Object_var aGEOMObject;
144 //Set a not done flag
145 GetOperations()->SetNotDone();
147 if (theObj == NULL || theH == 0 || theW == 0)
148 return aGEOMObject._retn();
150 //Get the reference points
151 Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject
152 (theObj->GetStudyID(), theObj->GetEntry());
155 return aGEOMObject._retn();
158 Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
159 if (!GetOperations()->IsDone() || anObject.IsNull())
160 return aGEOMObject._retn();
162 return GetObject(anObject);
165 //=============================================================================
169 //=============================================================================
170 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
171 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
174 GEOM::GEOM_Object_var aGEOMObject;
176 //Set a not done flag
177 GetOperations()->SetNotDone();
179 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
181 //Get the reference points
182 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
183 (thePnt->GetStudyID(), thePnt->GetEntry());
184 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
185 (theVec->GetStudyID(), theVec->GetEntry());
187 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
190 Handle(GEOM_Object) anObject =
191 GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
192 if (!GetOperations()->IsDone() || anObject.IsNull())
193 return aGEOMObject._retn();
195 return GetObject(anObject);
198 //=============================================================================
202 //=============================================================================
203 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
204 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
205 GEOM::GEOM_Object_ptr thePnt3)
207 GEOM::GEOM_Object_var aGEOMObject;
209 //Set a not done flag
210 GetOperations()->SetNotDone();
212 if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
214 //Get the reference points
215 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
216 (thePnt1->GetStudyID(), thePnt1->GetEntry());
217 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
218 (thePnt2->GetStudyID(), thePnt2->GetEntry());
219 Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
220 (thePnt3->GetStudyID(), thePnt3->GetEntry());
222 if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
225 Handle(GEOM_Object) anObject =
226 GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
227 if (!GetOperations()->IsDone() || anObject.IsNull())
228 return aGEOMObject._retn();
230 return GetObject(anObject);
233 //=============================================================================
237 //=============================================================================
238 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
239 CORBA::Short theOrientation)
241 GEOM::GEOM_Object_var aGEOMObject;
243 //Set a not done flag
244 GetOperations()->SetNotDone();
247 return aGEOMObject._retn();
250 Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
251 if (!GetOperations()->IsDone() || anObject.IsNull())
252 return aGEOMObject._retn();
254 return GetObject(anObject);
257 //=============================================================================
261 //=============================================================================
262 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
265 GEOM::GEOM_Object_var aGEOMObject;
267 //Set a not done flag
268 GetOperations()->SetNotDone();
270 //Create the Cylinder
271 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
272 if (!GetOperations()->IsDone() || anObject.IsNull())
273 return aGEOMObject._retn();
275 return GetObject(anObject);
278 //=============================================================================
280 * MakeCylinderPntVecRH
282 //=============================================================================
283 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
284 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
285 CORBA::Double theR, CORBA::Double theH)
287 GEOM::GEOM_Object_var aGEOMObject;
289 //Set a not done flag
290 GetOperations()->SetNotDone();
292 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
294 //Get the reference points
295 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
296 (thePnt->GetStudyID(), thePnt->GetEntry());
297 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
298 (theVec->GetStudyID(), theVec->GetEntry());
300 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
302 //Create the Cylinder
303 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
304 if (!GetOperations()->IsDone() || anObject.IsNull())
305 return aGEOMObject._retn();
307 return GetObject(anObject);
310 //=============================================================================
314 //=============================================================================
315 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
319 GEOM::GEOM_Object_var aGEOMObject;
321 //Set a not done flag
322 GetOperations()->SetNotDone();
325 Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
326 if (!GetOperations()->IsDone() || anObject.IsNull())
327 return aGEOMObject._retn();
329 return GetObject(anObject);
332 //=============================================================================
334 * MakeConePntVecR1R2H
336 //=============================================================================
337 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
338 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
339 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
341 GEOM::GEOM_Object_var aGEOMObject;
343 //Set a not done flag
344 GetOperations()->SetNotDone();
346 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
348 //Get the reference points
349 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
350 (thePnt->GetStudyID(), thePnt->GetEntry());
351 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
352 (theVec->GetStudyID(), theVec->GetEntry());
354 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
357 Handle(GEOM_Object) anObject =
358 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
359 if (!GetOperations()->IsDone() || anObject.IsNull())
360 return aGEOMObject._retn();
362 return GetObject(anObject);
365 //=============================================================================
369 //=============================================================================
370 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
372 GEOM::GEOM_Object_var aGEOMObject;
374 //Set a not done flag
375 GetOperations()->SetNotDone();
378 Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
379 if (!GetOperations()->IsDone() || anObject.IsNull())
380 return aGEOMObject._retn();
382 return GetObject(anObject);
385 //=============================================================================
389 //=============================================================================
390 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
391 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
393 GEOM::GEOM_Object_var aGEOMObject;
395 //Set a not done flag
396 GetOperations()->SetNotDone();
398 if (thePnt == NULL) return aGEOMObject._retn();
400 //Get the reference point
401 CORBA::String_var entry=thePnt->GetEntry();
402 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
403 (thePnt->GetStudyID(), entry);
405 if (aPnt.IsNull()) return aGEOMObject._retn();
408 Handle(GEOM_Object) anObject =
409 GetOperations()->MakeSpherePntR(aPnt, theR);
410 if (!GetOperations()->IsDone() || anObject.IsNull())
411 return aGEOMObject._retn();
413 return GetObject(anObject);
416 //=============================================================================
420 //=============================================================================
421 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
422 (CORBA::Double theRMajor, CORBA::Double theRMinor)
424 GEOM::GEOM_Object_var aGEOMObject;
426 //Set a not done flag
427 GetOperations()->SetNotDone();
430 Handle(GEOM_Object) anObject =
431 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
432 if (!GetOperations()->IsDone() || anObject.IsNull())
433 return aGEOMObject._retn();
435 return GetObject(anObject);
438 //=============================================================================
442 //=============================================================================
443 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
444 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
445 CORBA::Double theRMajor, CORBA::Double theRMinor)
447 GEOM::GEOM_Object_var aGEOMObject;
449 //Set a not done flag
450 GetOperations()->SetNotDone();
452 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
454 //Get the reference points
455 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
456 (thePnt->GetStudyID(), thePnt->GetEntry());
457 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
458 (theVec->GetStudyID(), theVec->GetEntry());
460 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
463 Handle(GEOM_Object) anObject =
464 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
465 if (!GetOperations()->IsDone() || anObject.IsNull())
466 return aGEOMObject._retn();
468 return GetObject(anObject);
471 //=============================================================================
475 //=============================================================================
476 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
477 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
480 GEOM::GEOM_Object_var aGEOMObject;
482 //Set a not done flag
483 GetOperations()->SetNotDone();
485 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
487 //Get the reference objects
488 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
489 (theBase->GetStudyID(), theBase->GetEntry());
490 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
491 (theVec->GetStudyID(), theVec->GetEntry());
493 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
496 Handle(GEOM_Object) anObject =
497 GetOperations()->MakePrismVecH(aBase, aVec, theH);
498 if (!GetOperations()->IsDone() || anObject.IsNull())
499 return aGEOMObject._retn();
501 return GetObject(anObject);
504 //=============================================================================
508 //=============================================================================
509 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
510 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
513 GEOM::GEOM_Object_var aGEOMObject;
515 //Set a not done flag
516 GetOperations()->SetNotDone();
518 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
520 //Get the reference objects
521 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
522 (theBase->GetStudyID(), theBase->GetEntry());
523 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
524 (theVec->GetStudyID(), theVec->GetEntry());
526 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
529 Handle(GEOM_Object) anObject =
530 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
531 if (!GetOperations()->IsDone() || anObject.IsNull())
532 return aGEOMObject._retn();
534 return GetObject(anObject);
537 //=============================================================================
541 //=============================================================================
542 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
543 (GEOM::GEOM_Object_ptr theBase,
544 GEOM::GEOM_Object_ptr thePoint1,
545 GEOM::GEOM_Object_ptr thePoint2)
547 GEOM::GEOM_Object_var aGEOMObject;
549 //Set a not done flag
550 GetOperations()->SetNotDone();
552 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
553 return aGEOMObject._retn();
555 //Get the reference objects
556 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
557 (theBase->GetStudyID(), theBase->GetEntry());
558 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
559 (thePoint1->GetStudyID(), thePoint1->GetEntry());
560 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
561 (thePoint2->GetStudyID(), thePoint2->GetEntry());
563 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
564 return aGEOMObject._retn();
567 Handle(GEOM_Object) anObject =
568 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
569 if (!GetOperations()->IsDone() || anObject.IsNull())
570 return aGEOMObject._retn();
572 return GetObject(anObject);
575 //=============================================================================
577 * MakePrismTwoPnt2Ways
579 //=============================================================================
580 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
581 (GEOM::GEOM_Object_ptr theBase,
582 GEOM::GEOM_Object_ptr thePoint1,
583 GEOM::GEOM_Object_ptr thePoint2)
585 GEOM::GEOM_Object_var aGEOMObject;
587 //Set a not done flag
588 GetOperations()->SetNotDone();
590 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
591 return aGEOMObject._retn();
593 //Get the reference objects
594 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
595 (theBase->GetStudyID(), theBase->GetEntry());
596 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
597 (thePoint1->GetStudyID(), thePoint1->GetEntry());
598 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
599 (thePoint2->GetStudyID(), thePoint2->GetEntry());
601 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
602 return aGEOMObject._retn();
605 Handle(GEOM_Object) anObject =
606 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
607 if (!GetOperations()->IsDone() || anObject.IsNull())
608 return aGEOMObject._retn();
610 return GetObject(anObject);
613 //=============================================================================
617 //=============================================================================
618 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
619 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
620 CORBA::Double theDY, CORBA::Double theDZ)
622 GEOM::GEOM_Object_var aGEOMObject;
624 //Set a not done flag
625 GetOperations()->SetNotDone();
627 if (theBase == NULL) return aGEOMObject._retn();
629 //Get the reference objects
630 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
631 (theBase->GetStudyID(), theBase->GetEntry());
633 if (aBase.IsNull()) return aGEOMObject._retn();
636 Handle(GEOM_Object) anObject =
637 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
638 if (!GetOperations()->IsDone() || anObject.IsNull())
639 return aGEOMObject._retn();
641 return GetObject(anObject);
644 //=============================================================================
646 * MakePrismDXDYDZ2Ways
648 //=============================================================================
649 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
650 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
651 CORBA::Double theDY, CORBA::Double theDZ)
653 GEOM::GEOM_Object_var aGEOMObject;
655 //Set a not done flag
656 GetOperations()->SetNotDone();
658 if (theBase == NULL) return aGEOMObject._retn();
660 //Get the reference objects
661 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
662 (theBase->GetStudyID(), theBase->GetEntry());
664 if (aBase.IsNull()) return aGEOMObject._retn();
667 Handle(GEOM_Object) anObject =
668 GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
669 if (!GetOperations()->IsDone() || anObject.IsNull())
670 return aGEOMObject._retn();
672 return GetObject(anObject);
675 //=============================================================================
679 //=============================================================================
680 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
681 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
683 GEOM::GEOM_Object_var aGEOMObject;
685 //Set a not done flag
686 GetOperations()->SetNotDone();
688 if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
690 //Get the reference objects
691 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
692 (theBase->GetStudyID(), theBase->GetEntry());
693 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
694 (thePath->GetStudyID(), thePath->GetEntry());
696 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
699 Handle(GEOM_Object) anObject =
700 GetOperations()->MakePipe(aBase, aPath);
701 if (!GetOperations()->IsDone() || anObject.IsNull())
702 return aGEOMObject._retn();
704 return GetObject(anObject);
707 //=============================================================================
709 * MakeRevolutionAxisAngle
711 //=============================================================================
712 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
713 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
714 CORBA::Double theAngle)
716 GEOM::GEOM_Object_var aGEOMObject;
718 //Set a not done flag
719 GetOperations()->SetNotDone();
721 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
723 //Get the reference objects
724 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
725 (theBase->GetStudyID(), theBase->GetEntry());
726 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
727 (theAxis->GetStudyID(), theAxis->GetEntry());
729 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
731 //Create the Revolution
732 Handle(GEOM_Object) anObject =
733 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
734 if (!GetOperations()->IsDone() || anObject.IsNull())
735 return aGEOMObject._retn();
737 return GetObject(anObject);
740 //=============================================================================
742 * MakeRevolutionAxisAngle2Ways
744 //=============================================================================
745 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
746 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
747 CORBA::Double theAngle)
749 GEOM::GEOM_Object_var aGEOMObject;
751 //Set a not done flag
752 GetOperations()->SetNotDone();
754 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
756 //Get the reference objects
757 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
758 (theBase->GetStudyID(), theBase->GetEntry());
759 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
760 (theAxis->GetStudyID(), theAxis->GetEntry());
762 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
764 //Create the Revolution
765 Handle(GEOM_Object) anObject =
766 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
767 if (!GetOperations()->IsDone() || anObject.IsNull())
768 return aGEOMObject._retn();
770 return GetObject(anObject);
773 //=============================================================================
777 //=============================================================================
778 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
779 CORBA::Long theMinDeg,
780 CORBA::Long theMaxDeg,
781 CORBA::Double theTol2D,
782 CORBA::Double theTol3D,
783 CORBA::Long theNbIter,
784 CORBA::Boolean theApprox)
786 GEOM::GEOM_Object_var aGEOMObject;
788 //Set a not done flag
789 GetOperations()->SetNotDone();
791 if (theShape == NULL) return aGEOMObject._retn();
793 //Get the reference objects
794 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
795 (theShape->GetStudyID(), theShape->GetEntry());
797 if (aShape.IsNull()) return aGEOMObject._retn();
800 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox);
801 if (!GetOperations()->IsDone() || anObject.IsNull())
802 return aGEOMObject._retn();
804 return GetObject(anObject);
807 //=============================================================================
811 //=============================================================================
812 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
813 CORBA::Boolean theModeSolid,
814 CORBA::Double thePreci,
815 CORBA::Boolean theRuled)
817 GEOM::GEOM_Object_var aGEOMObject;
819 //Set a not done flag
820 GetOperations()->SetNotDone();
821 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
825 aLen = theSeqSections.length();
826 for (ind = 0; ind < aLen; ind++) {
827 if (theSeqSections[ind] == NULL) continue;
828 Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
829 (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
831 aSeqSections->Append(aSh);
833 if(!aSeqSections->Length())
834 return aGEOMObject._retn();
836 // Make shell or solid
837 Handle(GEOM_Object) anObject =
838 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
839 if (!GetOperations()->IsDone() || anObject.IsNull())
840 return aGEOMObject._retn();
842 return GetObject(anObject);
845 //=============================================================================
847 * MakePipeWithDifferentSections
849 //=============================================================================
850 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
851 const GEOM::ListOfGO& theLocations,
852 GEOM::GEOM_Object_ptr thePath,
853 CORBA::Boolean theWithContact,
854 CORBA::Boolean theWithCorrections)
856 GEOM::GEOM_Object_var aGEOMObject;
858 //Set a not done flag
859 GetOperations()->SetNotDone();
860 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
861 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
862 int ind=0, aNbBases =0,aNbLocs=0;
865 aNbBases = theBases.length();
866 aNbLocs = theLocations.length();
868 if( aNbLocs && aNbBases != aNbLocs)
869 return aGEOMObject._retn();
871 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
872 (thePath->GetStudyID(), thePath->GetEntry());
874 return aGEOMObject._retn();
876 for (ind = 0; ind < aNbBases; ind++) {
877 if (theBases[ind] == NULL) continue;
878 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(),
879 theBases[ind]->GetEntry());
884 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
885 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
888 aSeqLocations->Append(aLoc);
890 aSeqBases->Append(aBase);
892 if(!aSeqBases->Length())
893 return aGEOMObject._retn();
896 Handle(GEOM_Object) anObject =
897 GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
898 theWithContact,theWithCorrections);
899 if (!GetOperations()->IsDone() || anObject.IsNull())
900 return aGEOMObject._retn();
902 return GetObject(anObject);
906 //=============================================================================
908 * MakePipeWithShellSections
910 //=============================================================================
911 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
912 (const GEOM::ListOfGO& theBases,
913 const GEOM::ListOfGO& theSubBases,
914 const GEOM::ListOfGO& theLocations,
915 GEOM::GEOM_Object_ptr thePath,
916 CORBA::Boolean theWithContact,
917 CORBA::Boolean theWithCorrections)
919 GEOM::GEOM_Object_var aGEOMObject;
921 //Set a not done flag
922 GetOperations()->SetNotDone();
923 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
924 Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
925 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
926 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
929 aNbBases = theBases.length();
930 aNbSubBases = theSubBases.length();
931 aNbLocs = theLocations.length();
933 if( aNbLocs && aNbBases != aNbLocs)
934 return aGEOMObject._retn();
936 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
937 (thePath->GetStudyID(), thePath->GetEntry());
939 return aGEOMObject._retn();
941 for (ind = 0; ind < aNbBases; ind++) {
942 if (theBases[ind] == NULL) continue;
943 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
944 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
948 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
949 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
952 aSeqLocations->Append(aLoc);
954 aSeqBases->Append(aBase);
956 if(aNbSubBases>=aNbBases) {
957 Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
958 GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
959 if(aSubBase.IsNull()) {
960 aSeqSubBases->Clear();
964 aSeqSubBases->Append(aSubBase);
968 if(!aSeqBases->Length())
969 return aGEOMObject._retn();
972 Handle(GEOM_Object) anObject =
973 GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
974 aSeqLocations, aPath,
975 theWithContact, theWithCorrections);
976 if (!GetOperations()->IsDone() || anObject.IsNull())
977 return aGEOMObject._retn();
979 return GetObject(anObject);
983 //=============================================================================
985 * MakePipeShellsWithoutPath
987 //=============================================================================
988 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
989 (const GEOM::ListOfGO& theBases,
990 const GEOM::ListOfGO& theLocations)
992 GEOM::GEOM_Object_var aGEOMObject;
994 //Set a not done flag
995 GetOperations()->SetNotDone();
996 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
997 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
998 int ind=0, aNbBases=0, aNbLocs=0;
1001 aNbBases = theBases.length();
1002 aNbLocs = theLocations.length();
1004 if( aNbLocs && aNbBases != aNbLocs)
1005 return aGEOMObject._retn();
1007 for (ind = 0; ind < aNbBases; ind++) {
1008 if (theBases[ind] == NULL) continue;
1009 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
1010 GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
1014 Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
1015 (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
1018 aSeqLocations->Append(aLoc);
1020 aSeqBases->Append(aBase);
1023 if(!aSeqBases->Length())
1024 return aGEOMObject._retn();
1027 Handle(GEOM_Object) anObject =
1028 GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1030 if (!GetOperations()->IsDone() || anObject.IsNull())
1031 return aGEOMObject._retn();
1033 return GetObject(anObject);
1037 //=============================================================================
1039 * MakePipeBiNormalAlongVector
1041 //=============================================================================
1042 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1043 (GEOM::GEOM_Object_ptr theBase,
1044 GEOM::GEOM_Object_ptr thePath,
1045 GEOM::GEOM_Object_ptr theVec)
1047 GEOM::GEOM_Object_var aGEOMObject;
1049 //Set a not done flag
1050 GetOperations()->SetNotDone();
1052 if (theBase == NULL || thePath == NULL || theVec == NULL) return aGEOMObject._retn();
1054 //Get the reference objects
1055 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
1056 (theBase->GetStudyID(), theBase->GetEntry());
1057 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
1058 (thePath->GetStudyID(), thePath->GetEntry());
1059 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
1060 (theVec->GetStudyID(), theVec->GetEntry());
1062 if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
1065 Handle(GEOM_Object) anObject =
1066 GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
1067 if (!GetOperations()->IsDone() || anObject.IsNull())
1068 return aGEOMObject._retn();
1070 return GetObject(anObject);