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 //=============================================================================
1039 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
1040 (Handle(GEOM_Object) theObject, double theOffset)
1044 if (theObject.IsNull()) return NULL;
1046 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1047 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1049 //Add a new Offset function
1050 Handle(GEOM_Function) aFunction =
1051 theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE);
1052 if (aFunction.IsNull()) return NULL;
1054 //Check if the function is set correctly
1055 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1057 GEOMImpl_IOffset aTI (aFunction);
1058 aTI.SetShape(anOriginal);
1059 aTI.SetValue(theOffset);
1061 //Compute the offset
1064 if (!GetSolver()->ComputeFunction(aFunction)) {
1065 SetErrorCode("Offset driver failed");
1069 catch (Standard_Failure& aFail) {
1070 SetErrorCode(aFail.GetMessageString());
1074 //Make a Python command
1075 GEOM::TPythonDump(aFunction) << "geompy.Offset("
1076 << theObject << ", " << theOffset << ")";
1082 //=============================================================================
1086 //=============================================================================
1087 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
1088 (Handle(GEOM_Object) theObject, double theOffset)
1092 if (theObject.IsNull()) return NULL;
1094 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1095 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1097 //Add a new Copy object
1098 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1100 //Add a new Offset function
1101 Handle(GEOM_Function) aFunction =
1102 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
1103 if (aFunction.IsNull()) return NULL;
1105 //Check if the function is set correctly
1106 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1108 GEOMImpl_IOffset aTI (aFunction);
1109 aTI.SetShape(anOriginal);
1110 aTI.SetValue(theOffset);
1112 //Compute the offset
1115 if (!GetSolver()->ComputeFunction(aFunction)) {
1116 SetErrorCode("Offset driver failed");
1120 catch (Standard_Failure& aFail) {
1121 SetErrorCode(aFail.GetMessageString());
1125 //Make a Python command
1126 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
1127 << theObject << ", " << theOffset << ")";
1134 //=============================================================================
1138 //=============================================================================
1140 GEOMImpl_ITransformOperations::ProjectShapeCopy (Handle(GEOM_Object) theSource,
1141 Handle(GEOM_Object) theTarget)
1145 if (theSource.IsNull() || theTarget.IsNull()) return NULL;
1147 Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
1148 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
1150 Handle(GEOM_Object) aCopy;
1152 TopoDS_Shape aTarget = theTarget->GetValue();
1153 if ( aTarget.IsNull() ) return NULL;
1154 if ( aTarget.ShapeType() == TopAbs_EDGE ||
1155 aTarget.ShapeType() == TopAbs_WIRE )
1157 // a TPythonDump prevents dumping ProjectPointOnWire(),
1158 // dump of MakeProjection() is done at the end of this function
1159 GEOM::TPythonDump preventDump(aLastFunction, /*append=*/true);
1160 Standard_Integer dummy;
1161 ProjectPointOnWire( theSource, theTarget, aCopy, dummy );
1162 if ( aCopy.IsNull() || !IsDone() )
1167 //Add a new Projection object
1168 aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1170 //Add a Projection function
1171 Handle(GEOM_Function) aFunction =
1172 aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
1174 //Check if the function is set correctly
1175 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
1177 GEOMImpl_IMirror aTI (aFunction);
1178 aTI.SetPlane(theTarget->GetLastFunction());
1179 aTI.SetOriginal(aLastFunction);
1181 //Compute the Projection
1184 if (!GetSolver()->ComputeFunction(aFunction)) {
1185 SetErrorCode("Projection driver failed");
1189 catch (Standard_Failure& aFail) {
1190 SetErrorCode(aFail.GetMessageString());
1195 //Make a Python command
1196 Handle(GEOM_Function) aFunction = aCopy->GetLastFunction();
1197 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
1198 << theSource << ", " << theTarget << ")";
1204 //=============================================================================
1206 * ProjectPointOnWire
1208 //=============================================================================
1209 Standard_Real GEOMImpl_ITransformOperations::ProjectPointOnWire
1210 (Handle(GEOM_Object) thePoint,
1211 Handle(GEOM_Object) theWire,
1212 Handle(GEOM_Object) &thePointOnEdge,
1213 Standard_Integer &theEdgeInWireIndex)
1215 Standard_Real aResult = -1.;
1219 if (thePoint.IsNull() || theWire.IsNull()) {
1223 Handle(GEOM_Function) aLastFunction = thePoint->GetLastFunction();
1225 if (aLastFunction.IsNull()) {
1226 //There is no function which creates an object to be projected
1230 //Add a new Projection object
1231 thePointOnEdge = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1233 //Add a Projection function
1234 Handle(GEOM_Function) aFunction = thePointOnEdge->AddFunction
1235 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_WIRE);
1237 //Check if the function is set correctly
1238 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
1242 GEOMImpl_IProjection aProj (aFunction);
1243 aProj.SetPoint(aLastFunction);
1244 aProj.SetShape(theWire->GetLastFunction());
1246 //Compute the Projection
1249 if (!GetSolver()->ComputeFunction(aFunction)) {
1250 SetErrorCode("Projection driver failed");
1254 catch (Standard_Failure& aFail) {
1255 SetErrorCode(aFail.GetMessageString());
1259 aResult = aProj.GetU();
1260 theEdgeInWireIndex = aProj.GetIndex();
1263 //Make a Python command
1264 GEOM::TPythonDump(aFunction) << "(u, " << thePointOnEdge
1265 << ", EdgeInWireIndex) = geompy.MakeProjectionOnWire(" << thePoint
1266 << ", " << theWire << ")";
1273 //=============================================================================
1277 //=============================================================================
1278 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
1279 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1283 if (theObject.IsNull()) return NULL;
1285 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1286 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1288 //Add a scale function
1289 Handle(GEOM_Function) aFunction =
1290 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1291 if (aFunction.IsNull()) return NULL;
1293 //Check if the function is set correctly
1294 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1297 GEOMImpl_IScale aTI (aFunction);
1298 aTI.SetShape(anOriginal);
1299 aTI.SetFactor(theFactor);
1301 // Set point argument
1302 if (!thePoint.IsNull()) {
1303 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1310 if (!GetSolver()->ComputeFunction(aFunction)) {
1311 SetErrorCode("Scale driver failed");
1315 catch (Standard_Failure& aFail) {
1316 SetErrorCode(aFail.GetMessageString());
1320 //Make a Python command
1321 GEOM::TPythonDump(aFunction) << "geompy.Scale("
1322 << theObject << ", " << thePoint << ", " << theFactor << ")";
1328 //=============================================================================
1332 //=============================================================================
1333 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1334 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1338 if (theObject.IsNull()) return NULL;
1340 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1341 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1343 //Add a new Copy object
1344 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1346 //Add a scale function
1347 Handle(GEOM_Function) aFunction =
1348 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1349 if (aFunction.IsNull()) return NULL;
1351 //Check if the function is set correctly
1352 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1355 GEOMImpl_IScale aTI (aFunction);
1356 aTI.SetShape(anOriginal);
1357 aTI.SetFactor(theFactor);
1359 // Set point argument
1360 if (!thePoint.IsNull()) {
1361 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1368 if (!GetSolver()->ComputeFunction(aFunction)) {
1369 SetErrorCode("Scale driver failed");
1373 catch (Standard_Failure& aFail) {
1374 SetErrorCode(aFail.GetMessageString());
1378 //Make a Python command
1379 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
1380 << theObject << ", " << thePoint << ", " << theFactor << ")";
1386 //=============================================================================
1388 * ScaleShapeAlongAxes
1390 //=============================================================================
1391 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
1392 Handle(GEOM_Object) thePoint,
1400 if (theObject.IsNull()) return NULL;
1402 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1403 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1405 //Add a scale function
1406 Handle(GEOM_Object) aCopy; //Add a new Copy object
1407 Handle(GEOM_Function) aFunction;
1409 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1410 aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
1413 aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
1415 if (aFunction.IsNull()) return NULL;
1417 //Check if the function is set correctly
1418 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1421 GEOMImpl_IScale aTI (aFunction);
1422 aTI.SetShape(anOriginal);
1423 aTI.SetFactorX(theFactorX);
1424 aTI.SetFactorY(theFactorY);
1425 aTI.SetFactorZ(theFactorZ);
1427 // Set point (optional argument)
1428 if (!thePoint.IsNull()) {
1429 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1436 if (!GetSolver()->ComputeFunction(aFunction)) {
1437 SetErrorCode("Scale driver failed");
1441 catch (Standard_Failure& aFail) {
1442 SetErrorCode(aFail.GetMessageString());
1448 //Make a Python command
1450 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
1451 << theObject << ", " << thePoint << ", "
1452 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1456 GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
1457 << theObject << ", " << thePoint << ", "
1458 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1462 //=============================================================================
1466 //=============================================================================
1467 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1468 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1472 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1474 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1475 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1477 //Add a Position function
1478 Standard_Integer aType = POSITION_SHAPE;
1479 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
1481 Handle(GEOM_Function) aFunction =
1482 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1483 if (aFunction.IsNull()) return NULL;
1485 //Check if the function is set correctly
1486 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1488 //Set operation arguments
1489 GEOMImpl_IPosition aTI (aFunction);
1490 aTI.SetShape(anOriginal);
1491 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1492 if (!theStartLCS.IsNull())
1493 aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction());
1495 //Compute the Position
1498 if (!GetSolver()->ComputeFunction(aFunction)) {
1499 SetErrorCode("Position driver failed");
1503 catch (Standard_Failure& aFail) {
1504 SetErrorCode(aFail.GetMessageString());
1508 //Make a Python command
1509 GEOM::TPythonDump(aFunction) << "geompy.Position("
1510 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1516 //=============================================================================
1520 //=============================================================================
1521 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1522 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1526 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1528 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1529 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1531 //Add a new Copy object
1532 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1534 //Add a position function
1535 Standard_Integer aType = POSITION_SHAPE_COPY;
1536 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
1538 Handle(GEOM_Function) aFunction =
1539 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1540 if (aFunction.IsNull()) return NULL;
1542 //Check if the function is set correctly
1543 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1545 GEOMImpl_IPosition aTI (aFunction);
1546 aTI.SetShape(anOriginal);
1547 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1548 if (!theStartLCS.IsNull())
1549 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1551 //Compute the position
1554 if (!GetSolver()->ComputeFunction(aFunction)) {
1555 SetErrorCode("Position driver failed");
1559 catch (Standard_Failure& aFail) {
1560 SetErrorCode(aFail.GetMessageString());
1564 //Make a Python command
1565 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
1566 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1572 //=============================================================================
1576 //=============================================================================
1577 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
1578 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
1579 double theDistance, bool theCopy, bool theReverse)
1583 if (theObject.IsNull() || thePath.IsNull()) return NULL;
1585 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1586 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1588 //Add a position function
1589 Handle(GEOM_Function) aFunction;
1590 Handle(GEOM_Object) aCopy;
1593 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1594 aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1597 aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1599 if (aFunction.IsNull()) return NULL;
1601 //Check if the function is set correctly
1602 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1604 GEOMImpl_IPosition aTI (aFunction);
1605 aTI.SetShape(anOriginal);
1606 aTI.SetPath(thePath->GetLastFunction());
1607 aTI.SetDistance(theDistance);
1608 aTI.SetReverse(theReverse);
1610 //Compute the position
1613 if (!GetSolver()->ComputeFunction(aFunction)) {
1614 SetErrorCode("Position driver failed");
1618 catch (Standard_Failure& aFail) {
1619 SetErrorCode(aFail.GetMessageString());
1623 //Make a Python command
1625 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
1626 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1631 GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
1632 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1638 //=============================================================================
1642 //=============================================================================
1643 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1644 Handle(GEOM_Object) theAxis,
1649 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1651 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1652 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1654 // Get last functions of the arguments
1655 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1657 //Add a rotate function
1658 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1660 if (aFunction.IsNull()) return NULL;
1662 //Check if the function is set correctly
1663 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1665 GEOMImpl_IRotate aRI(aFunction);
1667 aRI.SetOriginal(aLastFunction);
1668 aRI.SetAngle(theAngle);
1670 //Compute the translation
1673 if (!GetSolver()->ComputeFunction(aFunction)) {
1674 SetErrorCode("Rotate driver failed");
1678 catch (Standard_Failure& aFail) {
1679 SetErrorCode(aFail.GetMessageString());
1683 //Make a Python command
1684 GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
1685 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1691 //=============================================================================
1695 //=============================================================================
1696 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
1697 Handle(GEOM_Object) theAxis,
1702 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1704 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1705 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1707 //Add a new Copy object
1708 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
1710 //Add a rotate function
1711 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1712 if (aFunction.IsNull()) return NULL;
1714 //Check if the function is set correctly
1715 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1717 GEOMImpl_IRotate aRI(aFunction);
1718 aRI.SetAxis(theAxis->GetLastFunction());
1719 aRI.SetOriginal(aLastFunction);
1720 aRI.SetAngle(theAngle);
1722 //Compute the translation
1725 if (!GetSolver()->ComputeFunction(aFunction)) {
1726 SetErrorCode("Rotate driver failed");
1730 catch (Standard_Failure& aFail) {
1731 SetErrorCode(aFail.GetMessageString());
1735 //Make a Python command
1736 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
1737 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1743 //=============================================================================
1745 * Rotate1D (for MultiRotate1DNbTimes)
1747 //=============================================================================
1748 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1749 Handle(GEOM_Object) theAxis,
1750 Standard_Integer theNbTimes)
1754 if (theObject.IsNull()) return NULL;
1756 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1757 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1759 //Add a new Copy object
1760 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1762 //Add a rotate function
1763 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1764 if (aFunction.IsNull()) return NULL;
1766 //Check if the function is set correctly
1767 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1769 GEOMImpl_IRotate aRI(aFunction);
1770 aRI.SetOriginal(aLastFunction);
1771 if (!theAxis.IsNull())
1772 aRI.SetAxis(theAxis->GetLastFunction());
1773 aRI.SetNbIter1(theNbTimes);
1775 //Compute the translation
1778 if (!GetSolver()->ComputeFunction(aFunction)) {
1779 SetErrorCode("Rotate driver failed");
1783 catch (Standard_Failure& aFail) {
1784 SetErrorCode(aFail.GetMessageString());
1788 //Make a Python command
1789 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
1790 << theObject << ", " << theAxis << ", " << theNbTimes << ")";
1796 //=============================================================================
1798 * Rotate1D (for MultiRotate1DByStep)
1800 //=============================================================================
1801 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1802 Handle(GEOM_Object) theAxis,
1803 double theAngleStep,
1804 Standard_Integer theNbSteps)
1808 if (theObject.IsNull()) return NULL;
1810 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1811 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1813 //Add a new Copy object
1814 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1816 //Add a rotate function
1817 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
1818 if (aFunction.IsNull()) return NULL;
1820 //Check if the function is set correctly
1821 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1823 //Convert angle into degrees
1824 double anAngleStep = theAngleStep * 180. / M_PI;
1826 GEOMImpl_IRotate aRI (aFunction);
1827 aRI.SetOriginal(aLastFunction);
1828 if (!theAxis.IsNull())
1829 aRI.SetAxis(theAxis->GetLastFunction());
1830 aRI.SetAngle(anAngleStep);
1831 aRI.SetNbIter1(theNbSteps);
1833 //Compute the translation
1836 if (!GetSolver()->ComputeFunction(aFunction)) {
1837 SetErrorCode("Rotate driver failed");
1841 catch (Standard_Failure& aFail) {
1842 SetErrorCode(aFail.GetMessageString());
1846 //Make a Python command
1847 GEOM::TPythonDump(aFunction)
1848 << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
1849 << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
1855 //=============================================================================
1857 * Rotate2D (for MultiRotate2DNbTimes)
1859 //=============================================================================
1860 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1861 Handle(GEOM_Object) theAxis,
1862 Standard_Integer theNbObjects,
1863 double theRadialStep,
1864 Standard_Integer theNbSteps)
1868 if (theObject.IsNull()) return NULL;
1870 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1871 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1873 //Add a new Copy object
1874 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1876 //Add a rotate function
1877 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1878 if (aFunction.IsNull()) return NULL;
1880 //Check if the function is set correctly
1881 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1883 double anAngle = 360. / (double)theNbObjects;
1885 GEOMImpl_IRotate aRI (aFunction);
1886 aRI.SetOriginal(aLastFunction);
1887 if (!theAxis.IsNull())
1888 aRI.SetAxis(theAxis->GetLastFunction());
1889 aRI.SetAngle(anAngle);
1890 aRI.SetNbIter1(theNbObjects);
1891 aRI.SetStep(theRadialStep);
1892 aRI.SetNbIter2(theNbSteps);
1894 //Compute the translation
1897 if (!GetSolver()->ComputeFunction(aFunction)) {
1898 SetErrorCode("Rotate driver failed");
1902 catch (Standard_Failure& aFail) {
1903 SetErrorCode(aFail.GetMessageString());
1907 //Make a Python command
1908 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
1909 << theObject << ", " << theAxis << ", " << theNbObjects
1910 << ", " << theRadialStep << ", " << theNbSteps << ")";
1916 //=============================================================================
1918 * Rotate2D (for MultiRotate2DByStep)
1920 //=============================================================================
1921 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1922 Handle(GEOM_Object) theAxis,
1923 double theAngleStep,
1924 Standard_Integer theNbTimes1,
1926 Standard_Integer theNbTimes2)
1930 if (theObject.IsNull()) return NULL;
1932 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1933 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1935 //Add a new Copy object
1936 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1938 //Add a rotate function
1939 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1940 if (aFunction.IsNull()) return NULL;
1942 //Check if the function is set correctly
1943 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1945 //Convert angle into degrees
1946 double anAngleStep = theAngleStep * 180. / M_PI;
1948 GEOMImpl_IRotate aRI (aFunction);
1949 aRI.SetOriginal(aLastFunction);
1950 if (!theAxis.IsNull())
1951 aRI.SetAxis(theAxis->GetLastFunction());
1952 aRI.SetAngle(anAngleStep);
1953 aRI.SetNbIter1(theNbTimes1);
1954 aRI.SetStep(theStep);
1955 aRI.SetNbIter2(theNbTimes2);
1957 //Compute the translation
1960 if (!GetSolver()->ComputeFunction(aFunction)) {
1961 SetErrorCode("Rotate driver failed");
1965 catch (Standard_Failure& aFail) {
1966 SetErrorCode(aFail.GetMessageString());
1970 //Make a Python command
1971 GEOM::TPythonDump(aFunction)
1972 << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
1973 << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
1974 << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
1980 //=============================================================================
1984 //=============================================================================
1985 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject,
1986 Handle(GEOM_Object) theCentPoint,
1987 Handle(GEOM_Object) thePoint1,
1988 Handle(GEOM_Object) thePoint2)
1992 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
1994 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1995 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1997 // Get last functions of the arguments
1998 Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
1999 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
2000 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
2003 //Add a rotate function
2004 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS);
2006 if (aFunction.IsNull()) return NULL;
2008 //Check if the function is set correctly
2009 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2011 GEOMImpl_IRotate aRI(aFunction);
2012 aRI.SetCentPoint(aCPF);
2013 aRI.SetPoint1(aP1F);
2014 aRI.SetPoint2(aP2F);
2015 aRI.SetOriginal(aLastFunction);
2017 //Compute the translation
2020 if (!GetSolver()->ComputeFunction(aFunction)) {
2021 SetErrorCode("Rotate driver failed");
2025 catch (Standard_Failure& aFail) {
2026 SetErrorCode(aFail.GetMessageString());
2030 //Make a Python command
2031 GEOM::TPythonDump(aFunction) << "geompy.RotateThreePoints(" << theObject
2032 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2038 //=============================================================================
2040 * RotateThreePointsCopy
2042 //=============================================================================
2043 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle(GEOM_Object) theObject,
2044 Handle(GEOM_Object) theCentPoint,
2045 Handle(GEOM_Object) thePoint1,
2046 Handle(GEOM_Object) thePoint2)
2050 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2052 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2053 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2055 //Add a new Copy object
2056 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
2058 //Add a rotate function
2059 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
2060 if (aFunction.IsNull()) return NULL;
2062 //Check if the function is set correctly
2063 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2065 GEOMImpl_IRotate aRI(aFunction);
2066 aRI.SetCentPoint(theCentPoint->GetLastFunction());
2067 aRI.SetPoint1(thePoint1->GetLastFunction());
2068 aRI.SetPoint2(thePoint2->GetLastFunction());
2069 aRI.SetOriginal(aLastFunction);
2071 //Compute the translation
2074 if (!GetSolver()->ComputeFunction(aFunction)) {
2075 SetErrorCode("Rotate driver failed");
2079 catch (Standard_Failure& aFail) {
2080 SetErrorCode(aFail.GetMessageString());
2084 //Make a Python command
2085 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
2086 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2092 //=============================================================================
2094 * TransformLikeOtherCopy
2096 //=============================================================================
2097 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
2098 (Handle(GEOM_Object) theObject,
2099 Handle(GEOM_Object) theSample)
2103 if (theObject.IsNull() || theSample.IsNull()) return NULL;
2105 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2106 if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
2108 Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
2109 if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
2111 // Add a new Copy object
2112 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
2114 // Add a transform function (depends on theSample function)
2115 Handle(GEOM_Function) aFunction =
2116 aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
2117 if (aFunction.IsNull()) return NULL;
2119 // Check if the function is set correctly
2120 if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
2122 if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
2123 switch (aSampleFunc->GetType()) {
2126 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2127 GEOMImpl_ITranslate aRI_target (aFunction);
2129 aRI_target.SetVector(aRI_sample.GetVector());
2130 aRI_target.SetStep1(aRI_sample.GetStep1());
2131 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2133 aRI_target.SetOriginal(aLastFunction);
2138 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2139 GEOMImpl_ITranslate aRI_target (aFunction);
2141 aRI_target.SetVector(aRI_sample.GetVector());
2142 aRI_target.SetStep1(aRI_sample.GetStep1());
2143 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2145 aRI_target.SetVector2(aRI_sample.GetVector2());
2146 aRI_target.SetStep2(aRI_sample.GetStep2());
2147 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2149 aRI_target.SetOriginal(aLastFunction);
2154 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2159 else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
2160 switch (aSampleFunc->GetType()) {
2163 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2164 GEOMImpl_IRotate aRI_target (aFunction);
2166 aRI_target.SetAxis(aRI_sample.GetAxis());
2167 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2169 aRI_target.SetOriginal(aLastFunction);
2174 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2175 GEOMImpl_IRotate aRI_target (aFunction);
2177 aRI_target.SetAxis(aRI_sample.GetAxis());
2179 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2180 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2182 aRI_target.SetAngle(aRI_sample.GetAngle());
2183 aRI_target.SetStep(aRI_sample.GetStep());
2185 aRI_target.SetDir2(aRI_sample.GetDir2());
2187 aRI_target.SetOriginal(aLastFunction);
2190 case ROTATE_THREE_POINTS_COPY:
2192 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2193 GEOMImpl_IRotate aRI_target (aFunction);
2195 aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
2196 aRI_target.SetPoint1(aRI_sample.GetPoint1());
2197 aRI_target.SetPoint2(aRI_sample.GetPoint2());
2199 aRI_target.SetOriginal(aLastFunction);
2204 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2210 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2214 // Compute the transformation
2217 if (!GetSolver()->ComputeFunction(aFunction)) {
2218 SetErrorCode("Driver failed");
2222 catch (Standard_Failure& aFail) {
2223 SetErrorCode(aFail.GetMessageString());
2227 //Make a Python command
2228 //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
2229 // << theObject << ", " << theSample << ")";
2235 //=============================================================================
2237 * MakeProjectionOnCylinder
2239 //=============================================================================
2240 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder
2241 (const Handle(GEOM_Object) &theObject,
2242 const Standard_Real theRadius,
2243 const Standard_Real theStartAngle,
2244 const Standard_Real theAngleLength,
2245 const Standard_Real theAngleRotation)
2249 if (theObject.IsNull()) {
2253 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2255 if (aLastFunction.IsNull()) {
2256 //There is no function which creates an object to be projected
2260 //Add a new Projection object
2261 Handle(GEOM_Object) aResult =
2262 GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
2264 //Add a Projection function
2265 Handle(GEOM_Function) aFunction = aResult->AddFunction
2266 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_CYLINDER);
2268 //Check if the function is set correctly
2269 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
2273 GEOMImpl_IProjOnCyl aProj (aFunction);
2275 aProj.SetShape(aLastFunction);
2276 aProj.SetRadius(theRadius);
2277 aProj.SetStartAngle(theStartAngle);
2278 aProj.SetAngleLength(theAngleLength);
2279 aProj.SetAngleRotation(theAngleRotation);
2281 //Compute the Projection
2284 if (!GetSolver()->ComputeFunction(aFunction)) {
2285 SetErrorCode("Projection driver failed");
2289 catch (Standard_Failure& aFail) {
2290 SetErrorCode(aFail.GetMessageString());
2294 //Make a Python command
2295 GEOM::TPythonDump(aFunction)
2296 << aResult << " = geompy.MakeProjectionOnCylinder("
2297 << theObject << ", " << theRadius << ", " << theStartAngle
2298 << ", " << theAngleLength << ", " << theAngleRotation << ")";