1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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,
252 GEOM::GEOM_Object_var aGEOMObject;
254 //Set a not done flag
255 GetOperations()->SetNotDone();
257 //Create the Cylinder
258 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH, theA);
259 if (!GetOperations()->IsDone() || anObject.IsNull())
260 return aGEOMObject._retn();
262 return GetObject(anObject);
265 //=============================================================================
267 * MakeCylinderPntVecRH
269 //=============================================================================
270 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
271 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
272 CORBA::Double theR, CORBA::Double theH, CORBA::Double theA)
274 GEOM::GEOM_Object_var aGEOMObject;
276 //Set a not done flag
277 GetOperations()->SetNotDone();
279 //Get the reference points
280 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
281 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
283 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
285 //Create the Cylinder
286 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH, theA);
287 if (!GetOperations()->IsDone() || anObject.IsNull())
288 return aGEOMObject._retn();
290 return GetObject(anObject);
293 //=============================================================================
297 //=============================================================================
298 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
302 GEOM::GEOM_Object_var aGEOMObject;
304 //Set a not done flag
305 GetOperations()->SetNotDone();
308 Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
309 if (!GetOperations()->IsDone() || anObject.IsNull())
310 return aGEOMObject._retn();
312 return GetObject(anObject);
315 //=============================================================================
317 * MakeConePntVecR1R2H
319 //=============================================================================
320 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
321 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
322 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
324 GEOM::GEOM_Object_var aGEOMObject;
326 //Set a not done flag
327 GetOperations()->SetNotDone();
329 //Get the reference points
330 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
331 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
333 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
336 Handle(GEOM_Object) anObject =
337 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
338 if (!GetOperations()->IsDone() || anObject.IsNull())
339 return aGEOMObject._retn();
341 return GetObject(anObject);
344 //=============================================================================
348 //=============================================================================
349 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
351 GEOM::GEOM_Object_var aGEOMObject;
353 //Set a not done flag
354 GetOperations()->SetNotDone();
357 Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
358 if (!GetOperations()->IsDone() || anObject.IsNull())
359 return aGEOMObject._retn();
361 return GetObject(anObject);
364 //=============================================================================
368 //=============================================================================
369 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
370 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
372 GEOM::GEOM_Object_var aGEOMObject;
374 //Set a not done flag
375 GetOperations()->SetNotDone();
377 //Get the reference point
378 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
380 if (aPnt.IsNull()) return aGEOMObject._retn();
383 Handle(GEOM_Object) anObject =
384 GetOperations()->MakeSpherePntR(aPnt, theR);
385 if (!GetOperations()->IsDone() || anObject.IsNull())
386 return aGEOMObject._retn();
388 return GetObject(anObject);
391 //=============================================================================
395 //=============================================================================
396 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
397 (CORBA::Double theRMajor, CORBA::Double theRMinor)
399 GEOM::GEOM_Object_var aGEOMObject;
401 //Set a not done flag
402 GetOperations()->SetNotDone();
405 Handle(GEOM_Object) anObject =
406 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
407 if (!GetOperations()->IsDone() || anObject.IsNull())
408 return aGEOMObject._retn();
410 return GetObject(anObject);
413 //=============================================================================
417 //=============================================================================
418 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
419 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
420 CORBA::Double theRMajor, CORBA::Double theRMinor)
422 GEOM::GEOM_Object_var aGEOMObject;
424 //Set a not done flag
425 GetOperations()->SetNotDone();
427 //Get the reference points
428 Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
429 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
431 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
434 Handle(GEOM_Object) anObject =
435 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
436 if (!GetOperations()->IsDone() || anObject.IsNull())
437 return aGEOMObject._retn();
439 return GetObject(anObject);
442 //=============================================================================
446 //=============================================================================
447 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
448 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
451 GEOM::GEOM_Object_var aGEOMObject;
453 //Set a not done flag
454 GetOperations()->SetNotDone();
456 //Get the reference objects
457 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
458 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
460 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
463 Handle(GEOM_Object) anObject =
464 GetOperations()->MakePrismVecH(aBase, aVec, theH);
465 if (!GetOperations()->IsDone() || anObject.IsNull())
466 return aGEOMObject._retn();
468 return GetObject(anObject);
471 //=============================================================================
475 //=============================================================================
476 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
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 //Get the reference objects
486 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
487 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
489 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
492 Handle(GEOM_Object) anObject =
493 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
494 if (!GetOperations()->IsDone() || anObject.IsNull())
495 return aGEOMObject._retn();
497 return GetObject(anObject);
500 //=============================================================================
504 //=============================================================================
505 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecHWithScaling
506 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
507 CORBA::Double theH, CORBA::Double theScaleFactor)
509 GEOM::GEOM_Object_var aGEOMObject;
511 //Set a not done flag
512 GetOperations()->SetNotDone();
514 //Get the reference objects
515 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
516 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
518 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
521 Handle(GEOM_Object) anObject =
522 GetOperations()->MakePrismVecH(aBase, aVec, theH, theScaleFactor);
523 if (!GetOperations()->IsDone() || anObject.IsNull())
524 return aGEOMObject._retn();
526 return GetObject(anObject);
529 //=============================================================================
533 //=============================================================================
534 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
535 (GEOM::GEOM_Object_ptr theBase,
536 GEOM::GEOM_Object_ptr thePoint1,
537 GEOM::GEOM_Object_ptr thePoint2)
539 GEOM::GEOM_Object_var aGEOMObject;
541 //Set a not done flag
542 GetOperations()->SetNotDone();
544 //Get the reference objects
545 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
546 Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
547 Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
549 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
550 return aGEOMObject._retn();
553 Handle(GEOM_Object) anObject =
554 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
555 if (!GetOperations()->IsDone() || anObject.IsNull())
556 return aGEOMObject._retn();
558 return GetObject(anObject);
561 //=============================================================================
563 * MakePrismTwoPnt2Ways
565 //=============================================================================
566 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
567 (GEOM::GEOM_Object_ptr theBase,
568 GEOM::GEOM_Object_ptr thePoint1,
569 GEOM::GEOM_Object_ptr thePoint2)
571 GEOM::GEOM_Object_var aGEOMObject;
573 //Set a not done flag
574 GetOperations()->SetNotDone();
576 //Get the reference objects
577 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
578 Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
579 Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
581 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
582 return aGEOMObject._retn();
585 Handle(GEOM_Object) anObject =
586 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
587 if (!GetOperations()->IsDone() || anObject.IsNull())
588 return aGEOMObject._retn();
590 return GetObject(anObject);
593 //=============================================================================
597 //=============================================================================
598 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPntWithScaling
599 (GEOM::GEOM_Object_ptr theBase,
600 GEOM::GEOM_Object_ptr thePoint1,
601 GEOM::GEOM_Object_ptr thePoint2,
602 CORBA::Double theScaleFactor)
604 GEOM::GEOM_Object_var aGEOMObject;
606 //Set a not done flag
607 GetOperations()->SetNotDone();
609 //Get the reference objects
610 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
611 Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
612 Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
614 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
615 return aGEOMObject._retn();
618 Handle(GEOM_Object) anObject =
619 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2, theScaleFactor);
620 if (!GetOperations()->IsDone() || anObject.IsNull())
621 return aGEOMObject._retn();
623 return GetObject(anObject);
626 //=============================================================================
630 //=============================================================================
631 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
632 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
633 CORBA::Double theDY, CORBA::Double theDZ)
635 GEOM::GEOM_Object_var aGEOMObject;
637 //Set a not done flag
638 GetOperations()->SetNotDone();
640 //Get the reference objects
641 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
643 if (aBase.IsNull()) return aGEOMObject._retn();
646 Handle(GEOM_Object) anObject =
647 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
648 if (!GetOperations()->IsDone() || anObject.IsNull())
649 return aGEOMObject._retn();
651 return GetObject(anObject);
654 //=============================================================================
656 * MakePrismDXDYDZ2Ways
658 //=============================================================================
659 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
660 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
661 CORBA::Double theDY, CORBA::Double theDZ)
663 GEOM::GEOM_Object_var aGEOMObject;
665 //Set a not done flag
666 GetOperations()->SetNotDone();
668 //Get the reference objects
669 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
671 if (aBase.IsNull()) return aGEOMObject._retn();
674 Handle(GEOM_Object) anObject =
675 GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
676 if (!GetOperations()->IsDone() || anObject.IsNull())
677 return aGEOMObject._retn();
679 return GetObject(anObject);
682 //=============================================================================
686 //=============================================================================
687 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZWithScaling
688 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
689 CORBA::Double theDY, CORBA::Double theDZ,
690 CORBA::Double theScaleFactor)
692 GEOM::GEOM_Object_var aGEOMObject;
694 //Set a not done flag
695 GetOperations()->SetNotDone();
697 //Get the reference objects
698 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
700 if (aBase.IsNull()) return aGEOMObject._retn();
703 Handle(GEOM_Object) anObject =
704 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ, theScaleFactor);
705 if (!GetOperations()->IsDone() || anObject.IsNull())
706 return aGEOMObject._retn();
708 return GetObject(anObject);
711 //=============================================================================
715 //=============================================================================
716 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
717 (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase,
718 CORBA::Double theHeight,
719 CORBA::Double theAngle,
720 CORBA::Boolean theFuse)
722 GEOM::GEOM_Object_var aGEOMObject;
724 //Set a not done flag
725 GetOperations()->SetNotDone();
727 //Get the reference objects
728 Handle(GEOM_Object) aInit = GetObjectImpl(theInitShape);
729 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
731 if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
734 Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse);
736 if (!GetOperations()->IsDone() || anObject.IsNull())
737 return aGEOMObject._retn();
739 return GetObject(anObject);
742 //=============================================================================
746 //=============================================================================
747 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
748 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
750 GEOM::GEOM_Object_var aGEOMObject;
752 //Set a not done flag
753 GetOperations()->SetNotDone();
755 //Get the reference objects
756 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
757 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
759 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
762 Handle(GEOM_Object) anObject =
763 GetOperations()->MakePipe(aBase, aPath);
764 if (!GetOperations()->IsDone() || anObject.IsNull())
765 return aGEOMObject._retn();
767 return GetObject(anObject);
770 //=============================================================================
772 * MakeRevolutionAxisAngle
774 //=============================================================================
775 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
776 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
777 CORBA::Double theAngle)
779 GEOM::GEOM_Object_var aGEOMObject;
781 //Set a not done flag
782 GetOperations()->SetNotDone();
784 //Get the reference objects
785 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
786 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
788 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
790 //Create the Revolution
791 Handle(GEOM_Object) anObject =
792 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
793 if (!GetOperations()->IsDone() || anObject.IsNull())
794 return aGEOMObject._retn();
796 return GetObject(anObject);
799 //=============================================================================
801 * MakeRevolutionAxisAngle2Ways
803 //=============================================================================
804 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
805 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
806 CORBA::Double theAngle)
808 GEOM::GEOM_Object_var aGEOMObject;
810 //Set a not done flag
811 GetOperations()->SetNotDone();
813 //Get the reference objects
814 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
815 Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
817 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
819 //Create the Revolution
820 Handle(GEOM_Object) anObject =
821 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
822 if (!GetOperations()->IsDone() || anObject.IsNull())
823 return aGEOMObject._retn();
825 return GetObject(anObject);
828 //=============================================================================
832 //=============================================================================
833 GEOM::GEOM_Object_ptr
834 GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
835 CORBA::Long theMinDeg,
836 CORBA::Long theMaxDeg,
837 CORBA::Double theTol2D,
838 CORBA::Double theTol3D,
839 CORBA::Long theNbIter,
840 GEOM::filling_oper_method theMethod,
841 CORBA::Boolean theApprox)
843 GEOM::GEOM_Object_var aGEOMObject;
845 //Set a not done flag
846 GetOperations()->SetNotDone();
848 //Get the reference objects
849 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
851 if (aShape.IsNull()) return aGEOMObject._retn();
855 case GEOM::FOM_Default:
857 // Default (standard behaviour)
861 case GEOM::FOM_UseOri:
863 // Use edges orientation
867 case GEOM::FOM_AutoCorrect:
869 // Auto-correct edges orientation
878 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
879 (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
881 if (!GetOperations()->IsDone() || anObject.IsNull())
882 return aGEOMObject._retn();
884 return GetObject(anObject);
887 //=============================================================================
891 //=============================================================================
892 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
893 CORBA::Boolean theModeSolid,
894 CORBA::Double thePreci,
895 CORBA::Boolean theRuled)
897 GEOM::GEOM_Object_var aGEOMObject;
899 //Set a not done flag
900 GetOperations()->SetNotDone();
901 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
905 aLen = theSeqSections.length();
906 for (ind = 0; ind < aLen; ind++) {
907 Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
909 aSeqSections->Append(aSh);
911 if (!aSeqSections->Length())
912 return aGEOMObject._retn();
914 // Make shell or solid
915 Handle(GEOM_Object) anObject =
916 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
917 if (!GetOperations()->IsDone() || anObject.IsNull())
918 return aGEOMObject._retn();
920 return GetObject(anObject);
923 //=============================================================================
925 * MakePipeWithDifferentSections
927 //=============================================================================
928 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
929 (const GEOM::ListOfGO& theBases,
930 const GEOM::ListOfGO& theLocations,
931 GEOM::GEOM_Object_ptr thePath,
932 CORBA::Boolean theWithContact,
933 CORBA::Boolean theWithCorrections)
935 GEOM::GEOM_Object_var aGEOMObject;
937 //Set a not done flag
938 GetOperations()->SetNotDone();
939 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
940 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
941 int ind=0, aNbBases =0,aNbLocs=0;
944 aNbBases = theBases.length();
945 aNbLocs = theLocations.length();
947 if (aNbLocs && aNbBases != aNbLocs)
948 return aGEOMObject._retn();
950 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
952 return aGEOMObject._retn();
954 for (ind = 0; ind < aNbBases; ind++) {
955 Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
960 Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
963 aSeqLocations->Append(aLoc);
965 aSeqBases->Append(aBase);
967 if (!aSeqBases->Length())
968 return aGEOMObject._retn();
971 Handle(GEOM_Object) anObject =
972 GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
973 theWithContact,theWithCorrections);
974 if (!GetOperations()->IsDone() || anObject.IsNull())
975 return aGEOMObject._retn();
977 return GetObject(anObject);
981 //=============================================================================
983 * MakePipeWithShellSections
985 //=============================================================================
986 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
987 (const GEOM::ListOfGO& theBases,
988 const GEOM::ListOfGO& theSubBases,
989 const GEOM::ListOfGO& theLocations,
990 GEOM::GEOM_Object_ptr thePath,
991 CORBA::Boolean theWithContact,
992 CORBA::Boolean theWithCorrections)
994 GEOM::GEOM_Object_var aGEOMObject;
996 //Set a not done flag
997 GetOperations()->SetNotDone();
998 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
999 Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
1000 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1001 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
1004 aNbBases = theBases.length();
1005 aNbSubBases = theSubBases.length();
1006 aNbLocs = theLocations.length();
1008 if (aNbLocs && aNbBases != aNbLocs)
1009 return aGEOMObject._retn();
1011 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1013 return aGEOMObject._retn();
1015 for (ind = 0; ind < aNbBases; ind++) {
1016 Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1020 Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1023 aSeqLocations->Append(aLoc);
1025 aSeqBases->Append(aBase);
1027 if (aNbSubBases >= aNbBases) {
1028 Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
1029 if (aSubBase.IsNull()) {
1030 aSeqSubBases->Clear();
1034 aSeqSubBases->Append(aSubBase);
1037 if (!aSeqBases->Length())
1038 return aGEOMObject._retn();
1041 Handle(GEOM_Object) anObject =
1042 GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
1043 aSeqLocations, aPath,
1044 theWithContact, theWithCorrections);
1045 if (!GetOperations()->IsDone() || anObject.IsNull())
1046 return aGEOMObject._retn();
1048 return GetObject(anObject);
1052 //=============================================================================
1054 * MakePipeShellsWithoutPath
1056 //=============================================================================
1057 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
1058 (const GEOM::ListOfGO& theBases,
1059 const GEOM::ListOfGO& theLocations)
1061 GEOM::GEOM_Object_var aGEOMObject;
1063 //Set a not done flag
1064 GetOperations()->SetNotDone();
1065 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1066 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1067 int ind=0, aNbBases=0, aNbLocs=0;
1070 aNbBases = theBases.length();
1071 aNbLocs = theLocations.length();
1073 if (aNbLocs && aNbBases != aNbLocs)
1074 return aGEOMObject._retn();
1076 for (ind = 0; ind < aNbBases; ind++) {
1077 Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1081 Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1084 aSeqLocations->Append(aLoc);
1086 aSeqBases->Append(aBase);
1089 if (!aSeqBases->Length())
1090 return aGEOMObject._retn();
1093 Handle(GEOM_Object) anObject =
1094 GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1096 if (!GetOperations()->IsDone() || anObject.IsNull())
1097 return aGEOMObject._retn();
1099 return GetObject(anObject);
1102 //=============================================================================
1104 * MakePipeBiNormalAlongVector
1106 //=============================================================================
1107 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1108 (GEOM::GEOM_Object_ptr theBase,
1109 GEOM::GEOM_Object_ptr thePath,
1110 GEOM::GEOM_Object_ptr theVec)
1112 GEOM::GEOM_Object_var aGEOMObject;
1114 //Set a not done flag
1115 GetOperations()->SetNotDone();
1117 //Get the reference objects
1118 Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
1119 Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1120 Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
1122 if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
1125 Handle(GEOM_Object) anObject =
1126 GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
1127 if (!GetOperations()->IsDone() || anObject.IsNull())
1128 return aGEOMObject._retn();
1130 return GetObject(anObject);
1133 //=============================================================================
1137 //=============================================================================
1138 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
1139 (GEOM::GEOM_Object_ptr theObject,
1140 CORBA::Double theOffset,
1141 CORBA::Boolean doCopy)
1143 GEOM::GEOM_Object_var aGEOMObject;
1144 //Set a not done flag
1145 GetOperations()->SetNotDone();
1147 if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
1149 //check if the object is a sub-shape
1150 if (!theObject->IsMainShape() && !doCopy) {
1151 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
1152 return aGEOMObject._retn();
1156 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1158 //Get the basic object
1159 Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1160 if (aBasicObject.IsNull()) return aGEOMObject._retn();
1162 //Create the thickened shape
1165 Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
1166 aBasicObject, theOffset, doCopy);
1167 if (!GetOperations()->IsDone() || anObject.IsNull())
1168 return aGEOMObject._retn();
1170 return GetObject(anObject);
1174 GetOperations()->MakeThickening(aBasicObject, theOffset, doCopy);
1177 UpdateGUIForObject(theObject);
1179 return aGEOMObject._retn();
1183 //=============================================================================
1187 //=============================================================================
1188 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePath
1189 (GEOM::GEOM_Object_ptr theShape,
1190 GEOM::GEOM_Object_ptr theBase1,
1191 GEOM::GEOM_Object_ptr theBase2)
1193 GEOM::GEOM_Object_var aGEOMObject;
1195 // Set a not done flag
1196 GetOperations()->SetNotDone();
1198 // Get the reference objects
1199 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1200 Handle(GEOM_Object) aBase1 = GetObjectImpl(theBase1);
1201 Handle(GEOM_Object) aBase2 = GetObjectImpl(theBase2);
1203 if (aShape.IsNull() || aBase1.IsNull() || aBase2.IsNull()) return aGEOMObject._retn();
1206 Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aBase1, aBase2);
1207 if (!GetOperations()->IsDone() || anObject.IsNull())
1208 return aGEOMObject._retn();
1210 return GetObject(anObject);
1213 //=============================================================================
1217 //=============================================================================
1218 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePathEdges
1219 (GEOM::GEOM_Object_ptr theShape,
1220 const GEOM::ListOfGO& theBase1,
1221 const GEOM::ListOfGO& theBase2)
1223 GEOM::GEOM_Object_var aGEOMObject;
1225 // Set a not done flag
1226 GetOperations()->SetNotDone();
1228 // Get the reference objects
1229 Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1230 if (aShape.IsNull()) return aGEOMObject._retn();
1232 Handle(TColStd_HSequenceOfTransient) aSeqBases1 = new TColStd_HSequenceOfTransient;
1233 Handle(TColStd_HSequenceOfTransient) aSeqBases2 = new TColStd_HSequenceOfTransient;
1236 int aNbBases1 = theBase1.length();
1237 int aNbBases2 = theBase2.length();
1239 for (ind = 0; ind < aNbBases1; ind++) {
1240 Handle(GEOM_Object) aBase = GetObjectImpl(theBase1[ind]);
1241 if (!aBase.IsNull())
1242 aSeqBases1->Append(aBase);
1244 for (ind = 0; ind < aNbBases2; ind++) {
1245 Handle(GEOM_Object) aBase = GetObjectImpl(theBase2[ind]);
1246 if (!aBase.IsNull())
1247 aSeqBases2->Append(aBase);
1250 if (!aSeqBases1->Length() || !aSeqBases2->Length())
1251 return aGEOMObject._retn();
1254 Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aSeqBases1, aSeqBases2);
1255 if (!GetOperations()->IsDone() || anObject.IsNull())
1256 return aGEOMObject._retn();
1258 return GetObject(anObject);