1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <Standard_Stream.hxx>
22 #include <GEOMImpl_IBasicOperations.hxx>
24 #include "utilities.h"
26 #include <Utils_ExceptHandlers.hxx>
28 #include <TFunction_DriverTable.hxx>
29 #include <TFunction_Driver.hxx>
30 #include <TFunction_Logbook.hxx>
31 #include <TDF_Tool.hxx>
33 #include <GEOM_Function.hxx>
34 #include <GEOM_PythonDump.hxx>
36 #include <GEOMImpl_PointDriver.hxx>
37 #include <GEOMImpl_VectorDriver.hxx>
38 #include <GEOMImpl_LineDriver.hxx>
39 #include <GEOMImpl_PlaneDriver.hxx>
40 #include <GEOMImpl_MarkerDriver.hxx>
42 #include <GEOMImpl_IPoint.hxx>
43 #include <GEOMImpl_IVector.hxx>
44 #include <GEOMImpl_ILine.hxx>
45 #include <GEOMImpl_IPlane.hxx>
46 #include <GEOMImpl_IMarker.hxx>
48 #include <GEOMImpl_Types.hxx>
50 #include <Standard_Failure.hxx>
51 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
53 //=============================================================================
57 //=============================================================================
58 GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations(GEOM_Engine* theEngine, int theDocID)
59 : GEOM_IOperations(theEngine, theDocID)
61 MESSAGE("GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations");
64 //=============================================================================
68 //=============================================================================
69 GEOMImpl_IBasicOperations::~GEOMImpl_IBasicOperations()
71 MESSAGE("GEOMImpl_IBasicOperations::~GEOMImpl_IBasicOperations");
75 //=============================================================================
79 //=============================================================================
80 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ
81 (double theX, double theY, double theZ)
85 //Add a new Point object
86 Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
88 //Add a new Point function with XYZ parameters
89 Handle(GEOM_Function) aFunction =
90 aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ);
91 if (aFunction.IsNull()) return NULL;
93 //Check if the function is set correctly
94 if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
96 GEOMImpl_IPoint aPI(aFunction);
102 //Compute the point value
104 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
107 if (!GetSolver()->ComputeFunction(aFunction)) {
108 SetErrorCode("Point driver failed");
112 catch (Standard_Failure) {
113 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
114 SetErrorCode(aFail->GetMessageString());
118 //Make a Python command
119 GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertex("
120 << theX << ", " << theY << ", " << theZ << ")";
126 //=============================================================================
128 * MakePointWithReference
130 //=============================================================================
131 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
132 (Handle(GEOM_Object) theReference, double theX, double theY, double theZ)
136 if (theReference.IsNull()) return NULL;
138 //Add a new Point object
139 Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
141 //Add a new Point function for creation a point relativley another point
142 Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ_REF);
144 //Check if the function is set correctly
145 if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
147 GEOMImpl_IPoint aPI(aFunction);
149 Handle(GEOM_Function) aRefFunction = theReference->GetLastFunction();
150 if (aRefFunction.IsNull()) return NULL;
152 aPI.SetRef(aRefFunction);
157 //Compute the point value
159 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
162 if (!GetSolver()->ComputeFunction(aFunction)) {
163 SetErrorCode("Point driver failed");
167 catch (Standard_Failure) {
168 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
169 SetErrorCode(aFail->GetMessageString());
173 //Make a Python command
174 GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexWithRef("
175 << theReference << ", " << theX << ", " << theY << ", " << theZ << ")";
181 //=============================================================================
185 //=============================================================================
186 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
187 (Handle(GEOM_Object) theCurve, double theParameter)
191 if (theCurve.IsNull()) return NULL;
193 //Add a new Point object
194 Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
196 //Add a new Point function for creation a point relativley another point
197 Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_CURVE_PAR);
199 //Check if the function is set correctly
200 if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
202 GEOMImpl_IPoint aPI (aFunction);
204 Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
205 if (aRefFunction.IsNull()) return NULL;
207 aPI.SetCurve(aRefFunction);
208 aPI.SetParameter(theParameter);
210 //Compute the point value
212 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
215 if (!GetSolver()->ComputeFunction(aFunction)) {
216 SetErrorCode("Point driver failed");
220 catch (Standard_Failure) {
221 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
222 SetErrorCode(aFail->GetMessageString());
226 //Make a Python command
227 GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
228 << theCurve << ", " << theParameter << ")";
234 //=============================================================================
236 * MakePointOnLinesIntersection
238 //=============================================================================
239 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
240 (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2)
244 if (theLine1.IsNull() || theLine2.IsNull()) return NULL;
246 //Add a new Point object
247 Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
249 //Add a new Point function for creation a point relativley another point
250 Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION);
252 //Check if the function is set correctly
253 if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
255 GEOMImpl_IPoint aPI (aFunction);
257 Handle(GEOM_Function) aRef1 = theLine1->GetLastFunction();
258 Handle(GEOM_Function) aRef2 = theLine2->GetLastFunction();
259 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
264 //Compute the point value
266 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
269 if (!GetSolver()->ComputeFunction(aFunction)) {
270 SetErrorCode("Point driver failed");
274 catch (Standard_Failure) {
275 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
276 SetErrorCode(aFail->GetMessageString());
280 //Make a Python command
281 GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnLinesIntersection("
282 << theLine1 << ", " << theLine2 << ")";
288 //=============================================================================
292 //=============================================================================
293 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
294 (const Handle(GEOM_Object)& theCurve, double theParameter)
298 if (theCurve.IsNull()) return NULL;
300 //Add a new Vector object
301 Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
303 //Add a new Point function for creation a point relativley another point
304 Handle(GEOM_Function) aFunction = aVec->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TANGENT_CURVE_PAR);
306 //Check if the function is set correctly
307 if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
309 GEOMImpl_IVector aVI (aFunction);
311 Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
312 if (aRefFunction.IsNull()) return NULL;
314 aVI.SetCurve(aRefFunction);
315 aVI.SetParameter(theParameter);
317 //Compute the vector value
319 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
322 if (!GetSolver()->ComputeFunction(aFunction)) {
323 SetErrorCode("Vector driver failed");
327 catch (Standard_Failure) {
328 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
329 SetErrorCode(aFail->GetMessageString());
333 //Make a Python command
334 GEOM::TPythonDump(aFunction) << aVec << " = geompy.MakeTangentOnCurve("
335 << theCurve << ", " << theParameter << ")";
341 //=============================================================================
345 //=============================================================================
346 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ
347 (double theDX, double theDY, double theDZ)
351 //Add a new Vector object
352 Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
354 //Add a new Vector function with DXDYDZ parameters
355 Handle(GEOM_Function) aFunction =
356 aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_DX_DY_DZ);
357 if (aFunction.IsNull()) return NULL;
359 //Check if the function is set correctly
360 if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
362 GEOMImpl_IVector aPI (aFunction);
368 //Compute the Vector value
370 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
373 if (!GetSolver()->ComputeFunction(aFunction)) {
374 SetErrorCode("Vector driver failed");
378 catch (Standard_Failure) {
379 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
380 SetErrorCode(aFail->GetMessageString());
384 //Make a Python command
385 GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVectorDXDYDZ("
386 << theDX << ", " << theDY << ", " << theDZ << ")";
392 //=============================================================================
396 //=============================================================================
397 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt
398 (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2)
402 if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
404 //Add a new Vector object
405 Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
407 //Add a new Vector function
408 Handle(GEOM_Function) aFunction =
409 aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TWO_PNT);
411 //Check if the function is set correctly
412 if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
414 GEOMImpl_IVector aPI (aFunction);
416 Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
417 Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
418 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
420 aPI.SetPoint1(aRef1);
421 aPI.SetPoint2(aRef2);
423 //Compute the Vector value
425 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
428 if (!GetSolver()->ComputeFunction(aFunction)) {
429 SetErrorCode("Vector driver failed");
433 catch (Standard_Failure) {
434 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
435 SetErrorCode(aFail->GetMessageString());
439 //Make a Python command
440 GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVector("
441 << thePnt1 << ", " << thePnt2 << ")";
448 //=============================================================================
452 //=============================================================================
453 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine
454 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theDir)
458 if (thePnt.IsNull() || theDir.IsNull()) return NULL;
460 //Add a new Line object
461 Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
463 //Add a new Line function
464 Handle(GEOM_Function) aFunction =
465 aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_PNT_DIR);
467 //Check if the function is set correctly
468 if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
470 GEOMImpl_ILine aPI (aFunction);
472 Handle(GEOM_Function) aRef1 = thePnt->GetLastFunction();
473 Handle(GEOM_Function) aRef2 = theDir->GetLastFunction();
474 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
476 aPI.SetPoint1(aRef1);
477 aPI.SetPoint2(aRef2);
479 //Compute the Line value
481 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
484 if (!GetSolver()->ComputeFunction(aFunction)) {
485 SetErrorCode("Line driver failed");
489 catch (Standard_Failure) {
490 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
491 SetErrorCode(aFail->GetMessageString());
495 //Make a Python command
496 GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLine("
497 << thePnt << ", " << theDir << ")";
503 //=============================================================================
507 //=============================================================================
508 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
509 (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2)
513 if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
515 //Add a new Line object
516 Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
518 //Add a new Line function
519 Handle(GEOM_Function) aFunction =
520 aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_PNT);
522 //Check if the function is set correctly
523 if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
525 GEOMImpl_ILine aPI (aFunction);
527 Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
528 Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
529 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
531 aPI.SetPoint1(aRef1);
532 aPI.SetPoint2(aRef2);
534 //Compute the Line value
536 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
539 if (!GetSolver()->ComputeFunction(aFunction)) {
540 SetErrorCode("Line driver failed");
544 catch (Standard_Failure) {
545 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
546 SetErrorCode(aFail->GetMessageString());
550 //Make a Python command
551 GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoPnt("
552 << thePnt1 << ", " << thePnt2 << ")";
558 //=============================================================================
562 //=============================================================================
563 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
564 (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2)
568 if (theFace1.IsNull() || theFace2.IsNull()) return NULL;
570 //Add a new Line object
571 Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
573 //Add a new Line function
574 Handle(GEOM_Function) aFunction =
575 aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_FACES);
577 //Check if the function is set correctly
578 if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
580 GEOMImpl_ILine aPI (aFunction);
582 Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction();
583 Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction();
584 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
589 //Compute the Line value
591 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
594 if (!GetSolver()->ComputeFunction(aFunction)) {
595 SetErrorCode("Line driver failed");
599 catch (Standard_Failure) {
600 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
601 SetErrorCode(aFail->GetMessageString());
605 //Make a Python command
606 GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoFaces("
607 << theFace1 << ", " << theFace2 << ")";
613 //=============================================================================
617 //=============================================================================
618 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt
619 (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2,
620 Handle(GEOM_Object) thePnt3, double theSize)
624 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
626 //Add a new Plane object
627 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
629 //Add a new Plane function
630 Handle(GEOM_Function) aFunction =
631 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_THREE_PNT);
633 //Check if the function is set correctly
634 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
636 GEOMImpl_IPlane aPI (aFunction);
638 Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
639 Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
640 Handle(GEOM_Function) aRef3 = thePnt3->GetLastFunction();
641 if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull()) return NULL;
643 aPI.SetPoint1(aRef1);
644 aPI.SetPoint2(aRef2);
645 aPI.SetPoint3(aRef3);
646 aPI.SetSize(theSize);
648 //Compute the Plane value
650 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
653 if (!GetSolver()->ComputeFunction(aFunction)) {
654 SetErrorCode("Plane driver failed");
658 catch (Standard_Failure) {
659 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
660 SetErrorCode(aFail->GetMessageString());
664 //Make a Python command
665 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneThreePnt("
666 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << theSize << ")";
672 //=============================================================================
676 //=============================================================================
677 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec
678 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
683 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
685 //Add a new Plane object
686 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
688 //Add a new Plane function
689 Handle(GEOM_Function) aFunction =
690 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_PNT_VEC);
692 //Check if the function is set correctly
693 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
695 GEOMImpl_IPlane aPI (aFunction);
697 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
698 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
699 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
701 aPI.SetPoint(aRefPnt);
702 aPI.SetVector(aRefVec);
703 aPI.SetSize(theSize);
705 //Compute the Plane value
707 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
710 if (!GetSolver()->ComputeFunction(aFunction)) {
711 SetErrorCode("Plane driver failed");
715 catch (Standard_Failure) {
716 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
717 SetErrorCode(aFail->GetMessageString());
721 //Make a Python command
722 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlane("
723 << thePnt << ", " << theVec << ", " << theSize << ")";
729 //=============================================================================
733 //=============================================================================
734 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
735 (Handle(GEOM_Object) theFace, double theSize)
739 if (theFace.IsNull()) return NULL;
741 //Add a new Plane object
742 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
744 //Add a new Plane function
745 Handle(GEOM_Function) aFunction =
746 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_FACE);
748 //Check if the function is set correctly
749 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
751 GEOMImpl_IPlane aPI (aFunction);
753 Handle(GEOM_Function) aRef = theFace->GetLastFunction();
754 if (aRef.IsNull()) return NULL;
757 aPI.SetSize(theSize);
759 //Compute the Plane value
761 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
764 if (!GetSolver()->ComputeFunction(aFunction)) {
765 SetErrorCode("Plane driver failed");
769 catch (Standard_Failure) {
770 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
771 SetErrorCode(aFail->GetMessageString());
775 //Make a Python command
776 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneFace("
777 << theFace << ", " << theSize << ")";
784 //=============================================================================
788 //=============================================================================
789 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
790 (double theOX, double theOY, double theOZ,
791 double theXDX, double theXDY, double theXDZ,
792 double theYDX, double theYDY, double theYDZ)
796 //Add a new Marker object
797 Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
799 //Add a new Marker function
800 Handle(GEOM_Function) aFunction =
801 aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_CS);
802 if (aFunction.IsNull()) return NULL;
804 //Check if the function is set correctly
805 if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL;
807 GEOMImpl_IMarker aPI(aFunction);
809 aPI.SetOrigin(theOX, theOY, theOZ);
810 aPI.SetXDir(theXDX, theXDY, theXDZ);
811 aPI.SetYDir(theYDX, theYDY, theYDZ);
813 //Compute the marker value
815 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
818 if (!GetSolver()->ComputeFunction(aFunction)) {
819 SetErrorCode("Marker driver failed");
823 catch (Standard_Failure) {
824 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
825 SetErrorCode(aFail->GetMessageString());
829 //Make a Python command
830 GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarker("
831 << theOX << ", " << theOY << ", " << theOZ << ", "
832 << theXDX << ", " << theXDY << ", " << theXDZ << ", "
833 << theYDX << ", " << theYDY << ", " << theYDZ << ")";
839 //=============================================================================
841 * MakeTangentPlaneOnFace
843 //=============================================================================
845 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
852 if (theFace.IsNull()) return NULL;
854 //Add a new Plane object
855 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
857 //Add a new Plane function
858 Handle(GEOM_Function) aFunction =
859 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_TANGENT_FACE);
861 //Check if the function is set correctly
862 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
864 GEOMImpl_IPlane aPI (aFunction);
866 Handle(GEOM_Function) aRef = theFace->GetLastFunction();
867 if (aRef.IsNull()) return NULL;
870 aPI.SetSize(theSize);
871 aPI.SetParameterU(theParamU);
872 aPI.SetParameterV(theParamV);
874 //Compute the Plane value
876 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
879 if (!GetSolver()->ComputeFunction(aFunction)) {
880 SetErrorCode("Plane driver failed");
884 catch (Standard_Failure) {
885 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
886 SetErrorCode(aFail->GetMessageString());
890 //Make a Python command
891 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakeTangentPlaneOnFace("
892 << theFace << ", " <<theParamU <<", "<<theParamV <<", "<< theSize << ")";