1 // Copyright (C) 2007-2013 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
23 #include <Standard_Stream.hxx>
25 #include "GEOM_I3DPrimOperations_i.hh"
27 #include "utilities.h"
29 #include "Utils_ExceptHandlers.hxx"
31 #include "GEOM_Engine.hxx"
32 #include "GEOM_Object.hxx"
34 #define SUBSHAPE_ERROR "Sub shape cannot be transformed"
36 //=============================================================================
40 //=============================================================================
41 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
42 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
44 MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
47 //=============================================================================
51 //=============================================================================
52 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
54 MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
58 //=============================================================================
62 //=============================================================================
63 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
67 GEOM::GEOM_Object_var aGEOMObject;
70 GetOperations()->SetNotDone();
73 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
74 if (!GetOperations()->IsDone() || anObject.IsNull())
75 return aGEOMObject._retn();
77 return GetObject(anObject);
80 //=============================================================================
84 //=============================================================================
85 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
86 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
88 GEOM::GEOM_Object_var aGEOMObject;
91 GetOperations()->SetNotDone();
93 Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
94 Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
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 //Get the reference object
147 Handle(GEOM_Object) anObj = GetObjectImpl(theObj);
150 return aGEOMObject._retn();
153 Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
154 if (!GetOperations()->IsDone() || anObject.IsNull())
155 return aGEOMObject._retn();
157 return GetObject(anObject);
160 //=============================================================================
164 //=============================================================================
165 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
166 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
169 GEOM::GEOM_Object_var aGEOMObject;
171 //Set a not done flag
172 GetOperations()->SetNotDone();
174 //Get the reference points
175 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
176 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
178 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
181 Handle(GEOM_Object) anObject =
182 GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
183 if (!GetOperations()->IsDone() || anObject.IsNull())
184 return aGEOMObject._retn();
186 return GetObject(anObject);
189 //=============================================================================
193 //=============================================================================
194 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
195 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
196 GEOM::GEOM_Object_ptr thePnt3)
198 GEOM::GEOM_Object_var aGEOMObject;
200 //Set a not done flag
201 GetOperations()->SetNotDone();
203 //Get the reference points
204 Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
205 Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
206 Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3);
208 if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
211 Handle(GEOM_Object) anObject =
212 GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
213 if (!GetOperations()->IsDone() || anObject.IsNull())
214 return aGEOMObject._retn();
216 return GetObject(anObject);
219 //=============================================================================
223 //=============================================================================
224 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
225 CORBA::Short theOrientation)
227 GEOM::GEOM_Object_var aGEOMObject;
229 //Set a not done flag
230 GetOperations()->SetNotDone();
233 return aGEOMObject._retn();
236 Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
237 if (!GetOperations()->IsDone() || anObject.IsNull())
238 return aGEOMObject._retn();
240 return GetObject(anObject);
243 //=============================================================================
247 //=============================================================================
248 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
251 GEOM::GEOM_Object_var aGEOMObject;
253 //Set a not done flag
254 GetOperations()->SetNotDone();
256 //Create the Cylinder
257 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
258 if (!GetOperations()->IsDone() || anObject.IsNull())
259 return aGEOMObject._retn();
261 return GetObject(anObject);
264 //=============================================================================
266 * MakeCylinderPntVecRH
268 //=============================================================================
269 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
270 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
271 CORBA::Double theR, CORBA::Double theH)
273 GEOM::GEOM_Object_var aGEOMObject;
275 //Set a not done flag
276 GetOperations()->SetNotDone();
278 //Get the reference points
279 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
280 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
282 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
284 //Create the Cylinder
285 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
286 if (!GetOperations()->IsDone() || anObject.IsNull())
287 return aGEOMObject._retn();
289 return GetObject(anObject);
292 //=============================================================================
296 //=============================================================================
297 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
301 GEOM::GEOM_Object_var aGEOMObject;
303 //Set a not done flag
304 GetOperations()->SetNotDone();
307 Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
308 if (!GetOperations()->IsDone() || anObject.IsNull())
309 return aGEOMObject._retn();
311 return GetObject(anObject);
314 //=============================================================================
316 * MakeConePntVecR1R2H
318 //=============================================================================
319 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
320 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
321 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
323 GEOM::GEOM_Object_var aGEOMObject;
325 //Set a not done flag
326 GetOperations()->SetNotDone();
328 //Get the reference points
329 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
330 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
332 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
335 Handle(GEOM_Object) anObject =
336 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
337 if (!GetOperations()->IsDone() || anObject.IsNull())
338 return aGEOMObject._retn();
340 return GetObject(anObject);
343 //=============================================================================
347 //=============================================================================
348 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
350 GEOM::GEOM_Object_var aGEOMObject;
352 //Set a not done flag
353 GetOperations()->SetNotDone();
356 Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
357 if (!GetOperations()->IsDone() || anObject.IsNull())
358 return aGEOMObject._retn();
360 return GetObject(anObject);
363 //=============================================================================
367 //=============================================================================
368 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
369 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
371 GEOM::GEOM_Object_var aGEOMObject;
373 //Set a not done flag
374 GetOperations()->SetNotDone();
376 //Get the reference point
377 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
379 if (aPnt.IsNull()) return aGEOMObject._retn();
382 Handle(GEOM_Object) anObject =
383 GetOperations()->MakeSpherePntR(aPnt, theR);
384 if (!GetOperations()->IsDone() || anObject.IsNull())
385 return aGEOMObject._retn();
387 return GetObject(anObject);
390 //=============================================================================
394 //=============================================================================
395 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
396 (CORBA::Double theRMajor, CORBA::Double theRMinor)
398 GEOM::GEOM_Object_var aGEOMObject;
400 //Set a not done flag
401 GetOperations()->SetNotDone();
404 Handle(GEOM_Object) anObject =
405 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
406 if (!GetOperations()->IsDone() || anObject.IsNull())
407 return aGEOMObject._retn();
409 return GetObject(anObject);
412 //=============================================================================
416 //=============================================================================
417 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
418 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
419 CORBA::Double theRMajor, CORBA::Double theRMinor)
421 GEOM::GEOM_Object_var aGEOMObject;
423 //Set a not done flag
424 GetOperations()->SetNotDone();
426 //Get the reference points
427 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
428 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
430 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
433 Handle(GEOM_Object) anObject =
434 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
435 if (!GetOperations()->IsDone() || anObject.IsNull())
436 return aGEOMObject._retn();
438 return GetObject(anObject);
441 //=============================================================================
445 //=============================================================================
446 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
447 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
450 GEOM::GEOM_Object_var aGEOMObject;
452 //Set a not done flag
453 GetOperations()->SetNotDone();
455 //Get the reference objects
456 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
457 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
459 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
462 Handle(GEOM_Object) anObject =
463 GetOperations()->MakePrismVecH(aBase, aVec, theH);
464 if (!GetOperations()->IsDone() || anObject.IsNull())
465 return aGEOMObject._retn();
467 return GetObject(anObject);
470 //=============================================================================
474 //=============================================================================
475 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
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 //Get the reference objects
485 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
486 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
488 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
491 Handle(GEOM_Object) anObject =
492 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
493 if (!GetOperations()->IsDone() || anObject.IsNull())
494 return aGEOMObject._retn();
496 return GetObject(anObject);
499 //=============================================================================
503 //=============================================================================
504 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecHWithScaling
505 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
506 CORBA::Double theH, CORBA::Double theScaleFactor)
508 GEOM::GEOM_Object_var aGEOMObject;
510 //Set a not done flag
511 GetOperations()->SetNotDone();
513 //Get the reference objects
514 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
515 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
517 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
520 Handle(GEOM_Object) anObject =
521 GetOperations()->MakePrismVecH(aBase, aVec, theH, theScaleFactor);
522 if (!GetOperations()->IsDone() || anObject.IsNull())
523 return aGEOMObject._retn();
525 return GetObject(anObject);
528 //=============================================================================
532 //=============================================================================
533 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
534 (GEOM::GEOM_Object_ptr theBase,
535 GEOM::GEOM_Object_ptr thePoint1,
536 GEOM::GEOM_Object_ptr thePoint2)
538 GEOM::GEOM_Object_var aGEOMObject;
540 //Set a not done flag
541 GetOperations()->SetNotDone();
543 //Get the reference objects
544 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
545 Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
546 Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
548 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
549 return aGEOMObject._retn();
552 Handle(GEOM_Object) anObject =
553 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
554 if (!GetOperations()->IsDone() || anObject.IsNull())
555 return aGEOMObject._retn();
557 return GetObject(anObject);
560 //=============================================================================
562 * MakePrismTwoPnt2Ways
564 //=============================================================================
565 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
566 (GEOM::GEOM_Object_ptr theBase,
567 GEOM::GEOM_Object_ptr thePoint1,
568 GEOM::GEOM_Object_ptr thePoint2)
570 GEOM::GEOM_Object_var aGEOMObject;
572 //Set a not done flag
573 GetOperations()->SetNotDone();
575 //Get the reference objects
576 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
577 Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
578 Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
580 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
581 return aGEOMObject._retn();
584 Handle(GEOM_Object) anObject =
585 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
586 if (!GetOperations()->IsDone() || anObject.IsNull())
587 return aGEOMObject._retn();
589 return GetObject(anObject);
592 //=============================================================================
596 //=============================================================================
597 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPntWithScaling
598 (GEOM::GEOM_Object_ptr theBase,
599 GEOM::GEOM_Object_ptr thePoint1,
600 GEOM::GEOM_Object_ptr thePoint2,
601 CORBA::Double theScaleFactor)
603 GEOM::GEOM_Object_var aGEOMObject;
605 //Set a not done flag
606 GetOperations()->SetNotDone();
608 //Get the reference objects
609 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
610 Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
611 Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
613 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
614 return aGEOMObject._retn();
617 Handle(GEOM_Object) anObject =
618 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2, theScaleFactor);
619 if (!GetOperations()->IsDone() || anObject.IsNull())
620 return aGEOMObject._retn();
622 return GetObject(anObject);
625 //=============================================================================
629 //=============================================================================
630 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
631 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
632 CORBA::Double theDY, CORBA::Double theDZ)
634 GEOM::GEOM_Object_var aGEOMObject;
636 //Set a not done flag
637 GetOperations()->SetNotDone();
639 //Get the reference objects
640 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
642 if (aBase.IsNull()) return aGEOMObject._retn();
645 Handle(GEOM_Object) anObject =
646 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
647 if (!GetOperations()->IsDone() || anObject.IsNull())
648 return aGEOMObject._retn();
650 return GetObject(anObject);
653 //=============================================================================
655 * MakePrismDXDYDZ2Ways
657 //=============================================================================
658 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
659 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
660 CORBA::Double theDY, CORBA::Double theDZ)
662 GEOM::GEOM_Object_var aGEOMObject;
664 //Set a not done flag
665 GetOperations()->SetNotDone();
667 //Get the reference objects
668 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
670 if (aBase.IsNull()) return aGEOMObject._retn();
673 Handle(GEOM_Object) anObject =
674 GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
675 if (!GetOperations()->IsDone() || anObject.IsNull())
676 return aGEOMObject._retn();
678 return GetObject(anObject);
681 //=============================================================================
685 //=============================================================================
686 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZWithScaling
687 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
688 CORBA::Double theDY, CORBA::Double theDZ,
689 CORBA::Double theScaleFactor)
691 GEOM::GEOM_Object_var aGEOMObject;
693 //Set a not done flag
694 GetOperations()->SetNotDone();
696 //Get the reference objects
697 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
699 if (aBase.IsNull()) return aGEOMObject._retn();
702 Handle(GEOM_Object) anObject =
703 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ, theScaleFactor);
704 if (!GetOperations()->IsDone() || anObject.IsNull())
705 return aGEOMObject._retn();
707 return GetObject(anObject);
710 //=============================================================================
714 //=============================================================================
715 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
716 (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase,
717 CORBA::Double theHeight,
718 CORBA::Double theAngle,
719 CORBA::Boolean theFuse)
721 GEOM::GEOM_Object_var aGEOMObject;
723 //Set a not done flag
724 GetOperations()->SetNotDone();
726 //Get the reference objects
727 Handle(GEOM_Object) aInit = GetObjectImpl(theInitShape);
728 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
730 if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
733 Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse);
735 if (!GetOperations()->IsDone() || anObject.IsNull())
736 return aGEOMObject._retn();
738 return GetObject(anObject);
741 //=============================================================================
745 //=============================================================================
746 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
747 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
749 GEOM::GEOM_Object_var aGEOMObject;
751 //Set a not done flag
752 GetOperations()->SetNotDone();
754 //Get the reference objects
755 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
756 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
758 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
761 Handle(GEOM_Object) anObject =
762 GetOperations()->MakePipe(aBase, aPath);
763 if (!GetOperations()->IsDone() || anObject.IsNull())
764 return aGEOMObject._retn();
766 return GetObject(anObject);
769 //=============================================================================
771 * MakeRevolutionAxisAngle
773 //=============================================================================
774 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
775 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
776 CORBA::Double theAngle)
778 GEOM::GEOM_Object_var aGEOMObject;
780 //Set a not done flag
781 GetOperations()->SetNotDone();
783 //Get the reference objects
784 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
785 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
787 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
789 //Create the Revolution
790 Handle(GEOM_Object) anObject =
791 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
792 if (!GetOperations()->IsDone() || anObject.IsNull())
793 return aGEOMObject._retn();
795 return GetObject(anObject);
798 //=============================================================================
800 * MakeRevolutionAxisAngle2Ways
802 //=============================================================================
803 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
804 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
805 CORBA::Double theAngle)
807 GEOM::GEOM_Object_var aGEOMObject;
809 //Set a not done flag
810 GetOperations()->SetNotDone();
812 //Get the reference objects
813 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
814 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
816 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
818 //Create the Revolution
819 Handle(GEOM_Object) anObject =
820 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
821 if (!GetOperations()->IsDone() || anObject.IsNull())
822 return aGEOMObject._retn();
824 return GetObject(anObject);
827 //=============================================================================
831 //=============================================================================
832 GEOM::GEOM_Object_ptr
833 GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
834 CORBA::Long theMinDeg,
835 CORBA::Long theMaxDeg,
836 CORBA::Double theTol2D,
837 CORBA::Double theTol3D,
838 CORBA::Long theNbIter,
839 GEOM::filling_oper_method theMethod,
840 CORBA::Boolean theApprox)
842 GEOM::GEOM_Object_var aGEOMObject;
844 //Set a not done flag
845 GetOperations()->SetNotDone();
847 //Get the reference objects
848 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
850 if (aShape.IsNull()) return aGEOMObject._retn();
854 case GEOM::FOM_Default:
856 // Default (standard behaviour)
860 case GEOM::FOM_UseOri:
862 // Use edges orientation
866 case GEOM::FOM_AutoCorrect:
868 // Auto-correct edges orientation
877 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
878 (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
880 if (!GetOperations()->IsDone() || anObject.IsNull())
881 return aGEOMObject._retn();
883 return GetObject(anObject);
886 //=============================================================================
890 //=============================================================================
891 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
892 CORBA::Boolean theModeSolid,
893 CORBA::Double thePreci,
894 CORBA::Boolean theRuled)
896 GEOM::GEOM_Object_var aGEOMObject;
898 //Set a not done flag
899 GetOperations()->SetNotDone();
900 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
904 aLen = theSeqSections.length();
905 for (ind = 0; ind < aLen; ind++) {
906 Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
908 aSeqSections->Append(aSh);
910 if (!aSeqSections->Length())
911 return aGEOMObject._retn();
913 // Make shell or solid
914 Handle(GEOM_Object) anObject =
915 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
916 if (!GetOperations()->IsDone() || anObject.IsNull())
917 return aGEOMObject._retn();
919 return GetObject(anObject);
922 //=============================================================================
924 * MakePipeWithDifferentSections
926 //=============================================================================
927 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
928 (const GEOM::ListOfGO& theBases,
929 const GEOM::ListOfGO& theLocations,
930 GEOM::GEOM_Object_ptr thePath,
931 CORBA::Boolean theWithContact,
932 CORBA::Boolean theWithCorrections)
934 GEOM::GEOM_Object_var aGEOMObject;
936 //Set a not done flag
937 GetOperations()->SetNotDone();
938 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
939 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
940 int ind=0, aNbBases =0,aNbLocs=0;
943 aNbBases = theBases.length();
944 aNbLocs = theLocations.length();
946 if (aNbLocs && aNbBases != aNbLocs)
947 return aGEOMObject._retn();
949 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
951 return aGEOMObject._retn();
953 for (ind = 0; ind < aNbBases; ind++) {
954 Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
959 Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
962 aSeqLocations->Append(aLoc);
964 aSeqBases->Append(aBase);
966 if (!aSeqBases->Length())
967 return aGEOMObject._retn();
970 Handle(GEOM_Object) anObject =
971 GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
972 theWithContact,theWithCorrections);
973 if (!GetOperations()->IsDone() || anObject.IsNull())
974 return aGEOMObject._retn();
976 return GetObject(anObject);
980 //=============================================================================
982 * MakePipeWithShellSections
984 //=============================================================================
985 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
986 (const GEOM::ListOfGO& theBases,
987 const GEOM::ListOfGO& theSubBases,
988 const GEOM::ListOfGO& theLocations,
989 GEOM::GEOM_Object_ptr thePath,
990 CORBA::Boolean theWithContact,
991 CORBA::Boolean theWithCorrections)
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) aSeqSubBases = new TColStd_HSequenceOfTransient;
999 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1000 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
1003 aNbBases = theBases.length();
1004 aNbSubBases = theSubBases.length();
1005 aNbLocs = theLocations.length();
1007 if (aNbLocs && aNbBases != aNbLocs)
1008 return aGEOMObject._retn();
1010 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1012 return aGEOMObject._retn();
1014 for (ind = 0; ind < aNbBases; ind++) {
1015 Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1019 Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1022 aSeqLocations->Append(aLoc);
1024 aSeqBases->Append(aBase);
1026 if (aNbSubBases >= aNbBases) {
1027 Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
1028 if (aSubBase.IsNull()) {
1029 aSeqSubBases->Clear();
1033 aSeqSubBases->Append(aSubBase);
1036 if (!aSeqBases->Length())
1037 return aGEOMObject._retn();
1040 Handle(GEOM_Object) anObject =
1041 GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
1042 aSeqLocations, aPath,
1043 theWithContact, theWithCorrections);
1044 if (!GetOperations()->IsDone() || anObject.IsNull())
1045 return aGEOMObject._retn();
1047 return GetObject(anObject);
1051 //=============================================================================
1053 * MakePipeShellsWithoutPath
1055 //=============================================================================
1056 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
1057 (const GEOM::ListOfGO& theBases,
1058 const GEOM::ListOfGO& theLocations)
1060 GEOM::GEOM_Object_var aGEOMObject;
1062 //Set a not done flag
1063 GetOperations()->SetNotDone();
1064 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1065 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1066 int ind=0, aNbBases=0, aNbLocs=0;
1069 aNbBases = theBases.length();
1070 aNbLocs = theLocations.length();
1072 if (aNbLocs && aNbBases != aNbLocs)
1073 return aGEOMObject._retn();
1075 for (ind = 0; ind < aNbBases; ind++) {
1076 Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1080 Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1083 aSeqLocations->Append(aLoc);
1085 aSeqBases->Append(aBase);
1088 if (!aSeqBases->Length())
1089 return aGEOMObject._retn();
1092 Handle(GEOM_Object) anObject =
1093 GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1095 if (!GetOperations()->IsDone() || anObject.IsNull())
1096 return aGEOMObject._retn();
1098 return GetObject(anObject);
1101 //=============================================================================
1103 * MakePipeBiNormalAlongVector
1105 //=============================================================================
1106 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1107 (GEOM::GEOM_Object_ptr theBase,
1108 GEOM::GEOM_Object_ptr thePath,
1109 GEOM::GEOM_Object_ptr theVec)
1111 GEOM::GEOM_Object_var aGEOMObject;
1113 //Set a not done flag
1114 GetOperations()->SetNotDone();
1116 //Get the reference objects
1117 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
1118 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1119 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
1121 if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
1124 Handle(GEOM_Object) anObject =
1125 GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
1126 if (!GetOperations()->IsDone() || anObject.IsNull())
1127 return aGEOMObject._retn();
1129 return GetObject(anObject);
1132 //=============================================================================
1136 //=============================================================================
1137 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
1138 (GEOM::GEOM_Object_ptr theObject,
1139 CORBA::Double theOffset,
1140 CORBA::Boolean doCopy)
1142 GEOM::GEOM_Object_var aGEOMObject;
1143 //Set a not done flag
1144 GetOperations()->SetNotDone();
1146 if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
1148 //check if the object is a sub-shape
1149 if (!theObject->IsMainShape() && !doCopy) {
1150 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
1151 return aGEOMObject._retn();
1155 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1157 //Get the basic object
1158 Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1159 if (aBasicObject.IsNull()) return aGEOMObject._retn();
1161 //Create the thickened shape
1164 Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
1165 aBasicObject, theOffset, doCopy);
1166 if (!GetOperations()->IsDone() || anObject.IsNull())
1167 return aGEOMObject._retn();
1169 return GetObject(anObject);
1173 GetOperations()->MakeThickening(aBasicObject, theOffset, doCopy);
1176 UpdateGUIForObject(theObject);
1178 return aGEOMObject._retn();
1182 //=============================================================================
1186 //=============================================================================
1187 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePath
1188 (GEOM::GEOM_Object_ptr theShape,
1189 GEOM::GEOM_Object_ptr theBase1,
1190 GEOM::GEOM_Object_ptr theBase2)
1192 GEOM::GEOM_Object_var aGEOMObject;
1194 // Set a not done flag
1195 GetOperations()->SetNotDone();
1197 // Get the reference objects
1198 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1199 Handle(GEOM_Object) aBase1 = GetObjectImpl(theBase1);
1200 Handle(GEOM_Object) aBase2 = GetObjectImpl(theBase2);
1202 if (aShape.IsNull() || aBase1.IsNull() || aBase2.IsNull()) return aGEOMObject._retn();
1205 Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aBase1, aBase2);
1206 if (!GetOperations()->IsDone() || anObject.IsNull())
1207 return aGEOMObject._retn();
1209 return GetObject(anObject);
1212 //=============================================================================
1216 //=============================================================================
1217 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePathEdges
1218 (GEOM::GEOM_Object_ptr theShape,
1219 const GEOM::ListOfGO& theBase1,
1220 const GEOM::ListOfGO& theBase2)
1222 GEOM::GEOM_Object_var aGEOMObject;
1224 // Set a not done flag
1225 GetOperations()->SetNotDone();
1227 // Get the reference objects
1228 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1229 if (aShape.IsNull()) return aGEOMObject._retn();
1231 Handle(TColStd_HSequenceOfTransient) aSeqBases1 = new TColStd_HSequenceOfTransient;
1232 Handle(TColStd_HSequenceOfTransient) aSeqBases2 = new TColStd_HSequenceOfTransient;
1235 int aNbBases1 = theBase1.length();
1236 int aNbBases2 = theBase2.length();
1238 for (ind = 0; ind < aNbBases1; ind++) {
1239 Handle(GEOM_Object) aBase = GetObjectImpl(theBase1[ind]);
1240 if (!aBase.IsNull())
1241 aSeqBases1->Append(aBase);
1243 for (ind = 0; ind < aNbBases2; ind++) {
1244 Handle(GEOM_Object) aBase = GetObjectImpl(theBase2[ind]);
1245 if (!aBase.IsNull())
1246 aSeqBases2->Append(aBase);
1249 if (!aSeqBases1->Length() || !aSeqBases2->Length())
1250 return aGEOMObject._retn();
1253 Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aSeqBases1, aSeqBases2);
1254 if (!GetOperations()->IsDone() || anObject.IsNull())
1255 return aGEOMObject._retn();
1257 return GetObject(anObject);