1 // Copyright (C) 2007-2016 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 <GEOMImpl_ITransformOperations.hxx>
27 #include <GEOMImpl_TranslateDriver.hxx>
28 #include <GEOMImpl_MirrorDriver.hxx>
29 #include <GEOMImpl_ProjectionDriver.hxx>
30 #include <GEOMImpl_OffsetDriver.hxx>
31 #include <GEOMImpl_ScaleDriver.hxx>
32 #include <GEOMImpl_RotateDriver.hxx>
33 #include <GEOMImpl_PositionDriver.hxx>
35 #include <GEOMImpl_ITranslate.hxx>
36 #include <GEOMImpl_IMirror.hxx>
37 #include <GEOMImpl_IProjection.hxx>
38 #include <GEOMImpl_IProjOnCyl.hxx>
39 #include <GEOMImpl_IOffset.hxx>
40 #include <GEOMImpl_IScale.hxx>
41 #include <GEOMImpl_IRotate.hxx>
42 #include <GEOMImpl_IPosition.hxx>
44 #include <GEOMImpl_Types.hxx>
46 #include <GEOM_Function.hxx>
47 #include <GEOM_PythonDump.hxx>
49 #include "utilities.h"
51 #include <Utils_ExceptHandlers.hxx>
53 #include <TFunction_DriverTable.hxx>
54 #include <TFunction_Driver.hxx>
55 #include <TDF_Tool.hxx>
57 #include <BRep_Tool.hxx>
58 #include <BRep_Builder.hxx>
61 #include <TopoDS_Edge.hxx>
62 #include <TopoDS_Vertex.hxx>
63 #include <TopoDS_Compound.hxx>
66 #include <gp_Trsf.hxx>
68 #include <StdFail_NotDone.hxx>
69 #include <Standard_Failure.hxx>
70 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
72 //=============================================================================
76 //=============================================================================
78 GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine, int theDocID)
79 : GEOM_IOperations(theEngine, theDocID)
81 MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations");
84 //=============================================================================
88 //=============================================================================
90 GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations()
92 MESSAGE("GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations");
96 //=============================================================================
100 //=============================================================================
101 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
102 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
106 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
108 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
109 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
111 // Get last functions of the arguments
112 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
113 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
115 //Add a translate function
116 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS);
118 if (aFunction.IsNull()) return NULL;
120 //Check if the function is set correctly
121 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
123 GEOMImpl_ITranslate aTI (aFunction);
126 aTI.SetOriginal(aLastFunction);
128 //Compute the translation
131 if (!GetSolver()->ComputeFunction(aFunction)) {
132 SetErrorCode("Translation driver failed");
136 catch (Standard_Failure& aFail) {
137 SetErrorCode(aFail.GetMessageString());
141 //Make a Python command
142 GEOM::TPythonDump(aFunction) << "geompy.TranslateTwoPoints("
143 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
149 //=============================================================================
153 //=============================================================================
154 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
155 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
159 if (theObject.IsNull()) return NULL;
161 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
162 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
164 //Add a translate function
165 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ);
167 if (aFunction.IsNull()) return NULL;
169 //Check if the function is set correctly
170 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
172 GEOMImpl_ITranslate aTI(aFunction);
176 aTI.SetOriginal(aLastFunction);
178 //Compute the translation
181 if (!GetSolver()->ComputeFunction(aFunction)) {
182 SetErrorCode("Translation driver failed");
186 catch (Standard_Failure& aFail) {
187 SetErrorCode(aFail.GetMessageString());
191 //Make a Python command
192 GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ("
193 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
200 //=============================================================================
202 * TranslateTwoPointsCopy
204 //=============================================================================
205 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
206 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
210 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
212 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
213 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
215 //Add a new Copy object
216 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
218 //Add a translate function
219 Handle(GEOM_Function) aFunction =
220 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS_COPY);
222 //Check if the function is set correctly
223 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
225 GEOMImpl_ITranslate aTI(aFunction);
226 aTI.SetPoint1(thePoint1->GetLastFunction());
227 aTI.SetPoint2(thePoint2->GetLastFunction());
228 //aTI.SetShape(theObject->GetValue());
229 aTI.SetOriginal(aLastFunction);
231 //Compute the translation
234 if (!GetSolver()->ComputeFunction(aFunction)) {
235 SetErrorCode("Translation driver failed");
239 catch (Standard_Failure& aFail) {
240 SetErrorCode(aFail.GetMessageString());
244 //Make a Python command
245 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints("
246 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
252 //=============================================================================
254 * TranslateDXDYDZCopy
256 //=============================================================================
257 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
258 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
262 if (theObject.IsNull()) return NULL;
264 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
265 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
267 //Add a new Copy object
268 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
270 //Add a translate function
271 Handle(GEOM_Function) aFunction =
272 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ_COPY);
274 //Check if the function is set correctly
275 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
277 GEOMImpl_ITranslate aTI(aFunction);
281 aTI.SetOriginal(aLastFunction);
283 //Compute the translation
286 if (!GetSolver()->ComputeFunction(aFunction)) {
287 SetErrorCode("Translation driver failed");
291 catch (Standard_Failure& aFail) {
292 SetErrorCode(aFail.GetMessageString());
296 //Make a Python command
297 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation("
298 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
305 //=============================================================================
309 //=============================================================================
310 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
311 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
315 if (theObject.IsNull() || theVector.IsNull()) return NULL;
317 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
318 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
320 // Get last functions of the arguments
321 Handle(GEOM_Function) aVF = theVector->GetLastFunction();
323 //Add a translate function
324 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR);
326 if (aFunction.IsNull()) return NULL;
328 //Check if the function is set correctly
329 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
331 GEOMImpl_ITranslate aTI (aFunction);
333 aTI.SetOriginal(aLastFunction);
335 //Compute the translation
338 if (!GetSolver()->ComputeFunction(aFunction)) {
339 SetErrorCode("Translation driver failed");
343 catch (Standard_Failure& aFail) {
344 SetErrorCode(aFail.GetMessageString());
348 //Make a Python command
349 GEOM::TPythonDump(aFunction) << "geompy.TranslateVector("
350 << theObject << ", " << theVector << ")";
355 //=============================================================================
357 * TranslateVectorCopy
359 //=============================================================================
360 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
361 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
365 if (theObject.IsNull() || theVector.IsNull()) return NULL;
367 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
368 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
370 //Add a new Copy object
371 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
373 //Add a translate function
374 Handle(GEOM_Function) aFunction =
375 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_COPY);
377 //Check if the function is set correctly
378 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
380 GEOMImpl_ITranslate aTI(aFunction);
381 aTI.SetVector(theVector->GetLastFunction());
382 // aTI.SetShape(theObject->GetValue());
383 aTI.SetOriginal(aLastFunction);
385 //Compute the translation
388 if (!GetSolver()->ComputeFunction(aFunction)) {
389 SetErrorCode("Translation driver failed");
393 catch (Standard_Failure& aFail) {
394 SetErrorCode(aFail.GetMessageString());
398 //Make a Python command
399 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector("
400 << theObject << ", " << theVector << ")";
406 //=============================================================================
408 * TranslateVectorDistance
410 //=============================================================================
411 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance
412 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theDistance, bool theCopy)
416 if (theObject.IsNull() || theVector.IsNull()) return NULL;
418 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
419 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
421 Handle(GEOM_Object) aCopy; //Add a new Copy object
422 Handle(GEOM_Function) aFunction;
424 //Add a translate function
426 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
427 aFunction = aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
430 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
432 if (aFunction.IsNull()) return NULL;
434 //Check if the function is set correctly
435 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
437 GEOMImpl_ITranslate aTI(aFunction);
438 aTI.SetVector(theVector->GetLastFunction());
439 aTI.SetDistance(theDistance);
440 // aTI.SetShape(theObject->GetValue());
441 aTI.SetOriginal(aLastFunction);
443 //Compute the translation
446 if (!GetSolver()->ComputeFunction(aFunction)) {
447 SetErrorCode("Translation driver failed");
451 catch (Standard_Failure& aFail) {
452 SetErrorCode(aFail.GetMessageString());
456 //Make a Python command
458 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVectorDistance("
459 << theObject << ", " << theVector << ", " << theDistance << ")";
464 GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance("
465 << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")";
470 //=============================================================================
474 //=============================================================================
475 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
476 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector,
477 double theStep, Standard_Integer theNbTimes)
481 if (theObject.IsNull()) return NULL;
483 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
484 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
486 //Add a new Copy object
487 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
489 //Add a translate function
490 Handle(GEOM_Function) aFunction =
491 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_1D);
493 //Check if the function is set correctly
494 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
496 GEOMImpl_ITranslate aTI (aFunction);
497 aTI.SetOriginal(aLastFunction);
498 if (!theVector.IsNull())
499 aTI.SetVector(theVector->GetLastFunction());
500 aTI.SetStep1(theStep);
501 aTI.SetNbIter1(theNbTimes);
503 //Compute the translation
506 if (!GetSolver()->ComputeFunction(aFunction)) {
507 SetErrorCode("Translation driver failed");
511 catch (Standard_Failure& aFail) {
512 SetErrorCode(aFail.GetMessageString());
516 //Make a Python command
517 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D("
518 << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")";
524 //=============================================================================
528 //=============================================================================
529 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject,
530 Handle(GEOM_Object) theVector,
532 Standard_Integer theNbTimes1,
533 Handle(GEOM_Object) theVector2,
535 Standard_Integer theNbTimes2)
539 if (theObject.IsNull()) return NULL;
541 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
542 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
544 //Add a new Copy object
545 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
547 //Add a translate function
548 Handle(GEOM_Function) aFunction =
549 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_2D);
551 //Check if the function is set correctly
552 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
554 GEOMImpl_ITranslate aTI (aFunction);
555 aTI.SetOriginal(aLastFunction);
556 if (!theVector.IsNull())
557 aTI.SetVector(theVector->GetLastFunction());
558 aTI.SetStep1(theStep1);
559 aTI.SetNbIter1(theNbTimes1);
560 if (!theVector2.IsNull())
561 aTI.SetVector2(theVector2->GetLastFunction());
562 aTI.SetStep2(theStep2);
563 aTI.SetNbIter2(theNbTimes2);
565 //Compute the translation
568 if (!GetSolver()->ComputeFunction(aFunction)) {
569 SetErrorCode("Translation driver failed");
573 catch (Standard_Failure& aFail) {
574 SetErrorCode(aFail.GetMessageString());
578 //Make a Python command
579 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D("
580 << theObject << ", " << theVector << ", " << theStep1 << ", " << theNbTimes1
581 << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")";
587 //=============================================================================
591 //=============================================================================
593 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape1D (const TopoDS_Shape& theShape,
594 GEOMImpl_ITranslate* theTI)
599 Handle(GEOM_Function) aVector = theTI->GetVector();
600 if (aVector.IsNull()) {
601 StdFail_NotDone::Raise("Invalid object is given for vector argument");
603 TopoDS_Shape aV = aVector->GetValue();
604 if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) {
605 StdFail_NotDone::Raise("Invalid object is given for vector argument");
607 TopoDS_Edge anEdge = TopoDS::Edge(aV);
609 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
610 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
611 if (aP1.Distance(aP2) < gp::Resolution()) {
612 StdFail_NotDone::Raise("Invalid object is given for vector argument");
616 Standard_Real step = theTI->GetStep1();
617 Standard_Integer nbtimes = theTI->GetNbIter1();
619 // Make multi-translation
622 TopoDS_Compound aCompound;
624 B.MakeCompound(aCompound);
626 gp_Vec Vec (aP1, aP2);
629 TopLoc_Location aLocOrig = theShape.Location();
630 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
632 for (int i = 0; i < nbtimes; i++) {
633 aVec = Vec * (i * step);
634 aTrsf.SetTranslation(aVec);
635 //NPAL18620: performance problem: multiple locations are accumulated
636 // in shape and need a great time to process
637 //BRepBuilderAPI_Transform aTransformation(theShape, aTrsf, Standard_False);
638 //B.Add(aCompound, aTransformation.Shape());
639 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
640 B.Add(aCompound, theShape.Located(aLocRes));
648 //=============================================================================
652 //=============================================================================
654 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape2D (const TopoDS_Shape& theShape,
655 GEOMImpl_ITranslate* theTI)
660 Handle(GEOM_Function) aVector1 = theTI->GetVector();
661 Handle(GEOM_Function) aVector2 = theTI->GetVector2();
663 if (aVector1.IsNull() || aVector2.IsNull()) {
664 StdFail_NotDone::Raise("Invalid object is given for vector argument");
667 TopoDS_Shape aV1 = aVector1->GetValue();
668 TopoDS_Shape aV2 = aVector2->GetValue();
670 if (aV1.IsNull() || aV1.ShapeType() != TopAbs_EDGE ||
671 aV2.IsNull() || aV2.ShapeType() != TopAbs_EDGE) {
672 StdFail_NotDone::Raise("Invalid object is given for vector argument");
675 TopoDS_Edge anEdge1 = TopoDS::Edge(aV1);
676 TopoDS_Edge anEdge2 = TopoDS::Edge(aV2);
678 gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1));
679 gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge1));
680 gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2));
681 gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge2));
683 if (aP11.Distance(aP12) < gp::Resolution() ||
684 aP21.Distance(aP22) < gp::Resolution()) {
685 StdFail_NotDone::Raise("Invalid object is given for vector argument");
688 gp_Vec Vec1 (aP11, aP12);
689 gp_Vec Vec2 (aP21, aP22);
695 Standard_Real step1 = theTI->GetStep1(), step2 = theTI->GetStep2();
696 Standard_Integer nbtimes1 = theTI->GetNbIter1(), nbtimes2 = theTI->GetNbIter2();
698 // Make multi-translation
701 Standard_Real DX, DY, DZ;
702 TopoDS_Compound aCompound;
704 B.MakeCompound(aCompound);
706 TopLoc_Location aLocOrig = theShape.Location();
707 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
709 for (int i = 0; i < nbtimes1; i++) {
710 for (int j = 0; j < nbtimes2; j++) {
711 DX = i * step1 * Vec1.X() + j * step2 * Vec2.X();
712 DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y();
713 DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z();
714 aVec.SetCoord(DX, DY, DZ);
715 aTrsf.SetTranslation(aVec);
716 //NPAL18620: performance problem: multiple locations are accumulated
717 // in shape and need a great time to process
718 //BRepBuilderAPI_Transform aBRepTransformation(theShape, aTrsf, Standard_False);
719 //B.Add(aCompound, aBRepTransformation.Shape());
720 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
721 B.Add(aCompound, theShape.Located(aLocRes));
730 //=============================================================================
734 //=============================================================================
735 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
736 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
740 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
742 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
743 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
745 // Get last functions of the arguments
746 Handle(GEOM_Function) aPF = thePlane->GetLastFunction();
748 //Add a mirror function
749 Handle(GEOM_Function) aFunction =
750 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE);
751 if (aFunction.IsNull()) return NULL;
753 //Check if the function is set correctly
754 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
756 GEOMImpl_IMirror aTI (aFunction);
758 aTI.SetOriginal(aLastFunction);
763 if (!GetSolver()->ComputeFunction(aFunction)) {
764 SetErrorCode("Mirror driver failed");
768 catch (Standard_Failure& aFail) {
769 SetErrorCode(aFail.GetMessageString());
773 //Make a Python command
774 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPlane("
775 << theObject << ", " << thePlane << ")";
781 //=============================================================================
785 //=============================================================================
786 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
787 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
791 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
793 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
794 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
796 //Add a new Copy object
797 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
799 //Add a mirror function
800 Handle(GEOM_Function) aFunction =
801 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE_COPY);
803 //Check if the function is set correctly
804 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
806 GEOMImpl_IMirror aTI (aFunction);
807 aTI.SetPlane(thePlane->GetLastFunction());
808 aTI.SetOriginal(aLastFunction);
813 if (!GetSolver()->ComputeFunction(aFunction)) {
814 SetErrorCode("Mirror driver failed");
818 catch (Standard_Failure& aFail) {
819 SetErrorCode(aFail.GetMessageString());
823 //Make a Python command
824 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane("
825 << theObject << ", " << thePlane << ")";
831 //=============================================================================
835 //=============================================================================
836 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
837 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
841 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
843 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
844 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
846 // Get last functions of the arguments
847 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
849 //Add a mirror function
850 Handle(GEOM_Function) aFunction =
851 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT);
852 if (aFunction.IsNull()) return NULL;
854 //Check if the function is set correctly
855 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
857 GEOMImpl_IMirror aTI (aFunction);
859 aTI.SetOriginal(aLastFunction);
864 if (!GetSolver()->ComputeFunction(aFunction)) {
865 SetErrorCode("Mirror driver failed");
869 catch (Standard_Failure& aFail) {
870 SetErrorCode(aFail.GetMessageString());
874 //Make a Python command
875 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPoint("
876 << theObject << ", " << thePoint << ")";
882 //=============================================================================
886 //=============================================================================
887 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
888 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
892 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
894 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
895 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
897 //Add a new Copy object
898 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
900 //Add a mirror function
901 Handle(GEOM_Function) aFunction =
902 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT_COPY);
904 //Check if the function is set correctly
905 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
907 GEOMImpl_IMirror aTI (aFunction);
908 aTI.SetPoint(thePoint->GetLastFunction());
909 aTI.SetOriginal(aLastFunction);
914 if (!GetSolver()->ComputeFunction(aFunction)) {
915 SetErrorCode("Mirror driver failed");
919 catch (Standard_Failure& aFail) {
920 SetErrorCode(aFail.GetMessageString());
924 //Make a Python command
925 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint("
926 << theObject << ", " << thePoint << ")";
932 //=============================================================================
936 //=============================================================================
937 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
938 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
942 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
944 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
945 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
947 // Get last functions of the arguments
948 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
950 //Add a mirror function
951 Handle(GEOM_Function) aFunction =
952 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS);
953 if (aFunction.IsNull()) return NULL;
955 //Check if the function is set correctly
956 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
958 GEOMImpl_IMirror aTI (aFunction);
960 aTI.SetOriginal(aLastFunction);
965 if (!GetSolver()->ComputeFunction(aFunction)) {
966 SetErrorCode("Mirror driver failed");
970 catch (Standard_Failure& aFail) {
971 SetErrorCode(aFail.GetMessageString());
975 //Make a Python command
976 GEOM::TPythonDump(aFunction) << "geompy.MirrorByAxis("
977 << theObject << ", " << theAxis << ")";
983 //=============================================================================
987 //=============================================================================
988 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
989 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
993 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
995 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
996 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
998 //Add a new Copy object
999 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1001 //Add a mirror function
1002 Handle(GEOM_Function) aFunction =
1003 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS_COPY);
1005 //Check if the function is set correctly
1006 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
1008 GEOMImpl_IMirror aTI (aFunction);
1009 aTI.SetAxis(theAxis->GetLastFunction());
1010 aTI.SetOriginal(aLastFunction);
1012 //Compute the mirror
1015 if (!GetSolver()->ComputeFunction(aFunction)) {
1016 SetErrorCode("Mirror driver failed");
1020 catch (Standard_Failure& aFail) {
1021 SetErrorCode(aFail.GetMessageString());
1025 //Make a Python command
1026 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis("
1027 << theObject << ", " << theAxis << ")";
1034 //=============================================================================
1038 //=============================================================================
1040 GEOMImpl_ITransformOperations::OffsetShape (Handle(GEOM_Object) theObject,
1042 bool theJoinByPipes)
1046 if (theObject.IsNull()) return NULL;
1048 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1049 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1051 //Add a new Offset function
1052 Handle(GEOM_Function) aFunction =
1053 theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE);
1054 if (aFunction.IsNull()) return NULL;
1056 //Check if the function is set correctly
1057 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1059 GEOMImpl_IOffset aTI (aFunction);
1060 aTI.SetShape( anOriginal );
1061 aTI.SetValue( theOffset );
1062 aTI.SetJoinByPipes( theJoinByPipes );
1064 //Compute the offset
1067 if (!GetSolver()->ComputeFunction(aFunction)) {
1068 SetErrorCode("Offset driver failed");
1072 catch (Standard_Failure& aFail) {
1073 SetErrorCode(aFail.GetMessageString());
1077 //Make a Python command
1078 GEOM::TPythonDump(aFunction) << "geompy.Offset("
1079 << theObject << ", " << theOffset << ")";
1085 //=============================================================================
1089 //=============================================================================
1091 GEOMImpl_ITransformOperations::OffsetShapeCopy( Handle(GEOM_Object) theObject,
1093 bool theJoinByPipes)
1097 if (theObject.IsNull()) return NULL;
1099 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1100 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1102 //Add a new Copy object
1103 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1105 //Add a new Offset function
1106 Handle(GEOM_Function) aFunction =
1107 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
1108 if (aFunction.IsNull()) return NULL;
1110 //Check if the function is set correctly
1111 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1113 GEOMImpl_IOffset aTI (aFunction);
1114 aTI.SetShape( anOriginal );
1115 aTI.SetValue( theOffset );
1116 aTI.SetJoinByPipes( theJoinByPipes );
1118 //Compute the offset
1121 if (!GetSolver()->ComputeFunction(aFunction)) {
1122 SetErrorCode("Offset driver failed");
1126 catch (Standard_Failure& aFail) {
1127 SetErrorCode(aFail.GetMessageString());
1131 //Make a Python command
1132 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
1133 << theObject << ", " << theOffset << ")";
1140 //=============================================================================
1144 //=============================================================================
1146 GEOMImpl_ITransformOperations::ProjectShapeCopy (Handle(GEOM_Object) theSource,
1147 Handle(GEOM_Object) theTarget)
1151 if (theSource.IsNull() || theTarget.IsNull()) return NULL;
1153 Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
1154 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
1156 Handle(GEOM_Object) aCopy;
1158 TopoDS_Shape aTarget = theTarget->GetValue();
1159 if ( aTarget.IsNull() ) return NULL;
1160 if ( aTarget.ShapeType() == TopAbs_EDGE ||
1161 aTarget.ShapeType() == TopAbs_WIRE )
1163 // a TPythonDump prevents dumping ProjectPointOnWire(),
1164 // dump of MakeProjection() is done at the end of this function
1165 GEOM::TPythonDump preventDump(aLastFunction, /*append=*/true);
1166 Standard_Integer dummy;
1167 ProjectPointOnWire( theSource, theTarget, aCopy, dummy );
1168 if ( aCopy.IsNull() || !IsDone() )
1173 //Add a new Projection object
1174 aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1176 //Add a Projection function
1177 Handle(GEOM_Function) aFunction =
1178 aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
1180 //Check if the function is set correctly
1181 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
1183 GEOMImpl_IMirror aTI (aFunction);
1184 aTI.SetPlane(theTarget->GetLastFunction());
1185 aTI.SetOriginal(aLastFunction);
1187 //Compute the Projection
1190 if (!GetSolver()->ComputeFunction(aFunction)) {
1191 SetErrorCode("Projection driver failed");
1195 catch (Standard_Failure& aFail) {
1196 SetErrorCode(aFail.GetMessageString());
1201 //Make a Python command
1202 Handle(GEOM_Function) aFunction = aCopy->GetLastFunction();
1203 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
1204 << theSource << ", " << theTarget << ")";
1210 //=============================================================================
1212 * ProjectPointOnWire
1214 //=============================================================================
1215 Standard_Real GEOMImpl_ITransformOperations::ProjectPointOnWire
1216 (Handle(GEOM_Object) thePoint,
1217 Handle(GEOM_Object) theWire,
1218 Handle(GEOM_Object) &thePointOnEdge,
1219 Standard_Integer &theEdgeInWireIndex)
1221 Standard_Real aResult = -1.;
1225 if (thePoint.IsNull() || theWire.IsNull()) {
1229 Handle(GEOM_Function) aLastFunction = thePoint->GetLastFunction();
1231 if (aLastFunction.IsNull()) {
1232 //There is no function which creates an object to be projected
1236 //Add a new Projection object
1237 thePointOnEdge = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1239 //Add a Projection function
1240 Handle(GEOM_Function) aFunction = thePointOnEdge->AddFunction
1241 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_WIRE);
1243 //Check if the function is set correctly
1244 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
1248 GEOMImpl_IProjection aProj (aFunction);
1249 aProj.SetPoint(aLastFunction);
1250 aProj.SetShape(theWire->GetLastFunction());
1252 //Compute the Projection
1255 if (!GetSolver()->ComputeFunction(aFunction)) {
1256 SetErrorCode("Projection driver failed");
1260 catch (Standard_Failure& aFail) {
1261 SetErrorCode(aFail.GetMessageString());
1265 aResult = aProj.GetU();
1266 theEdgeInWireIndex = aProj.GetIndex();
1269 //Make a Python command
1270 GEOM::TPythonDump(aFunction) << "(u, " << thePointOnEdge
1271 << ", EdgeInWireIndex) = geompy.MakeProjectionOnWire(" << thePoint
1272 << ", " << theWire << ")";
1279 //=============================================================================
1283 //=============================================================================
1284 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
1285 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1289 if (theObject.IsNull()) return NULL;
1291 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1292 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1294 //Add a scale function
1295 Handle(GEOM_Function) aFunction =
1296 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1297 if (aFunction.IsNull()) return NULL;
1299 //Check if the function is set correctly
1300 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1303 GEOMImpl_IScale aTI (aFunction);
1304 aTI.SetShape(anOriginal);
1305 aTI.SetFactor(theFactor);
1307 // Set point argument
1308 if (!thePoint.IsNull()) {
1309 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1316 if (!GetSolver()->ComputeFunction(aFunction)) {
1317 SetErrorCode("Scale driver failed");
1321 catch (Standard_Failure& aFail) {
1322 SetErrorCode(aFail.GetMessageString());
1326 //Make a Python command
1327 GEOM::TPythonDump(aFunction) << "geompy.Scale("
1328 << theObject << ", " << thePoint << ", " << theFactor << ")";
1334 //=============================================================================
1338 //=============================================================================
1339 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1340 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1344 if (theObject.IsNull()) return NULL;
1346 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1347 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1349 //Add a new Copy object
1350 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1352 //Add a scale function
1353 Handle(GEOM_Function) aFunction =
1354 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1355 if (aFunction.IsNull()) return NULL;
1357 //Check if the function is set correctly
1358 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1361 GEOMImpl_IScale aTI (aFunction);
1362 aTI.SetShape(anOriginal);
1363 aTI.SetFactor(theFactor);
1365 // Set point argument
1366 if (!thePoint.IsNull()) {
1367 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1374 if (!GetSolver()->ComputeFunction(aFunction)) {
1375 SetErrorCode("Scale driver failed");
1379 catch (Standard_Failure& aFail) {
1380 SetErrorCode(aFail.GetMessageString());
1384 //Make a Python command
1385 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
1386 << theObject << ", " << thePoint << ", " << theFactor << ")";
1392 //=============================================================================
1394 * ScaleShapeAlongAxes
1396 //=============================================================================
1397 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
1398 Handle(GEOM_Object) thePoint,
1406 if (theObject.IsNull()) return NULL;
1408 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1409 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1411 //Add a scale function
1412 Handle(GEOM_Object) aCopy; //Add a new Copy object
1413 Handle(GEOM_Function) aFunction;
1415 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1416 aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
1419 aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
1421 if (aFunction.IsNull()) return NULL;
1423 //Check if the function is set correctly
1424 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1427 GEOMImpl_IScale aTI (aFunction);
1428 aTI.SetShape(anOriginal);
1429 aTI.SetFactorX(theFactorX);
1430 aTI.SetFactorY(theFactorY);
1431 aTI.SetFactorZ(theFactorZ);
1433 // Set point (optional argument)
1434 if (!thePoint.IsNull()) {
1435 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1442 if (!GetSolver()->ComputeFunction(aFunction)) {
1443 SetErrorCode("Scale driver failed");
1447 catch (Standard_Failure& aFail) {
1448 SetErrorCode(aFail.GetMessageString());
1454 //Make a Python command
1456 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
1457 << theObject << ", " << thePoint << ", "
1458 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1462 GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
1463 << theObject << ", " << thePoint << ", "
1464 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1468 //=============================================================================
1472 //=============================================================================
1473 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1474 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1478 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1480 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1481 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1483 //Add a Position function
1484 Standard_Integer aType = POSITION_SHAPE;
1485 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
1487 Handle(GEOM_Function) aFunction =
1488 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1489 if (aFunction.IsNull()) return NULL;
1491 //Check if the function is set correctly
1492 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1494 //Set operation arguments
1495 GEOMImpl_IPosition aTI (aFunction);
1496 aTI.SetShape(anOriginal);
1497 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1498 if (!theStartLCS.IsNull())
1499 aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction());
1501 //Compute the Position
1504 if (!GetSolver()->ComputeFunction(aFunction)) {
1505 SetErrorCode("Position driver failed");
1509 catch (Standard_Failure& aFail) {
1510 SetErrorCode(aFail.GetMessageString());
1514 //Make a Python command
1515 GEOM::TPythonDump(aFunction) << "geompy.Position("
1516 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1522 //=============================================================================
1526 //=============================================================================
1527 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1528 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1532 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1534 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1535 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1537 //Add a new Copy object
1538 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1540 //Add a position function
1541 Standard_Integer aType = POSITION_SHAPE_COPY;
1542 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
1544 Handle(GEOM_Function) aFunction =
1545 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1546 if (aFunction.IsNull()) return NULL;
1548 //Check if the function is set correctly
1549 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1551 GEOMImpl_IPosition aTI (aFunction);
1552 aTI.SetShape(anOriginal);
1553 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1554 if (!theStartLCS.IsNull())
1555 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1557 //Compute the position
1560 if (!GetSolver()->ComputeFunction(aFunction)) {
1561 SetErrorCode("Position driver failed");
1565 catch (Standard_Failure& aFail) {
1566 SetErrorCode(aFail.GetMessageString());
1570 //Make a Python command
1571 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
1572 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1578 //=============================================================================
1582 //=============================================================================
1583 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
1584 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
1585 double theDistance, bool theCopy, bool theReverse)
1589 if (theObject.IsNull() || thePath.IsNull()) return NULL;
1591 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1592 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1594 //Add a position function
1595 Handle(GEOM_Function) aFunction;
1596 Handle(GEOM_Object) aCopy;
1599 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1600 aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1603 aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1605 if (aFunction.IsNull()) return NULL;
1607 //Check if the function is set correctly
1608 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1610 GEOMImpl_IPosition aTI (aFunction);
1611 aTI.SetShape(anOriginal);
1612 aTI.SetPath(thePath->GetLastFunction());
1613 aTI.SetDistance(theDistance);
1614 aTI.SetReverse(theReverse);
1616 //Compute the position
1619 if (!GetSolver()->ComputeFunction(aFunction)) {
1620 SetErrorCode("Position driver failed");
1624 catch (Standard_Failure& aFail) {
1625 SetErrorCode(aFail.GetMessageString());
1629 //Make a Python command
1631 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
1632 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1637 GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
1638 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1644 //=============================================================================
1648 //=============================================================================
1649 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1650 Handle(GEOM_Object) theAxis,
1655 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1657 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1658 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1660 // Get last functions of the arguments
1661 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1663 //Add a rotate function
1664 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1666 if (aFunction.IsNull()) return NULL;
1668 //Check if the function is set correctly
1669 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1671 GEOMImpl_IRotate aRI(aFunction);
1673 aRI.SetOriginal(aLastFunction);
1674 aRI.SetAngle(theAngle);
1676 //Compute the translation
1679 if (!GetSolver()->ComputeFunction(aFunction)) {
1680 SetErrorCode("Rotate driver failed");
1684 catch (Standard_Failure& aFail) {
1685 SetErrorCode(aFail.GetMessageString());
1689 //Make a Python command
1690 GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
1691 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1697 //=============================================================================
1701 //=============================================================================
1702 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
1703 Handle(GEOM_Object) theAxis,
1708 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1710 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1711 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1713 //Add a new Copy object
1714 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1716 //Add a rotate function
1717 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1718 if (aFunction.IsNull()) return NULL;
1720 //Check if the function is set correctly
1721 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1723 GEOMImpl_IRotate aRI(aFunction);
1724 aRI.SetAxis(theAxis->GetLastFunction());
1725 aRI.SetOriginal(aLastFunction);
1726 aRI.SetAngle(theAngle);
1728 //Compute the translation
1731 if (!GetSolver()->ComputeFunction(aFunction)) {
1732 SetErrorCode("Rotate driver failed");
1736 catch (Standard_Failure& aFail) {
1737 SetErrorCode(aFail.GetMessageString());
1741 //Make a Python command
1742 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
1743 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1749 //=============================================================================
1751 * Rotate1D (for MultiRotate1DNbTimes)
1753 //=============================================================================
1754 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1755 Handle(GEOM_Object) theAxis,
1756 Standard_Integer theNbTimes)
1760 if (theObject.IsNull()) return NULL;
1762 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1763 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1765 //Add a new Copy object
1766 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1768 //Add a rotate function
1769 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1770 if (aFunction.IsNull()) return NULL;
1772 //Check if the function is set correctly
1773 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1775 GEOMImpl_IRotate aRI(aFunction);
1776 aRI.SetOriginal(aLastFunction);
1777 if (!theAxis.IsNull())
1778 aRI.SetAxis(theAxis->GetLastFunction());
1779 aRI.SetNbIter1(theNbTimes);
1781 //Compute the translation
1784 if (!GetSolver()->ComputeFunction(aFunction)) {
1785 SetErrorCode("Rotate driver failed");
1789 catch (Standard_Failure& aFail) {
1790 SetErrorCode(aFail.GetMessageString());
1794 //Make a Python command
1795 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
1796 << theObject << ", " << theAxis << ", " << theNbTimes << ")";
1802 //=============================================================================
1804 * Rotate1D (for MultiRotate1DByStep)
1806 //=============================================================================
1807 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1808 Handle(GEOM_Object) theAxis,
1809 double theAngleStep,
1810 Standard_Integer theNbSteps)
1814 if (theObject.IsNull()) return NULL;
1816 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1817 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1819 //Add a new Copy object
1820 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1822 //Add a rotate function
1823 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
1824 if (aFunction.IsNull()) return NULL;
1826 //Check if the function is set correctly
1827 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1829 //Convert angle into degrees
1830 double anAngleStep = theAngleStep * 180. / M_PI;
1832 GEOMImpl_IRotate aRI (aFunction);
1833 aRI.SetOriginal(aLastFunction);
1834 if (!theAxis.IsNull())
1835 aRI.SetAxis(theAxis->GetLastFunction());
1836 aRI.SetAngle(anAngleStep);
1837 aRI.SetNbIter1(theNbSteps);
1839 //Compute the translation
1842 if (!GetSolver()->ComputeFunction(aFunction)) {
1843 SetErrorCode("Rotate driver failed");
1847 catch (Standard_Failure& aFail) {
1848 SetErrorCode(aFail.GetMessageString());
1852 //Make a Python command
1853 GEOM::TPythonDump(aFunction)
1854 << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
1855 << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
1861 //=============================================================================
1863 * Rotate2D (for MultiRotate2DNbTimes)
1865 //=============================================================================
1866 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1867 Handle(GEOM_Object) theAxis,
1868 Standard_Integer theNbObjects,
1869 double theRadialStep,
1870 Standard_Integer theNbSteps)
1874 if (theObject.IsNull()) return NULL;
1876 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1877 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1879 //Add a new Copy object
1880 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1882 //Add a rotate function
1883 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1884 if (aFunction.IsNull()) return NULL;
1886 //Check if the function is set correctly
1887 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1889 double anAngle = 360. / (double)theNbObjects;
1891 GEOMImpl_IRotate aRI (aFunction);
1892 aRI.SetOriginal(aLastFunction);
1893 if (!theAxis.IsNull())
1894 aRI.SetAxis(theAxis->GetLastFunction());
1895 aRI.SetAngle(anAngle);
1896 aRI.SetNbIter1(theNbObjects);
1897 aRI.SetStep(theRadialStep);
1898 aRI.SetNbIter2(theNbSteps);
1900 //Compute the translation
1903 if (!GetSolver()->ComputeFunction(aFunction)) {
1904 SetErrorCode("Rotate driver failed");
1908 catch (Standard_Failure& aFail) {
1909 SetErrorCode(aFail.GetMessageString());
1913 //Make a Python command
1914 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
1915 << theObject << ", " << theAxis << ", " << theNbObjects
1916 << ", " << theRadialStep << ", " << theNbSteps << ")";
1922 //=============================================================================
1924 * Rotate2D (for MultiRotate2DByStep)
1926 //=============================================================================
1927 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1928 Handle(GEOM_Object) theAxis,
1929 double theAngleStep,
1930 Standard_Integer theNbTimes1,
1932 Standard_Integer theNbTimes2)
1936 if (theObject.IsNull()) return NULL;
1938 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1939 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1941 //Add a new Copy object
1942 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1944 //Add a rotate function
1945 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1946 if (aFunction.IsNull()) return NULL;
1948 //Check if the function is set correctly
1949 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1951 //Convert angle into degrees
1952 double anAngleStep = theAngleStep * 180. / M_PI;
1954 GEOMImpl_IRotate aRI (aFunction);
1955 aRI.SetOriginal(aLastFunction);
1956 if (!theAxis.IsNull())
1957 aRI.SetAxis(theAxis->GetLastFunction());
1958 aRI.SetAngle(anAngleStep);
1959 aRI.SetNbIter1(theNbTimes1);
1960 aRI.SetStep(theStep);
1961 aRI.SetNbIter2(theNbTimes2);
1963 //Compute the translation
1966 if (!GetSolver()->ComputeFunction(aFunction)) {
1967 SetErrorCode("Rotate driver failed");
1971 catch (Standard_Failure& aFail) {
1972 SetErrorCode(aFail.GetMessageString());
1976 //Make a Python command
1977 GEOM::TPythonDump(aFunction)
1978 << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
1979 << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
1980 << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
1986 //=============================================================================
1990 //=============================================================================
1991 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject,
1992 Handle(GEOM_Object) theCentPoint,
1993 Handle(GEOM_Object) thePoint1,
1994 Handle(GEOM_Object) thePoint2)
1998 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2000 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2001 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2003 // Get last functions of the arguments
2004 Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
2005 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
2006 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
2009 //Add a rotate function
2010 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS);
2012 if (aFunction.IsNull()) return NULL;
2014 //Check if the function is set correctly
2015 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2017 GEOMImpl_IRotate aRI(aFunction);
2018 aRI.SetCentPoint(aCPF);
2019 aRI.SetPoint1(aP1F);
2020 aRI.SetPoint2(aP2F);
2021 aRI.SetOriginal(aLastFunction);
2023 //Compute the translation
2026 if (!GetSolver()->ComputeFunction(aFunction)) {
2027 SetErrorCode("Rotate driver failed");
2031 catch (Standard_Failure& aFail) {
2032 SetErrorCode(aFail.GetMessageString());
2036 //Make a Python command
2037 GEOM::TPythonDump(aFunction) << "geompy.RotateThreePoints(" << theObject
2038 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2044 //=============================================================================
2046 * RotateThreePointsCopy
2048 //=============================================================================
2049 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle(GEOM_Object) theObject,
2050 Handle(GEOM_Object) theCentPoint,
2051 Handle(GEOM_Object) thePoint1,
2052 Handle(GEOM_Object) thePoint2)
2056 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2058 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2059 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2061 //Add a new Copy object
2062 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
2064 //Add a rotate function
2065 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
2066 if (aFunction.IsNull()) return NULL;
2068 //Check if the function is set correctly
2069 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2071 GEOMImpl_IRotate aRI(aFunction);
2072 aRI.SetCentPoint(theCentPoint->GetLastFunction());
2073 aRI.SetPoint1(thePoint1->GetLastFunction());
2074 aRI.SetPoint2(thePoint2->GetLastFunction());
2075 aRI.SetOriginal(aLastFunction);
2077 //Compute the translation
2080 if (!GetSolver()->ComputeFunction(aFunction)) {
2081 SetErrorCode("Rotate driver failed");
2085 catch (Standard_Failure& aFail) {
2086 SetErrorCode(aFail.GetMessageString());
2090 //Make a Python command
2091 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
2092 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2098 //=============================================================================
2100 * TransformLikeOtherCopy
2102 //=============================================================================
2103 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
2104 (Handle(GEOM_Object) theObject,
2105 Handle(GEOM_Object) theSample)
2109 if (theObject.IsNull() || theSample.IsNull()) return NULL;
2111 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2112 if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
2114 Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
2115 if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
2117 // Add a new Copy object
2118 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
2120 // Add a transform function (depends on theSample function)
2121 Handle(GEOM_Function) aFunction =
2122 aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
2123 if (aFunction.IsNull()) return NULL;
2125 // Check if the function is set correctly
2126 if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
2128 if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
2129 switch (aSampleFunc->GetType()) {
2132 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2133 GEOMImpl_ITranslate aRI_target (aFunction);
2135 aRI_target.SetVector(aRI_sample.GetVector());
2136 aRI_target.SetStep1(aRI_sample.GetStep1());
2137 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2139 aRI_target.SetOriginal(aLastFunction);
2144 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2145 GEOMImpl_ITranslate aRI_target (aFunction);
2147 aRI_target.SetVector(aRI_sample.GetVector());
2148 aRI_target.SetStep1(aRI_sample.GetStep1());
2149 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2151 aRI_target.SetVector2(aRI_sample.GetVector2());
2152 aRI_target.SetStep2(aRI_sample.GetStep2());
2153 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2155 aRI_target.SetOriginal(aLastFunction);
2160 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2165 else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
2166 switch (aSampleFunc->GetType()) {
2169 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2170 GEOMImpl_IRotate aRI_target (aFunction);
2172 aRI_target.SetAxis(aRI_sample.GetAxis());
2173 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2175 aRI_target.SetOriginal(aLastFunction);
2180 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2181 GEOMImpl_IRotate aRI_target (aFunction);
2183 aRI_target.SetAxis(aRI_sample.GetAxis());
2185 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2186 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2188 aRI_target.SetAngle(aRI_sample.GetAngle());
2189 aRI_target.SetStep(aRI_sample.GetStep());
2191 aRI_target.SetDir2(aRI_sample.GetDir2());
2193 aRI_target.SetOriginal(aLastFunction);
2196 case ROTATE_THREE_POINTS_COPY:
2198 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2199 GEOMImpl_IRotate aRI_target (aFunction);
2201 aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
2202 aRI_target.SetPoint1(aRI_sample.GetPoint1());
2203 aRI_target.SetPoint2(aRI_sample.GetPoint2());
2205 aRI_target.SetOriginal(aLastFunction);
2210 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2216 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2220 // Compute the transformation
2223 if (!GetSolver()->ComputeFunction(aFunction)) {
2224 SetErrorCode("Driver failed");
2228 catch (Standard_Failure& aFail) {
2229 SetErrorCode(aFail.GetMessageString());
2233 //Make a Python command
2234 //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
2235 // << theObject << ", " << theSample << ")";
2241 //=============================================================================
2243 * MakeProjectionOnCylinder
2245 //=============================================================================
2246 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder
2247 (const Handle(GEOM_Object) &theObject,
2248 const Standard_Real theRadius,
2249 const Standard_Real theStartAngle,
2250 const Standard_Real theAngleLength,
2251 const Standard_Real theAngleRotation)
2255 if (theObject.IsNull()) {
2259 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2261 if (aLastFunction.IsNull()) {
2262 //There is no function which creates an object to be projected
2266 //Add a new Projection object
2267 Handle(GEOM_Object) aResult =
2268 GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
2270 //Add a Projection function
2271 Handle(GEOM_Function) aFunction = aResult->AddFunction
2272 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_CYLINDER);
2274 //Check if the function is set correctly
2275 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
2279 GEOMImpl_IProjOnCyl aProj (aFunction);
2281 aProj.SetShape(aLastFunction);
2282 aProj.SetRadius(theRadius);
2283 aProj.SetStartAngle(theStartAngle);
2284 aProj.SetAngleLength(theAngleLength);
2285 aProj.SetAngleRotation(theAngleRotation);
2287 //Compute the Projection
2290 if (!GetSolver()->ComputeFunction(aFunction)) {
2291 SetErrorCode("Projection driver failed");
2295 catch (Standard_Failure& aFail) {
2296 SetErrorCode(aFail.GetMessageString());
2300 //Make a Python command
2301 GEOM::TPythonDump(aFunction)
2302 << aResult << " = geompy.MakeProjectionOnCylinder("
2303 << theObject << ", " << theRadius << ", " << theStartAngle
2304 << ", " << theAngleLength << ", " << theAngleRotation << ")";