1 #include <Standard_Stream.hxx>
3 #include <GEOMImpl_I3DPrimOperations.hxx>
7 #include <Utils_ExceptHandlers.hxx>
9 #include <TFunction_DriverTable.hxx>
10 #include <TFunction_Driver.hxx>
11 #include <TFunction_Logbook.hxx>
12 #include <TDF_Tool.hxx>
14 #include <GEOM_Function.hxx>
15 #include <GEOM_PythonDump.hxx>
17 #include <GEOMImpl_Types.hxx>
19 #include <GEOMImpl_BoxDriver.hxx>
20 #include <GEOMImpl_CylinderDriver.hxx>
21 #include <GEOMImpl_ConeDriver.hxx>
22 #include <GEOMImpl_SphereDriver.hxx>
23 #include <GEOMImpl_TorusDriver.hxx>
24 #include <GEOMImpl_PrismDriver.hxx>
25 #include <GEOMImpl_PipeDriver.hxx>
26 #include <GEOMImpl_RevolutionDriver.hxx>
27 #include <GEOMImpl_ShapeDriver.hxx>
28 #include <GEOMImpl_FillingDriver.hxx>
30 #include <GEOMImpl_IBox.hxx>
31 #include <GEOMImpl_ICylinder.hxx>
32 #include <GEOMImpl_ICone.hxx>
33 #include <GEOMImpl_ISphere.hxx>
34 #include <GEOMImpl_ITorus.hxx>
35 #include <GEOMImpl_IPrism.hxx>
36 #include <GEOMImpl_IPipe.hxx>
37 #include <GEOMImpl_IRevolution.hxx>
38 #include <GEOMImpl_IShapes.hxx>
39 #include <GEOMImpl_IFilling.hxx>
41 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
43 //=============================================================================
47 //=============================================================================
48 GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations (GEOM_Engine* theEngine, int theDocID)
49 : GEOM_IOperations(theEngine, theDocID)
51 MESSAGE("GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations");
54 //=============================================================================
58 //=============================================================================
59 GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations()
61 MESSAGE("GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations");
65 //=============================================================================
69 //=============================================================================
70 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, double theDY, double theDZ)
74 //Add a new Box object
75 Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
77 //Add a new Box function with DX_DY_DZ parameters
78 Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_DX_DY_DZ);
79 if (aFunction.IsNull()) return NULL;
81 //Check if the function is set correctly
82 if (aFunction->GetDriverGUID() != GEOMImpl_BoxDriver::GetID()) return NULL;
84 GEOMImpl_IBox aBI (aFunction);
90 //Compute the box value
92 if (!GetSolver()->ComputeFunction(aFunction)) {
93 SetErrorCode("Box driver failed");
97 catch (Standard_Failure) {
98 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
99 SetErrorCode(aFail->GetMessageString());
103 //Make a Python command
104 GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxDXDYDZ("
105 << theDX << ", " << theDY << ", " << theDZ << ")";
112 //=============================================================================
116 //=============================================================================
117 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1,
118 Handle(GEOM_Object) thePnt2)
122 if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
124 //Add a new Box object
125 Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
127 //Add a new Box function for creation a box relatively to two points
128 Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_TWO_PNT);
129 if (aFunction.IsNull()) return NULL;
131 //Check if the function is set correctly
132 if (aFunction->GetDriverGUID() != GEOMImpl_BoxDriver::GetID()) return aBox;
134 GEOMImpl_IBox aBI (aFunction);
136 Handle(GEOM_Function) aRefFunction1 = thePnt1->GetLastFunction();
137 Handle(GEOM_Function) aRefFunction2 = thePnt2->GetLastFunction();
139 if (aRefFunction1.IsNull() || aRefFunction2.IsNull()) return aBox;
141 aBI.SetRef1(aRefFunction1);
142 aBI.SetRef2(aRefFunction2);
144 //Compute the Box value
146 if (!GetSolver()->ComputeFunction(aFunction)) {
147 SetErrorCode("Box driver failed");
151 catch (Standard_Failure) {
152 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
153 SetErrorCode(aFail->GetMessageString());
157 //Make a Python command
158 GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxTwoPnt("
159 << thePnt1 << ", " << thePnt2 << ")";
166 //=============================================================================
170 //=============================================================================
171 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, double theH)
175 //Add a new Cylinder object
176 Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
178 //Add a new Cylinder function with R and H parameters
179 Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H);
180 if (aFunction.IsNull()) return NULL;
182 //Check if the function is set correctly
183 if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
185 GEOMImpl_ICylinder aCI (aFunction);
190 //Compute the Cylinder value
192 if (!GetSolver()->ComputeFunction(aFunction)) {
193 SetErrorCode("Cylinder driver failed");
197 catch (Standard_Failure) {
198 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
199 SetErrorCode(aFail->GetMessageString());
203 //Make a Python command
204 GEOM::TPythonDump(aFunction) << aCylinder
205 << " = geompy.MakeCylinderRH(" << theR << ", " << theH << ")";
212 //=============================================================================
214 * MakeCylinderPntVecRH
216 //=============================================================================
217 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
218 Handle(GEOM_Object) theVec,
219 double theR, double theH)
223 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
225 //Add a new Cylinder object
226 Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
228 //Add a new Cylinder function for creation a cylinder relatively to point and vector
229 Handle(GEOM_Function) aFunction =
230 aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H);
231 if (aFunction.IsNull()) return NULL;
233 //Check if the function is set correctly
234 if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
236 GEOMImpl_ICylinder aCI (aFunction);
238 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
239 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
241 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
243 aCI.SetPoint(aRefPnt);
244 aCI.SetVector(aRefVec);
248 //Compute the Cylinder value
250 if (!GetSolver()->ComputeFunction(aFunction)) {
251 SetErrorCode("Cylinder driver failed");
255 catch (Standard_Failure) {
256 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
257 SetErrorCode(aFail->GetMessageString());
261 //Make a Python command
262 GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder("
263 << thePnt << ", " << theVec << ", " << theR << ", " << theH << ")";
270 //=============================================================================
274 //=============================================================================
275 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, double theR2,
280 //Add a new Cone object
281 Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE);
283 //Add a new Cone function with R and H parameters
284 Handle(GEOM_Function) aFunction =
285 aCone->AddFunction(GEOMImpl_ConeDriver::GetID(), CONE_R1_R2_H);
286 if (aFunction.IsNull()) return NULL;
288 //Check if the function is set correctly
289 if (aFunction->GetDriverGUID() != GEOMImpl_ConeDriver::GetID()) return NULL;
291 GEOMImpl_ICone aCI (aFunction);
297 //Compute the Cone value
299 if (!GetSolver()->ComputeFunction(aFunction)) {
300 SetErrorCode("Cone driver failed");
304 catch (Standard_Failure) {
305 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
306 SetErrorCode(aFail->GetMessageString());
310 //Make a Python command
311 GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeConeR1R2H("
312 << theR1 << ", " << theR2 << ", " << theH << ")";
319 //=============================================================================
321 * MakeConePntVecR1R2H
323 //=============================================================================
324 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
325 Handle(GEOM_Object) theVec,
326 double theR1, double theR2,
331 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
333 //Add a new Cone object
334 Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE);
336 //Add a new Cone function for creation a cone relatively to point and vector
337 Handle(GEOM_Function) aFunction =
338 aCone->AddFunction(GEOMImpl_ConeDriver::GetID(), CONE_PNT_VEC_R1_R2_H);
339 if (aFunction.IsNull()) return NULL;
341 //Check if the function is set correctly
342 if (aFunction->GetDriverGUID() != GEOMImpl_ConeDriver::GetID()) return NULL;
344 GEOMImpl_ICone aCI (aFunction);
346 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
347 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
349 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
351 aCI.SetPoint(aRefPnt);
352 aCI.SetVector(aRefVec);
357 //Compute the Cone value
359 if (!GetSolver()->ComputeFunction(aFunction)) {
360 SetErrorCode("Cone driver failed");
364 catch (Standard_Failure) {
365 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
366 SetErrorCode(aFail->GetMessageString());
370 //Make a Python command
371 GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeCone(" << thePnt
372 << ", " << theVec << ", " << theR1 << ", " << theR2 << ", " << theH << ")";
379 //=============================================================================
383 //=============================================================================
384 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR)
388 //Add a new Sphere object
389 Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE);
391 //Add a new Sphere function with R parameter
392 Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_R);
393 if (aFunction.IsNull()) return NULL;
395 //Check if the function is set correctly
396 if (aFunction->GetDriverGUID() != GEOMImpl_SphereDriver::GetID()) return NULL;
398 GEOMImpl_ISphere aCI (aFunction);
402 //Compute the Sphere value
404 if (!GetSolver()->ComputeFunction(aFunction)) {
405 SetErrorCode("Sphere driver failed");
409 catch (Standard_Failure) {
410 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
411 SetErrorCode(aFail->GetMessageString());
415 //Make a Python command
416 GEOM::TPythonDump(aFunction) << aSphere << " = geompy.MakeSphereR(" << theR << ")";
423 //=============================================================================
427 //=============================================================================
428 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Object) thePnt,
433 if (thePnt.IsNull()) return NULL;
435 //Add a new Point object
436 Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE);
438 //Add a new Sphere function for creation a sphere relatively to point
439 Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_PNT_R);
440 if (aFunction.IsNull()) return NULL;
442 //Check if the function is set correctly
443 if (aFunction->GetDriverGUID() != GEOMImpl_SphereDriver::GetID()) return NULL;
445 GEOMImpl_ISphere aCI (aFunction);
447 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
449 if (aRefPnt.IsNull()) return NULL;
451 aCI.SetPoint(aRefPnt);
454 //Compute the Sphere value
456 if (!GetSolver()->ComputeFunction(aFunction)) {
457 SetErrorCode("Sphere driver failed");
461 catch (Standard_Failure) {
462 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
463 SetErrorCode(aFail->GetMessageString());
467 //Make a Python command
468 GEOM::TPythonDump(aFunction) << aSphere
469 << " = geompy.MakeSpherePntR(" << thePnt << ", " << theR << ")";
476 //=============================================================================
480 //=============================================================================
481 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR
482 (double theRMajor, double theRMinor)
486 //Add a new Torus object
487 Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS);
489 //Add a new Torus function
490 Handle(GEOM_Function) aFunction =
491 anEll->AddFunction(GEOMImpl_TorusDriver::GetID(), TORUS_RR);
492 if (aFunction.IsNull()) return NULL;
494 //Check if the function is set correctly
495 if (aFunction->GetDriverGUID() != GEOMImpl_TorusDriver::GetID()) return NULL;
497 GEOMImpl_ITorus aCI (aFunction);
499 aCI.SetRMajor(theRMajor);
500 aCI.SetRMinor(theRMinor);
502 //Compute the Torus value
504 if (!GetSolver()->ComputeFunction(aFunction)) {
505 SetErrorCode("Torus driver failed");
509 catch (Standard_Failure) {
510 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
511 SetErrorCode(aFail->GetMessageString());
515 //Make a Python command
516 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorusRR("
517 << theRMajor << ", " << theRMinor << ")";
523 //=============================================================================
527 //=============================================================================
528 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR
529 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
530 double theRMajor, double theRMinor)
534 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
536 //Add a new Torus object
537 Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS);
539 //Add a new Torus function
540 Handle(GEOM_Function) aFunction =
541 anEll->AddFunction(GEOMImpl_TorusDriver::GetID(), TORUS_PNT_VEC_RR);
542 if (aFunction.IsNull()) return NULL;
544 //Check if the function is set correctly
545 if (aFunction->GetDriverGUID() != GEOMImpl_TorusDriver::GetID()) return NULL;
547 GEOMImpl_ITorus aCI (aFunction);
549 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
550 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
552 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
554 aCI.SetCenter(aRefPnt);
555 aCI.SetVector(aRefVec);
556 aCI.SetRMajor(theRMajor);
557 aCI.SetRMinor(theRMinor);
559 //Compute the Torus value
561 if (!GetSolver()->ComputeFunction(aFunction)) {
562 SetErrorCode("Torus driver failed");
566 catch (Standard_Failure) {
567 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
568 SetErrorCode(aFail->GetMessageString());
572 //Make a Python command
573 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorus(" << thePnt
574 << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
581 //=============================================================================
585 //=============================================================================
586 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Object) theBase,
587 Handle(GEOM_Object) theVec,
592 if (theBase.IsNull() || theVec.IsNull()) return NULL;
594 //Add a new Prism object
595 Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
597 //Add a new Prism function for creation a Prism relatively to vector
598 Handle(GEOM_Function) aFunction =
599 aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_VEC_H);
600 if (aFunction.IsNull()) return NULL;
602 //Check if the function is set correctly
603 if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
605 GEOMImpl_IPrism aCI (aFunction);
607 Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
608 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
610 if (aRefBase.IsNull() || aRefVec.IsNull()) return NULL;
612 aCI.SetBase(aRefBase);
613 aCI.SetVector(aRefVec);
616 //Compute the Prism value
618 if (!GetSolver()->ComputeFunction(aFunction)) {
619 SetErrorCode("Prism driver failed");
623 catch (Standard_Failure) {
624 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
625 SetErrorCode(aFail->GetMessageString());
629 //Make a Python command
630 GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH("
631 << theBase << ", " << theVec << ", " << theH << ")";
637 //=============================================================================
641 //=============================================================================
642 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt
643 (Handle(GEOM_Object) theBase,
644 Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
648 if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
650 //Add a new Prism object
651 Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
653 //Add a new Prism function for creation a Prism relatively to two points
654 Handle(GEOM_Function) aFunction =
655 aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_TWO_PNT);
656 if (aFunction.IsNull()) return NULL;
658 //Check if the function is set correctly
659 if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
661 GEOMImpl_IPrism aCI (aFunction);
663 Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
664 Handle(GEOM_Function) aRefPnt1 = thePoint1->GetLastFunction();
665 Handle(GEOM_Function) aRefPnt2 = thePoint2->GetLastFunction();
667 if (aRefBase.IsNull() || aRefPnt1.IsNull() || aRefPnt2.IsNull()) return NULL;
669 aCI.SetBase(aRefBase);
670 aCI.SetFirstPoint(aRefPnt1);
671 aCI.SetLastPoint(aRefPnt2);
673 //Compute the Prism value
675 if (!GetSolver()->ComputeFunction(aFunction)) {
676 SetErrorCode("Prism driver failed");
680 catch (Standard_Failure) {
681 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
682 SetErrorCode(aFail->GetMessageString());
686 //Make a Python command
687 GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism("
688 << theBase << ", " << thePoint1 << ", " << thePoint2 << ")";
695 //=============================================================================
699 //=============================================================================
700 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipe (Handle(GEOM_Object) theBase,
701 Handle(GEOM_Object) thePath)
705 if (theBase.IsNull() || thePath.IsNull()) return NULL;
707 //Add a new Pipe object
708 Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
710 //Add a new Pipe function
711 Handle(GEOM_Function) aFunction =
712 aPipe->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_BASE_PATH);
713 if (aFunction.IsNull()) return NULL;
715 //Check if the function is set correctly
716 if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
718 GEOMImpl_IPipe aCI (aFunction);
720 Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
721 Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
723 if (aRefBase.IsNull() || aRefPath.IsNull()) return NULL;
725 aCI.SetBase(aRefBase);
726 aCI.SetPath(aRefPath);
728 //Compute the Pipe value
730 if (!GetSolver()->ComputeFunction(aFunction)) {
731 SetErrorCode("Pipe driver failed");
735 catch (Standard_Failure) {
736 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
737 SetErrorCode(aFail->GetMessageString());
741 //Make a Python command
742 GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipe("
743 << theBase << ", " << thePath << ")";
750 //=============================================================================
752 * MakeRevolutionAxisAngle
754 //=============================================================================
755 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle(GEOM_Object) theBase,
756 Handle(GEOM_Object) theAxis,
761 if (theBase.IsNull() || theAxis.IsNull()) return NULL;
763 //Add a new Revolution object
764 Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION);
766 //Add a new Revolution function for creation a revolution relatively to axis
767 Handle(GEOM_Function) aFunction =
768 aRevolution->AddFunction(GEOMImpl_RevolutionDriver::GetID(), REVOLUTION_BASE_AXIS_ANGLE);
769 if (aFunction.IsNull()) return NULL;
771 //Check if the function is set correctly
772 if (aFunction->GetDriverGUID() != GEOMImpl_RevolutionDriver::GetID()) return NULL;
774 GEOMImpl_IRevolution aCI (aFunction);
776 Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
777 Handle(GEOM_Function) aRefAxis = theAxis->GetLastFunction();
779 if (aRefBase.IsNull() || aRefAxis.IsNull()) return NULL;
781 aCI.SetBase(aRefBase);
782 aCI.SetAxis(aRefAxis);
783 aCI.SetAngle(theAngle);
785 //Compute the Revolution value
787 if (!GetSolver()->ComputeFunction(aFunction)) {
788 SetErrorCode("Revolution driver failed");
792 catch (Standard_Failure) {
793 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
794 SetErrorCode(aFail->GetMessageString());
798 //Make a Python command
799 GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution("
800 << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
807 //=============================================================================
811 //=============================================================================
812 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Object) theShell)
816 if (theShell.IsNull()) return NULL;
818 //Add a new Solid object
819 Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID);
821 //Add a new Solid function for creation a solid from a shell
822 Handle(GEOM_Function) aFunction =
823 aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL);
824 if (aFunction.IsNull()) return NULL;
826 //Check if the function is set correctly
827 if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
829 GEOMImpl_IShapes aCI (aFunction);
831 Handle(GEOM_Function) aRefShell = theShell->GetLastFunction();
833 if (aRefShell.IsNull()) return NULL;
835 aCI.SetBase(aRefShell);
837 //Compute the Solid value
839 if (!GetSolver()->ComputeFunction(aFunction)) {
840 SetErrorCode("Solid driver failed");
844 catch (Standard_Failure) {
845 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
846 SetErrorCode(aFail->GetMessageString());
850 //Make a Python command
851 GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")";
857 //=============================================================================
861 //=============================================================================
862 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
863 (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
864 double theTol2D, double theTol3D, int theNbIter)
868 if (theShape.IsNull()) return NULL;
870 //Add a new Filling object
871 Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING);
873 //Add a new Filling function for creation a filling from a compound
874 Handle(GEOM_Function) aFunction = aFilling->AddFunction(GEOMImpl_FillingDriver::GetID(), BASIC_FILLING);
875 if (aFunction.IsNull()) return NULL;
877 //Check if the function is set correctly
878 if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL;
880 GEOMImpl_IFilling aFI (aFunction);
882 Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
884 if (aRefShape.IsNull()) return NULL;
886 aFI.SetShape(aRefShape);
887 aFI.SetMinDeg(theMinDeg);
888 aFI.SetMaxDeg(theMaxDeg);
889 aFI.SetTol2D(theTol2D);
890 aFI.SetTol3D(theTol3D);
891 aFI.SetNbIter(theNbIter);
893 //Compute the Solid value
895 if (!GetSolver()->ComputeFunction(aFunction)) {
896 SetErrorCode("Filling driver failed");
900 catch (Standard_Failure) {
901 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
902 if (strcmp(aFail->GetMessageString(), "Geom_BSplineSurface") == 0)
903 SetErrorCode("B-Spline surface construction failed");
905 SetErrorCode(aFail->GetMessageString());
909 //Make a Python command
910 GEOM::TPythonDump(aFunction) << aFilling << " = geompy.MakeFilling("
911 << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", "
912 << theTol2D << ", " << theTol3D << ", " << theNbIter << ")";