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 << ")";
235 //=============================================================================
239 //=============================================================================
240 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface
241 (Handle(GEOM_Object) theSurface, double theUParameter, double theVParameter)
245 if (theSurface.IsNull()) return NULL;
247 //Add a new Point object
248 Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
250 //Add a new Point function for creation a point relativley another point
251 Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(),
254 //Check if the function is set correctly
255 if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
257 GEOMImpl_IPoint aPI (aFunction);
259 Handle(GEOM_Function) aRefFunction = theSurface->GetLastFunction();
260 if (aRefFunction.IsNull()) return NULL;
262 aPI.SetSurface(aRefFunction);
263 aPI.SetParameter(theUParameter);
264 aPI.SetParameter2(theVParameter);
266 //Compute the point value
268 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
271 if (!GetSolver()->ComputeFunction(aFunction)) {
272 SetErrorCode("Point driver failed");
276 catch (Standard_Failure) {
277 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
278 SetErrorCode(aFail->GetMessageString());
282 //Make a Python command
283 GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
284 << theSurface << ", " << theUParameter
285 << ", " << theVParameter << ")";
292 //=============================================================================
294 * MakePointOnLinesIntersection
296 //=============================================================================
297 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
298 (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2)
302 if (theLine1.IsNull() || theLine2.IsNull()) return NULL;
304 //Add a new Point object
305 Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
307 //Add a new Point function for creation a point relativley another point
308 Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION);
310 //Check if the function is set correctly
311 if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
313 GEOMImpl_IPoint aPI (aFunction);
315 Handle(GEOM_Function) aRef1 = theLine1->GetLastFunction();
316 Handle(GEOM_Function) aRef2 = theLine2->GetLastFunction();
317 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
322 //Compute the point value
324 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
327 if (!GetSolver()->ComputeFunction(aFunction)) {
328 SetErrorCode("Point driver failed");
332 catch (Standard_Failure) {
333 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
334 SetErrorCode(aFail->GetMessageString());
338 //Make a Python command
339 GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnLinesIntersection("
340 << theLine1 << ", " << theLine2 << ")";
346 //=============================================================================
350 //=============================================================================
351 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
352 (const Handle(GEOM_Object)& theCurve, double theParameter)
356 if (theCurve.IsNull()) return NULL;
358 //Add a new Vector object
359 Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
361 //Add a new Point function for creation a point relativley another point
362 Handle(GEOM_Function) aFunction = aVec->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TANGENT_CURVE_PAR);
364 //Check if the function is set correctly
365 if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
367 GEOMImpl_IVector aVI (aFunction);
369 Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
370 if (aRefFunction.IsNull()) return NULL;
372 aVI.SetCurve(aRefFunction);
373 aVI.SetParameter(theParameter);
375 //Compute the vector value
377 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
380 if (!GetSolver()->ComputeFunction(aFunction)) {
381 SetErrorCode("Vector driver failed");
385 catch (Standard_Failure) {
386 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
387 SetErrorCode(aFail->GetMessageString());
391 //Make a Python command
392 GEOM::TPythonDump(aFunction) << aVec << " = geompy.MakeTangentOnCurve("
393 << theCurve << ", " << theParameter << ")";
399 //=============================================================================
403 //=============================================================================
404 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ
405 (double theDX, double theDY, double theDZ)
409 //Add a new Vector object
410 Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
412 //Add a new Vector function with DXDYDZ parameters
413 Handle(GEOM_Function) aFunction =
414 aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_DX_DY_DZ);
415 if (aFunction.IsNull()) return NULL;
417 //Check if the function is set correctly
418 if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
420 GEOMImpl_IVector aPI (aFunction);
426 //Compute the Vector value
428 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
431 if (!GetSolver()->ComputeFunction(aFunction)) {
432 SetErrorCode("Vector driver failed");
436 catch (Standard_Failure) {
437 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
438 SetErrorCode(aFail->GetMessageString());
442 //Make a Python command
443 GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVectorDXDYDZ("
444 << theDX << ", " << theDY << ", " << theDZ << ")";
450 //=============================================================================
454 //=============================================================================
455 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt
456 (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2)
460 if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
462 //Add a new Vector object
463 Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
465 //Add a new Vector function
466 Handle(GEOM_Function) aFunction =
467 aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TWO_PNT);
469 //Check if the function is set correctly
470 if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
472 GEOMImpl_IVector aPI (aFunction);
474 Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
475 Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
476 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
478 aPI.SetPoint1(aRef1);
479 aPI.SetPoint2(aRef2);
481 //Compute the Vector value
483 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
486 if (!GetSolver()->ComputeFunction(aFunction)) {
487 SetErrorCode("Vector driver failed");
491 catch (Standard_Failure) {
492 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
493 SetErrorCode(aFail->GetMessageString());
497 //Make a Python command
498 GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVector("
499 << thePnt1 << ", " << thePnt2 << ")";
506 //=============================================================================
510 //=============================================================================
511 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine
512 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theDir)
516 if (thePnt.IsNull() || theDir.IsNull()) return NULL;
518 //Add a new Line object
519 Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
521 //Add a new Line function
522 Handle(GEOM_Function) aFunction =
523 aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_PNT_DIR);
525 //Check if the function is set correctly
526 if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
528 GEOMImpl_ILine aPI (aFunction);
530 Handle(GEOM_Function) aRef1 = thePnt->GetLastFunction();
531 Handle(GEOM_Function) aRef2 = theDir->GetLastFunction();
532 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
534 aPI.SetPoint1(aRef1);
535 aPI.SetPoint2(aRef2);
537 //Compute the Line value
539 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
542 if (!GetSolver()->ComputeFunction(aFunction)) {
543 SetErrorCode("Line driver failed");
547 catch (Standard_Failure) {
548 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
549 SetErrorCode(aFail->GetMessageString());
553 //Make a Python command
554 GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLine("
555 << thePnt << ", " << theDir << ")";
561 //=============================================================================
565 //=============================================================================
566 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
567 (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2)
571 if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
573 //Add a new Line object
574 Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
576 //Add a new Line function
577 Handle(GEOM_Function) aFunction =
578 aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_PNT);
580 //Check if the function is set correctly
581 if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
583 GEOMImpl_ILine aPI (aFunction);
585 Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
586 Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
587 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
589 aPI.SetPoint1(aRef1);
590 aPI.SetPoint2(aRef2);
592 //Compute the Line value
594 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
597 if (!GetSolver()->ComputeFunction(aFunction)) {
598 SetErrorCode("Line driver failed");
602 catch (Standard_Failure) {
603 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
604 SetErrorCode(aFail->GetMessageString());
608 //Make a Python command
609 GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoPnt("
610 << thePnt1 << ", " << thePnt2 << ")";
616 //=============================================================================
620 //=============================================================================
621 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
622 (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2)
626 if (theFace1.IsNull() || theFace2.IsNull()) return NULL;
628 //Add a new Line object
629 Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
631 //Add a new Line function
632 Handle(GEOM_Function) aFunction =
633 aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_FACES);
635 //Check if the function is set correctly
636 if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
638 GEOMImpl_ILine aPI (aFunction);
640 Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction();
641 Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction();
642 if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
647 //Compute the Line value
649 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
652 if (!GetSolver()->ComputeFunction(aFunction)) {
653 SetErrorCode("Line driver failed");
657 catch (Standard_Failure) {
658 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
659 SetErrorCode(aFail->GetMessageString());
663 //Make a Python command
664 GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoFaces("
665 << theFace1 << ", " << theFace2 << ")";
671 //=============================================================================
675 //=============================================================================
676 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt
677 (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2,
678 Handle(GEOM_Object) thePnt3, double theSize)
682 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
684 //Add a new Plane object
685 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
687 //Add a new Plane function
688 Handle(GEOM_Function) aFunction =
689 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_THREE_PNT);
691 //Check if the function is set correctly
692 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
694 GEOMImpl_IPlane aPI (aFunction);
696 Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
697 Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
698 Handle(GEOM_Function) aRef3 = thePnt3->GetLastFunction();
699 if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull()) return NULL;
701 aPI.SetPoint1(aRef1);
702 aPI.SetPoint2(aRef2);
703 aPI.SetPoint3(aRef3);
704 aPI.SetSize(theSize);
706 //Compute the Plane value
708 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
711 if (!GetSolver()->ComputeFunction(aFunction)) {
712 SetErrorCode("Plane driver failed");
716 catch (Standard_Failure) {
717 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
718 SetErrorCode(aFail->GetMessageString());
722 //Make a Python command
723 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneThreePnt("
724 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << theSize << ")";
730 //=============================================================================
734 //=============================================================================
735 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec
736 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
741 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
743 //Add a new Plane object
744 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
746 //Add a new Plane function
747 Handle(GEOM_Function) aFunction =
748 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_PNT_VEC);
750 //Check if the function is set correctly
751 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
753 GEOMImpl_IPlane aPI (aFunction);
755 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
756 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
757 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
759 aPI.SetPoint(aRefPnt);
760 aPI.SetVector(aRefVec);
761 aPI.SetSize(theSize);
763 //Compute the Plane value
765 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
768 if (!GetSolver()->ComputeFunction(aFunction)) {
769 SetErrorCode("Plane driver failed");
773 catch (Standard_Failure) {
774 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
775 SetErrorCode(aFail->GetMessageString());
779 //Make a Python command
780 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlane("
781 << thePnt << ", " << theVec << ", " << theSize << ")";
787 //=============================================================================
791 //=============================================================================
792 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
793 (Handle(GEOM_Object) theFace, double theSize)
797 if (theFace.IsNull()) return NULL;
799 //Add a new Plane object
800 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
802 //Add a new Plane function
803 Handle(GEOM_Function) aFunction =
804 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_FACE);
806 //Check if the function is set correctly
807 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
809 GEOMImpl_IPlane aPI (aFunction);
811 Handle(GEOM_Function) aRef = theFace->GetLastFunction();
812 if (aRef.IsNull()) return NULL;
815 aPI.SetSize(theSize);
817 //Compute the Plane value
819 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
822 if (!GetSolver()->ComputeFunction(aFunction)) {
823 SetErrorCode("Plane driver failed");
827 catch (Standard_Failure) {
828 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
829 SetErrorCode(aFail->GetMessageString());
833 //Make a Python command
834 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneFace("
835 << theFace << ", " << theSize << ")";
842 //=============================================================================
846 //=============================================================================
847 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
848 (double theOX, double theOY, double theOZ,
849 double theXDX, double theXDY, double theXDZ,
850 double theYDX, double theYDY, double theYDZ)
854 //Add a new Marker object
855 Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
857 //Add a new Marker function
858 Handle(GEOM_Function) aFunction =
859 aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_CS);
860 if (aFunction.IsNull()) return NULL;
862 //Check if the function is set correctly
863 if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL;
865 GEOMImpl_IMarker aPI(aFunction);
867 aPI.SetOrigin(theOX, theOY, theOZ);
868 aPI.SetXDir(theXDX, theXDY, theXDZ);
869 aPI.SetYDir(theYDX, theYDY, theYDZ);
871 //Compute the marker value
873 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
876 if (!GetSolver()->ComputeFunction(aFunction)) {
877 SetErrorCode("Marker driver failed");
881 catch (Standard_Failure) {
882 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
883 SetErrorCode(aFail->GetMessageString());
887 //Make a Python command
888 GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarker("
889 << theOX << ", " << theOY << ", " << theOZ << ", "
890 << theXDX << ", " << theXDY << ", " << theXDZ << ", "
891 << theYDX << ", " << theYDY << ", " << theYDZ << ")";
897 //=============================================================================
899 * MakeTangentPlaneOnFace
901 //=============================================================================
903 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
910 if (theFace.IsNull()) return NULL;
912 //Add a new Plane object
913 Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
915 //Add a new Plane function
916 Handle(GEOM_Function) aFunction =
917 aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_TANGENT_FACE);
919 //Check if the function is set correctly
920 if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
922 GEOMImpl_IPlane aPI (aFunction);
924 Handle(GEOM_Function) aRef = theFace->GetLastFunction();
925 if (aRef.IsNull()) return NULL;
928 aPI.SetSize(theSize);
929 aPI.SetParameterU(theParamU);
930 aPI.SetParameterV(theParamV);
932 //Compute the Plane value
934 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
937 if (!GetSolver()->ComputeFunction(aFunction)) {
938 SetErrorCode("Plane driver failed");
942 catch (Standard_Failure) {
943 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
944 SetErrorCode(aFail->GetMessageString());
948 //Make a Python command
949 GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakeTangentPlaneOnFace("
950 << theFace << ", " <<theParamU <<", "<<theParamV <<", "<< theSize << ")";