1 // Copyright (C) 2007-2020 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)
79 : GEOM_IOperations(theEngine)
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(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(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(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(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(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(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(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(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(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
1079 GEOM::TPythonDump(aFunction) << "geompy.Offset("
1080 << theObject << ", " << theOffset << ")";
1082 GEOM::TPythonDump(aFunction) << theObject << " = geompy.MakeOffsetIntersectionJoin("
1083 << theObject << ", " << theOffset << ")";
1089 //=============================================================================
1093 //=============================================================================
1095 GEOMImpl_ITransformOperations::OffsetShapeCopy( Handle(GEOM_Object) theObject,
1097 bool theJoinByPipes)
1101 if (theObject.IsNull()) return NULL;
1103 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1104 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1106 //Add a new Copy object
1107 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1109 //Add a new Offset function
1110 Handle(GEOM_Function) aFunction =
1111 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
1112 if (aFunction.IsNull()) return NULL;
1114 //Check if the function is set correctly
1115 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1117 GEOMImpl_IOffset aTI (aFunction);
1118 aTI.SetShape( anOriginal );
1119 aTI.SetValue( theOffset );
1120 aTI.SetJoinByPipes( theJoinByPipes );
1122 //Compute the offset
1125 if (!GetSolver()->ComputeFunction(aFunction)) {
1126 SetErrorCode("Offset driver failed");
1130 catch (Standard_Failure& aFail) {
1131 SetErrorCode(aFail.GetMessageString());
1135 //Make a Python command
1137 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
1138 << theObject << ", " << theOffset << ")";
1140 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffsetIntersectionJoin("
1141 << theObject << ", " << theOffset << ")";
1148 //=============================================================================
1152 //=============================================================================
1154 GEOMImpl_ITransformOperations::ProjectShapeCopy (Handle(GEOM_Object) theSource,
1155 Handle(GEOM_Object) theTarget)
1159 if (theSource.IsNull() || theTarget.IsNull()) return NULL;
1161 Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
1162 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
1164 Handle(GEOM_Object) aCopy;
1166 TopoDS_Shape aTarget = theTarget->GetValue();
1167 if ( aTarget.IsNull() ) return NULL;
1168 if ( aTarget.ShapeType() == TopAbs_EDGE ||
1169 aTarget.ShapeType() == TopAbs_WIRE )
1171 // a TPythonDump prevents dumping ProjectPointOnWire(),
1172 // dump of MakeProjection() is done at the end of this function
1173 GEOM::TPythonDump preventDump(aLastFunction, /*append=*/true);
1174 Standard_Integer dummy;
1175 ProjectPointOnWire( theSource, theTarget, aCopy, dummy );
1176 if ( aCopy.IsNull() || !IsDone() )
1181 //Add a new Projection object
1182 aCopy = GetEngine()->AddObject(GEOM_PROJECTION);
1184 //Add a Projection function
1185 Handle(GEOM_Function) aFunction =
1186 aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
1188 //Check if the function is set correctly
1189 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
1191 GEOMImpl_IMirror aTI (aFunction);
1192 aTI.SetPlane(theTarget->GetLastFunction());
1193 aTI.SetOriginal(aLastFunction);
1195 //Compute the Projection
1198 if (!GetSolver()->ComputeFunction(aFunction)) {
1199 SetErrorCode("Projection driver failed");
1203 catch (Standard_Failure& aFail) {
1204 SetErrorCode(aFail.GetMessageString());
1209 //Make a Python command
1210 Handle(GEOM_Function) aFunction = aCopy->GetLastFunction();
1211 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
1212 << theSource << ", " << theTarget << ")";
1218 //=============================================================================
1220 * ProjectPointOnWire
1222 //=============================================================================
1223 Standard_Real GEOMImpl_ITransformOperations::ProjectPointOnWire
1224 (Handle(GEOM_Object) thePoint,
1225 Handle(GEOM_Object) theWire,
1226 Handle(GEOM_Object) &thePointOnEdge,
1227 Standard_Integer &theEdgeInWireIndex)
1229 Standard_Real aResult = -1.;
1233 if (thePoint.IsNull() || theWire.IsNull()) {
1237 Handle(GEOM_Function) aLastFunction = thePoint->GetLastFunction();
1239 if (aLastFunction.IsNull()) {
1240 //There is no function which creates an object to be projected
1244 //Add a new Projection object
1245 thePointOnEdge = GetEngine()->AddObject(GEOM_PROJECTION);
1247 //Add a Projection function
1248 Handle(GEOM_Function) aFunction = thePointOnEdge->AddFunction
1249 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_WIRE);
1251 //Check if the function is set correctly
1252 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
1256 GEOMImpl_IProjection aProj (aFunction);
1257 aProj.SetPoint(aLastFunction);
1258 aProj.SetShape(theWire->GetLastFunction());
1260 //Compute the Projection
1263 if (!GetSolver()->ComputeFunction(aFunction)) {
1264 SetErrorCode("Projection driver failed");
1268 catch (Standard_Failure& aFail) {
1269 SetErrorCode(aFail.GetMessageString());
1273 aResult = aProj.GetU();
1274 theEdgeInWireIndex = aProj.GetIndex();
1277 //Make a Python command
1278 GEOM::TPythonDump(aFunction) << "(u, " << thePointOnEdge
1279 << ", EdgeInWireIndex) = geompy.MakeProjectionOnWire(" << thePoint
1280 << ", " << theWire << ")";
1287 //=============================================================================
1291 //=============================================================================
1292 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
1293 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1297 if (theObject.IsNull()) return NULL;
1299 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1300 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1302 //Add a scale function
1303 Handle(GEOM_Function) aFunction =
1304 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1305 if (aFunction.IsNull()) return NULL;
1307 //Check if the function is set correctly
1308 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1311 GEOMImpl_IScale aTI (aFunction);
1312 aTI.SetShape(anOriginal);
1313 aTI.SetFactor(theFactor);
1315 // Set point argument
1316 if (!thePoint.IsNull()) {
1317 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1324 if (!GetSolver()->ComputeFunction(aFunction)) {
1325 SetErrorCode("Scale driver failed");
1329 catch (Standard_Failure& aFail) {
1330 SetErrorCode(aFail.GetMessageString());
1334 //Make a Python command
1335 GEOM::TPythonDump(aFunction) << "geompy.Scale("
1336 << theObject << ", " << thePoint << ", " << theFactor << ")";
1342 //=============================================================================
1346 //=============================================================================
1347 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1348 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1352 if (theObject.IsNull()) return NULL;
1354 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1355 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1357 //Add a new Copy object
1358 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1360 //Add a scale function
1361 Handle(GEOM_Function) aFunction =
1362 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1363 if (aFunction.IsNull()) return NULL;
1365 //Check if the function is set correctly
1366 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1369 GEOMImpl_IScale aTI (aFunction);
1370 aTI.SetShape(anOriginal);
1371 aTI.SetFactor(theFactor);
1373 // Set point argument
1374 if (!thePoint.IsNull()) {
1375 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1382 if (!GetSolver()->ComputeFunction(aFunction)) {
1383 SetErrorCode("Scale driver failed");
1387 catch (Standard_Failure& aFail) {
1388 SetErrorCode(aFail.GetMessageString());
1392 //Make a Python command
1393 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
1394 << theObject << ", " << thePoint << ", " << theFactor << ")";
1400 //=============================================================================
1402 * ScaleShapeAlongAxes
1404 //=============================================================================
1405 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
1406 Handle(GEOM_Object) thePoint,
1414 if (theObject.IsNull()) return NULL;
1416 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1417 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1419 //Add a scale function
1420 Handle(GEOM_Object) aCopy; //Add a new Copy object
1421 Handle(GEOM_Function) aFunction;
1423 aCopy = GetEngine()->AddObject(theObject->GetType());
1424 aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
1427 aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
1429 if (aFunction.IsNull()) return NULL;
1431 //Check if the function is set correctly
1432 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1435 GEOMImpl_IScale aTI (aFunction);
1436 aTI.SetShape(anOriginal);
1437 aTI.SetFactorX(theFactorX);
1438 aTI.SetFactorY(theFactorY);
1439 aTI.SetFactorZ(theFactorZ);
1441 // Set point (optional argument)
1442 if (!thePoint.IsNull()) {
1443 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1450 if (!GetSolver()->ComputeFunction(aFunction)) {
1451 SetErrorCode("Scale driver failed");
1455 catch (Standard_Failure& aFail) {
1456 SetErrorCode(aFail.GetMessageString());
1462 //Make a Python command
1464 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
1465 << theObject << ", " << thePoint << ", "
1466 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1470 GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
1471 << theObject << ", " << thePoint << ", "
1472 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1476 //=============================================================================
1480 //=============================================================================
1481 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1482 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1486 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1488 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1489 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1491 //Add a Position function
1492 Standard_Integer aType = POSITION_SHAPE;
1493 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
1495 Handle(GEOM_Function) aFunction =
1496 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1497 if (aFunction.IsNull()) return NULL;
1499 //Check if the function is set correctly
1500 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1502 //Set operation arguments
1503 GEOMImpl_IPosition aTI (aFunction);
1504 aTI.SetShape(anOriginal);
1505 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1506 if (!theStartLCS.IsNull())
1507 aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction());
1509 //Compute the Position
1512 if (!GetSolver()->ComputeFunction(aFunction)) {
1513 SetErrorCode("Position driver failed");
1517 catch (Standard_Failure& aFail) {
1518 SetErrorCode(aFail.GetMessageString());
1522 //Make a Python command
1523 GEOM::TPythonDump(aFunction) << "geompy.Position("
1524 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1530 //=============================================================================
1534 //=============================================================================
1535 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1536 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1540 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1542 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1543 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1545 //Add a new Copy object
1546 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1548 //Add a position function
1549 Standard_Integer aType = POSITION_SHAPE_COPY;
1550 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
1552 Handle(GEOM_Function) aFunction =
1553 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1554 if (aFunction.IsNull()) return NULL;
1556 //Check if the function is set correctly
1557 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1559 GEOMImpl_IPosition aTI (aFunction);
1560 aTI.SetShape(anOriginal);
1561 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1562 if (!theStartLCS.IsNull())
1563 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1565 //Compute the position
1568 if (!GetSolver()->ComputeFunction(aFunction)) {
1569 SetErrorCode("Position driver failed");
1573 catch (Standard_Failure& aFail) {
1574 SetErrorCode(aFail.GetMessageString());
1578 //Make a Python command
1579 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
1580 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1586 //=============================================================================
1590 //=============================================================================
1591 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
1592 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
1593 double theDistance, bool theCopy, bool theReverse)
1597 if (theObject.IsNull() || thePath.IsNull()) return NULL;
1599 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1600 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1602 //Add a position function
1603 Handle(GEOM_Function) aFunction;
1604 Handle(GEOM_Object) aCopy;
1607 aCopy = GetEngine()->AddObject(theObject->GetType());
1608 aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1611 aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1613 if (aFunction.IsNull()) return NULL;
1615 //Check if the function is set correctly
1616 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1618 GEOMImpl_IPosition aTI (aFunction);
1619 aTI.SetShape(anOriginal);
1620 aTI.SetPath(thePath->GetLastFunction());
1621 aTI.SetDistance(theDistance);
1622 aTI.SetReverse(theReverse);
1624 //Compute the position
1627 if (!GetSolver()->ComputeFunction(aFunction)) {
1628 SetErrorCode("Position driver failed");
1632 catch (Standard_Failure& aFail) {
1633 SetErrorCode(aFail.GetMessageString());
1637 //Make a Python command
1639 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
1640 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1645 GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
1646 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1652 //=============================================================================
1656 //=============================================================================
1657 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1658 Handle(GEOM_Object) theAxis,
1663 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1665 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1666 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1668 // Get last functions of the arguments
1669 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1671 //Add a rotate function
1672 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1674 if (aFunction.IsNull()) return NULL;
1676 //Check if the function is set correctly
1677 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1679 GEOMImpl_IRotate aRI(aFunction);
1681 aRI.SetOriginal(aLastFunction);
1682 aRI.SetAngle(theAngle);
1684 //Compute the translation
1687 if (!GetSolver()->ComputeFunction(aFunction)) {
1688 SetErrorCode("Rotate driver failed");
1692 catch (Standard_Failure& aFail) {
1693 SetErrorCode(aFail.GetMessageString());
1697 //Make a Python command
1698 GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
1699 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1705 //=============================================================================
1709 //=============================================================================
1710 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
1711 Handle(GEOM_Object) theAxis,
1716 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1718 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1719 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1721 //Add a new Copy object
1722 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1724 //Add a rotate function
1725 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1726 if (aFunction.IsNull()) return NULL;
1728 //Check if the function is set correctly
1729 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1731 GEOMImpl_IRotate aRI(aFunction);
1732 aRI.SetAxis(theAxis->GetLastFunction());
1733 aRI.SetOriginal(aLastFunction);
1734 aRI.SetAngle(theAngle);
1736 //Compute the translation
1739 if (!GetSolver()->ComputeFunction(aFunction)) {
1740 SetErrorCode("Rotate driver failed");
1744 catch (Standard_Failure& aFail) {
1745 SetErrorCode(aFail.GetMessageString());
1749 //Make a Python command
1750 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
1751 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1757 //=============================================================================
1759 * Rotate1D (for MultiRotate1DNbTimes)
1761 //=============================================================================
1762 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1763 Handle(GEOM_Object) theAxis,
1764 Standard_Integer theNbTimes)
1768 if (theObject.IsNull()) return NULL;
1770 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1771 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1773 //Add a new Copy object
1774 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1776 //Add a rotate function
1777 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1778 if (aFunction.IsNull()) return NULL;
1780 //Check if the function is set correctly
1781 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1783 GEOMImpl_IRotate aRI(aFunction);
1784 aRI.SetOriginal(aLastFunction);
1785 if (!theAxis.IsNull())
1786 aRI.SetAxis(theAxis->GetLastFunction());
1787 aRI.SetNbIter1(theNbTimes);
1789 //Compute the translation
1792 if (!GetSolver()->ComputeFunction(aFunction)) {
1793 SetErrorCode("Rotate driver failed");
1797 catch (Standard_Failure& aFail) {
1798 SetErrorCode(aFail.GetMessageString());
1802 //Make a Python command
1803 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
1804 << theObject << ", " << theAxis << ", " << theNbTimes << ")";
1810 //=============================================================================
1812 * Rotate1D (for MultiRotate1DByStep)
1814 //=============================================================================
1815 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1816 Handle(GEOM_Object) theAxis,
1817 double theAngleStep,
1818 Standard_Integer theNbSteps)
1822 if (theObject.IsNull()) return NULL;
1824 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1825 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1827 //Add a new Copy object
1828 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1830 //Add a rotate function
1831 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
1832 if (aFunction.IsNull()) return NULL;
1834 //Check if the function is set correctly
1835 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1837 //Convert angle into degrees
1838 double anAngleStep = theAngleStep * 180. / M_PI;
1840 GEOMImpl_IRotate aRI (aFunction);
1841 aRI.SetOriginal(aLastFunction);
1842 if (!theAxis.IsNull())
1843 aRI.SetAxis(theAxis->GetLastFunction());
1844 aRI.SetAngle(anAngleStep);
1845 aRI.SetNbIter1(theNbSteps);
1847 //Compute the translation
1850 if (!GetSolver()->ComputeFunction(aFunction)) {
1851 SetErrorCode("Rotate driver failed");
1855 catch (Standard_Failure& aFail) {
1856 SetErrorCode(aFail.GetMessageString());
1860 //Make a Python command
1861 GEOM::TPythonDump(aFunction)
1862 << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
1863 << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
1869 //=============================================================================
1871 * Rotate2D (for MultiRotate2DNbTimes)
1873 //=============================================================================
1874 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1875 Handle(GEOM_Object) theAxis,
1876 Standard_Integer theNbObjects,
1877 double theRadialStep,
1878 Standard_Integer theNbSteps)
1882 if (theObject.IsNull()) return NULL;
1884 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1885 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1887 //Add a new Copy object
1888 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1890 //Add a rotate function
1891 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1892 if (aFunction.IsNull()) return NULL;
1894 //Check if the function is set correctly
1895 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1897 double anAngle = 360. / (double)theNbObjects;
1899 GEOMImpl_IRotate aRI (aFunction);
1900 aRI.SetOriginal(aLastFunction);
1901 if (!theAxis.IsNull())
1902 aRI.SetAxis(theAxis->GetLastFunction());
1903 aRI.SetAngle(anAngle);
1904 aRI.SetNbIter1(theNbObjects);
1905 aRI.SetStep(theRadialStep);
1906 aRI.SetNbIter2(theNbSteps);
1908 //Compute the translation
1911 if (!GetSolver()->ComputeFunction(aFunction)) {
1912 SetErrorCode("Rotate driver failed");
1916 catch (Standard_Failure& aFail) {
1917 SetErrorCode(aFail.GetMessageString());
1921 //Make a Python command
1922 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
1923 << theObject << ", " << theAxis << ", " << theNbObjects
1924 << ", " << theRadialStep << ", " << theNbSteps << ")";
1930 //=============================================================================
1932 * Rotate2D (for MultiRotate2DByStep)
1934 //=============================================================================
1935 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1936 Handle(GEOM_Object) theAxis,
1937 double theAngleStep,
1938 Standard_Integer theNbTimes1,
1940 Standard_Integer theNbTimes2)
1944 if (theObject.IsNull()) return NULL;
1946 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1947 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1949 //Add a new Copy object
1950 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1952 //Add a rotate function
1953 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1954 if (aFunction.IsNull()) return NULL;
1956 //Check if the function is set correctly
1957 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1959 //Convert angle into degrees
1960 double anAngleStep = theAngleStep * 180. / M_PI;
1962 GEOMImpl_IRotate aRI (aFunction);
1963 aRI.SetOriginal(aLastFunction);
1964 if (!theAxis.IsNull())
1965 aRI.SetAxis(theAxis->GetLastFunction());
1966 aRI.SetAngle(anAngleStep);
1967 aRI.SetNbIter1(theNbTimes1);
1968 aRI.SetStep(theStep);
1969 aRI.SetNbIter2(theNbTimes2);
1971 //Compute the translation
1974 if (!GetSolver()->ComputeFunction(aFunction)) {
1975 SetErrorCode("Rotate driver failed");
1979 catch (Standard_Failure& aFail) {
1980 SetErrorCode(aFail.GetMessageString());
1984 //Make a Python command
1985 GEOM::TPythonDump(aFunction)
1986 << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
1987 << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
1988 << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
1994 //=============================================================================
1998 //=============================================================================
1999 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject,
2000 Handle(GEOM_Object) theCentPoint,
2001 Handle(GEOM_Object) thePoint1,
2002 Handle(GEOM_Object) thePoint2)
2006 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2008 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2009 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2011 // Get last functions of the arguments
2012 Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
2013 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
2014 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
2017 //Add a rotate function
2018 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS);
2020 if (aFunction.IsNull()) return NULL;
2022 //Check if the function is set correctly
2023 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2025 GEOMImpl_IRotate aRI(aFunction);
2026 aRI.SetCentPoint(aCPF);
2027 aRI.SetPoint1(aP1F);
2028 aRI.SetPoint2(aP2F);
2029 aRI.SetOriginal(aLastFunction);
2031 //Compute the translation
2034 if (!GetSolver()->ComputeFunction(aFunction)) {
2035 SetErrorCode("Rotate driver failed");
2039 catch (Standard_Failure& aFail) {
2040 SetErrorCode(aFail.GetMessageString());
2044 //Make a Python command
2045 GEOM::TPythonDump(aFunction) << "geompy.RotateThreePoints(" << theObject
2046 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2052 //=============================================================================
2054 * RotateThreePointsCopy
2056 //=============================================================================
2057 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle(GEOM_Object) theObject,
2058 Handle(GEOM_Object) theCentPoint,
2059 Handle(GEOM_Object) thePoint1,
2060 Handle(GEOM_Object) thePoint2)
2064 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2066 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2067 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2069 //Add a new Copy object
2070 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
2072 //Add a rotate function
2073 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
2074 if (aFunction.IsNull()) return NULL;
2076 //Check if the function is set correctly
2077 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2079 GEOMImpl_IRotate aRI(aFunction);
2080 aRI.SetCentPoint(theCentPoint->GetLastFunction());
2081 aRI.SetPoint1(thePoint1->GetLastFunction());
2082 aRI.SetPoint2(thePoint2->GetLastFunction());
2083 aRI.SetOriginal(aLastFunction);
2085 //Compute the translation
2088 if (!GetSolver()->ComputeFunction(aFunction)) {
2089 SetErrorCode("Rotate driver failed");
2093 catch (Standard_Failure& aFail) {
2094 SetErrorCode(aFail.GetMessageString());
2098 //Make a Python command
2099 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
2100 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2106 //=============================================================================
2108 * TransformLikeOtherCopy
2110 //=============================================================================
2111 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
2112 (Handle(GEOM_Object) theObject,
2113 Handle(GEOM_Object) theSample)
2117 if (theObject.IsNull() || theSample.IsNull()) return NULL;
2119 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2120 if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
2122 Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
2123 if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
2125 // Add a new Copy object
2126 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
2128 // Add a transform function (depends on theSample function)
2129 Handle(GEOM_Function) aFunction =
2130 aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
2131 if (aFunction.IsNull()) return NULL;
2133 // Check if the function is set correctly
2134 if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
2136 if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
2137 switch (aSampleFunc->GetType()) {
2140 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2141 GEOMImpl_ITranslate aRI_target (aFunction);
2143 aRI_target.SetVector(aRI_sample.GetVector());
2144 aRI_target.SetStep1(aRI_sample.GetStep1());
2145 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2147 aRI_target.SetOriginal(aLastFunction);
2152 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2153 GEOMImpl_ITranslate aRI_target (aFunction);
2155 aRI_target.SetVector(aRI_sample.GetVector());
2156 aRI_target.SetStep1(aRI_sample.GetStep1());
2157 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2159 aRI_target.SetVector2(aRI_sample.GetVector2());
2160 aRI_target.SetStep2(aRI_sample.GetStep2());
2161 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2163 aRI_target.SetOriginal(aLastFunction);
2168 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2173 else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
2174 switch (aSampleFunc->GetType()) {
2177 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2178 GEOMImpl_IRotate aRI_target (aFunction);
2180 aRI_target.SetAxis(aRI_sample.GetAxis());
2181 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2183 aRI_target.SetOriginal(aLastFunction);
2188 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2189 GEOMImpl_IRotate aRI_target (aFunction);
2191 aRI_target.SetAxis(aRI_sample.GetAxis());
2193 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2194 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2196 aRI_target.SetAngle(aRI_sample.GetAngle());
2197 aRI_target.SetStep(aRI_sample.GetStep());
2199 aRI_target.SetDir2(aRI_sample.GetDir2());
2201 aRI_target.SetOriginal(aLastFunction);
2204 case ROTATE_THREE_POINTS_COPY:
2206 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2207 GEOMImpl_IRotate aRI_target (aFunction);
2209 aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
2210 aRI_target.SetPoint1(aRI_sample.GetPoint1());
2211 aRI_target.SetPoint2(aRI_sample.GetPoint2());
2213 aRI_target.SetOriginal(aLastFunction);
2218 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2224 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2228 // Compute the transformation
2231 if (!GetSolver()->ComputeFunction(aFunction)) {
2232 SetErrorCode("Driver failed");
2236 catch (Standard_Failure& aFail) {
2237 SetErrorCode(aFail.GetMessageString());
2241 //Make a Python command
2242 //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
2243 // << theObject << ", " << theSample << ")";
2249 //=============================================================================
2251 * MakeProjectionOnCylinder
2253 //=============================================================================
2254 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder
2255 (const Handle(GEOM_Object) &theObject,
2256 const Standard_Real theRadius,
2257 const Standard_Real theStartAngle,
2258 const Standard_Real theAngleLength,
2259 const Standard_Real theAngleRotation)
2263 if (theObject.IsNull()) {
2267 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2269 if (aLastFunction.IsNull()) {
2270 //There is no function which creates an object to be projected
2274 //Add a new Projection object
2275 Handle(GEOM_Object) aResult =
2276 GetEngine()->AddObject(GEOM_PROJECTION);
2278 //Add a Projection function
2279 Handle(GEOM_Function) aFunction = aResult->AddFunction
2280 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_CYLINDER);
2282 //Check if the function is set correctly
2283 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
2287 GEOMImpl_IProjOnCyl aProj (aFunction);
2289 aProj.SetShape(aLastFunction);
2290 aProj.SetRadius(theRadius);
2291 aProj.SetStartAngle(theStartAngle);
2292 aProj.SetAngleLength(theAngleLength);
2293 aProj.SetAngleRotation(theAngleRotation);
2295 //Compute the Projection
2298 if (!GetSolver()->ComputeFunction(aFunction)) {
2299 SetErrorCode("Projection driver failed");
2303 catch (Standard_Failure& aFail) {
2304 SetErrorCode(aFail.GetMessageString());
2308 //Make a Python command
2309 GEOM::TPythonDump(aFunction)
2310 << aResult << " = geompy.MakeProjectionOnCylinder("
2311 << theObject << ", " << theRadius << ", " << theStartAngle
2312 << ", " << theAngleLength << ", " << theAngleRotation << ")";