1 // Copyright (C) 2007-2022 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"
50 #include <Utils_ExceptHandlers.hxx>
52 #include <TFunction_DriverTable.hxx>
53 #include <TFunction_Driver.hxx>
54 #include <TDF_Tool.hxx>
56 #include <BRep_Tool.hxx>
57 #include <BRep_Builder.hxx>
60 #include <TopoDS_Edge.hxx>
61 #include <TopoDS_Vertex.hxx>
62 #include <TopoDS_Compound.hxx>
65 #include <gp_Trsf.hxx>
67 #include <StdFail_NotDone.hxx>
68 #include <Standard_Failure.hxx>
69 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
71 //=============================================================================
75 //=============================================================================
77 GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine)
78 : GEOM_IOperations(theEngine)
80 MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations");
83 //=============================================================================
87 //=============================================================================
89 GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations()
91 MESSAGE("GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations");
95 //=============================================================================
99 //=============================================================================
100 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
101 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
105 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
107 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
108 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
110 // Get last functions of the arguments
111 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
112 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
114 //Add a translate function
115 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS);
117 if (aFunction.IsNull()) return NULL;
119 //Check if the function is set correctly
120 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
122 GEOMImpl_ITranslate aTI (aFunction);
125 aTI.SetOriginal(aLastFunction);
127 //Compute the translation
130 if (!GetSolver()->ComputeFunction(aFunction)) {
131 SetErrorCode("Translation driver failed");
135 catch (Standard_Failure& aFail) {
136 SetErrorCode(aFail.GetMessageString());
140 //Make a Python command
141 GEOM::TPythonDump(aFunction) << "geompy.TranslateTwoPoints("
142 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
148 //=============================================================================
152 //=============================================================================
153 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
154 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
158 if (theObject.IsNull()) return NULL;
160 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
161 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
163 //Add a translate function
164 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ);
166 if (aFunction.IsNull()) return NULL;
168 //Check if the function is set correctly
169 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
171 GEOMImpl_ITranslate aTI(aFunction);
175 aTI.SetOriginal(aLastFunction);
177 //Compute the translation
180 if (!GetSolver()->ComputeFunction(aFunction)) {
181 SetErrorCode("Translation driver failed");
185 catch (Standard_Failure& aFail) {
186 SetErrorCode(aFail.GetMessageString());
190 //Make a Python command
191 GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ("
192 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
199 //=============================================================================
201 * TranslateTwoPointsCopy
203 //=============================================================================
204 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
205 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
209 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
211 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
212 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
214 //Add a new Copy object
215 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
217 //Add a translate function
218 Handle(GEOM_Function) aFunction =
219 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS_COPY);
221 //Check if the function is set correctly
222 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
224 GEOMImpl_ITranslate aTI(aFunction);
225 aTI.SetPoint1(thePoint1->GetLastFunction());
226 aTI.SetPoint2(thePoint2->GetLastFunction());
227 //aTI.SetShape(theObject->GetValue());
228 aTI.SetOriginal(aLastFunction);
230 //Compute the translation
233 if (!GetSolver()->ComputeFunction(aFunction)) {
234 SetErrorCode("Translation driver failed");
238 catch (Standard_Failure& aFail) {
239 SetErrorCode(aFail.GetMessageString());
243 //Make a Python command
244 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints("
245 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
251 //=============================================================================
253 * TranslateDXDYDZCopy
255 //=============================================================================
256 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
257 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
261 if (theObject.IsNull()) return NULL;
263 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
264 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
266 //Add a new Copy object
267 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
269 //Add a translate function
270 Handle(GEOM_Function) aFunction =
271 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ_COPY);
273 //Check if the function is set correctly
274 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
276 GEOMImpl_ITranslate aTI(aFunction);
280 aTI.SetOriginal(aLastFunction);
282 //Compute the translation
285 if (!GetSolver()->ComputeFunction(aFunction)) {
286 SetErrorCode("Translation driver failed");
290 catch (Standard_Failure& aFail) {
291 SetErrorCode(aFail.GetMessageString());
295 //Make a Python command
296 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation("
297 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
304 //=============================================================================
308 //=============================================================================
309 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
310 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
314 if (theObject.IsNull() || theVector.IsNull()) return NULL;
316 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
317 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
319 // Get last functions of the arguments
320 Handle(GEOM_Function) aVF = theVector->GetLastFunction();
322 //Add a translate function
323 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR);
325 if (aFunction.IsNull()) return NULL;
327 //Check if the function is set correctly
328 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
330 GEOMImpl_ITranslate aTI (aFunction);
332 aTI.SetOriginal(aLastFunction);
334 //Compute the translation
337 if (!GetSolver()->ComputeFunction(aFunction)) {
338 SetErrorCode("Translation driver failed");
342 catch (Standard_Failure& aFail) {
343 SetErrorCode(aFail.GetMessageString());
347 //Make a Python command
348 GEOM::TPythonDump(aFunction) << "geompy.TranslateVector("
349 << theObject << ", " << theVector << ")";
354 //=============================================================================
356 * TranslateVectorCopy
358 //=============================================================================
359 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
360 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
364 if (theObject.IsNull() || theVector.IsNull()) return NULL;
366 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
367 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
369 //Add a new Copy object
370 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
372 //Add a translate function
373 Handle(GEOM_Function) aFunction =
374 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_COPY);
376 //Check if the function is set correctly
377 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
379 GEOMImpl_ITranslate aTI(aFunction);
380 aTI.SetVector(theVector->GetLastFunction());
381 // aTI.SetShape(theObject->GetValue());
382 aTI.SetOriginal(aLastFunction);
384 //Compute the translation
387 if (!GetSolver()->ComputeFunction(aFunction)) {
388 SetErrorCode("Translation driver failed");
392 catch (Standard_Failure& aFail) {
393 SetErrorCode(aFail.GetMessageString());
397 //Make a Python command
398 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector("
399 << theObject << ", " << theVector << ")";
405 //=============================================================================
407 * TranslateVectorDistance
409 //=============================================================================
410 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance
411 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theDistance, bool theCopy)
415 if (theObject.IsNull() || theVector.IsNull()) return NULL;
417 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
418 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
420 Handle(GEOM_Object) aCopy; //Add a new Copy object
421 Handle(GEOM_Function) aFunction;
423 //Add a translate function
425 aCopy = GetEngine()->AddObject(theObject->GetType());
426 aFunction = aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
429 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
431 if (aFunction.IsNull()) return NULL;
433 //Check if the function is set correctly
434 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
436 GEOMImpl_ITranslate aTI(aFunction);
437 aTI.SetVector(theVector->GetLastFunction());
438 aTI.SetDistance(theDistance);
439 // aTI.SetShape(theObject->GetValue());
440 aTI.SetOriginal(aLastFunction);
442 //Compute the translation
445 if (!GetSolver()->ComputeFunction(aFunction)) {
446 SetErrorCode("Translation driver failed");
450 catch (Standard_Failure& aFail) {
451 SetErrorCode(aFail.GetMessageString());
455 //Make a Python command
457 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVectorDistance("
458 << theObject << ", " << theVector << ", " << theDistance << ")";
463 GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance("
464 << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")";
469 //=============================================================================
473 //=============================================================================
474 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
475 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector,
476 double theStep, Standard_Integer theNbTimes)
480 if (theObject.IsNull()) return NULL;
482 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
483 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
485 //Add a new Copy object
486 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
488 //Add a translate function
489 Handle(GEOM_Function) aFunction =
490 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_1D);
492 //Check if the function is set correctly
493 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
495 GEOMImpl_ITranslate aTI (aFunction);
496 aTI.SetOriginal(aLastFunction);
497 if (!theVector.IsNull())
498 aTI.SetVector(theVector->GetLastFunction());
499 aTI.SetStep1(theStep);
500 aTI.SetNbIter1(theNbTimes);
502 //Compute the translation
505 if (!GetSolver()->ComputeFunction(aFunction)) {
506 SetErrorCode("Translation driver failed");
510 catch (Standard_Failure& aFail) {
511 SetErrorCode(aFail.GetMessageString());
515 //Make a Python command
516 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D("
517 << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")";
523 //=============================================================================
527 //=============================================================================
528 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject,
529 Handle(GEOM_Object) theVector,
531 Standard_Integer theNbTimes1,
532 Handle(GEOM_Object) theVector2,
534 Standard_Integer theNbTimes2)
538 if (theObject.IsNull()) return NULL;
540 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
541 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
543 //Add a new Copy object
544 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
546 //Add a translate function
547 Handle(GEOM_Function) aFunction =
548 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_2D);
550 //Check if the function is set correctly
551 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
553 GEOMImpl_ITranslate aTI (aFunction);
554 aTI.SetOriginal(aLastFunction);
555 if (!theVector.IsNull())
556 aTI.SetVector(theVector->GetLastFunction());
557 aTI.SetStep1(theStep1);
558 aTI.SetNbIter1(theNbTimes1);
559 if (!theVector2.IsNull())
560 aTI.SetVector2(theVector2->GetLastFunction());
561 aTI.SetStep2(theStep2);
562 aTI.SetNbIter2(theNbTimes2);
564 //Compute the translation
567 if (!GetSolver()->ComputeFunction(aFunction)) {
568 SetErrorCode("Translation driver failed");
572 catch (Standard_Failure& aFail) {
573 SetErrorCode(aFail.GetMessageString());
577 //Make a Python command
578 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D("
579 << theObject << ", " << theVector << ", " << theStep1 << ", " << theNbTimes1
580 << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")";
586 //=============================================================================
590 //=============================================================================
592 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape1D (const TopoDS_Shape& theShape,
593 GEOMImpl_ITranslate* theTI)
598 Handle(GEOM_Function) aVector = theTI->GetVector();
599 if (aVector.IsNull()) {
600 StdFail_NotDone::Raise("Invalid object is given for vector argument");
602 TopoDS_Shape aV = aVector->GetValue();
603 if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) {
604 StdFail_NotDone::Raise("Invalid object is given for vector argument");
606 TopoDS_Edge anEdge = TopoDS::Edge(aV);
608 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
609 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
610 if (aP1.Distance(aP2) < gp::Resolution()) {
611 StdFail_NotDone::Raise("Invalid object is given for vector argument");
615 Standard_Real step = theTI->GetStep1();
616 Standard_Integer nbtimes = theTI->GetNbIter1();
618 // Make multi-translation
621 TopoDS_Compound aCompound;
623 B.MakeCompound(aCompound);
625 gp_Vec Vec (aP1, aP2);
628 TopLoc_Location aLocOrig = theShape.Location();
629 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
631 for (int i = 0; i < nbtimes; i++) {
632 aVec = Vec * (i * step);
633 aTrsf.SetTranslation(aVec);
634 //NPAL18620: performance problem: multiple locations are accumulated
635 // in shape and need a great time to process
636 //BRepBuilderAPI_Transform aTransformation(theShape, aTrsf, Standard_False);
637 //B.Add(aCompound, aTransformation.Shape());
638 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
639 B.Add(aCompound, theShape.Located(aLocRes));
647 //=============================================================================
651 //=============================================================================
653 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape2D (const TopoDS_Shape& theShape,
654 GEOMImpl_ITranslate* theTI)
659 Handle(GEOM_Function) aVector1 = theTI->GetVector();
660 Handle(GEOM_Function) aVector2 = theTI->GetVector2();
662 if (aVector1.IsNull() || aVector2.IsNull()) {
663 StdFail_NotDone::Raise("Invalid object is given for vector argument");
666 TopoDS_Shape aV1 = aVector1->GetValue();
667 TopoDS_Shape aV2 = aVector2->GetValue();
669 if (aV1.IsNull() || aV1.ShapeType() != TopAbs_EDGE ||
670 aV2.IsNull() || aV2.ShapeType() != TopAbs_EDGE) {
671 StdFail_NotDone::Raise("Invalid object is given for vector argument");
674 TopoDS_Edge anEdge1 = TopoDS::Edge(aV1);
675 TopoDS_Edge anEdge2 = TopoDS::Edge(aV2);
677 gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1));
678 gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge1));
679 gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2));
680 gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge2));
682 if (aP11.Distance(aP12) < gp::Resolution() ||
683 aP21.Distance(aP22) < gp::Resolution()) {
684 StdFail_NotDone::Raise("Invalid object is given for vector argument");
687 gp_Vec Vec1 (aP11, aP12);
688 gp_Vec Vec2 (aP21, aP22);
694 Standard_Real step1 = theTI->GetStep1(), step2 = theTI->GetStep2();
695 Standard_Integer nbtimes1 = theTI->GetNbIter1(), nbtimes2 = theTI->GetNbIter2();
697 // Make multi-translation
700 Standard_Real DX, DY, DZ;
701 TopoDS_Compound aCompound;
703 B.MakeCompound(aCompound);
705 TopLoc_Location aLocOrig = theShape.Location();
706 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
708 for (int i = 0; i < nbtimes1; i++) {
709 for (int j = 0; j < nbtimes2; j++) {
710 DX = i * step1 * Vec1.X() + j * step2 * Vec2.X();
711 DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y();
712 DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z();
713 aVec.SetCoord(DX, DY, DZ);
714 aTrsf.SetTranslation(aVec);
715 //NPAL18620: performance problem: multiple locations are accumulated
716 // in shape and need a great time to process
717 //BRepBuilderAPI_Transform aBRepTransformation(theShape, aTrsf, Standard_False);
718 //B.Add(aCompound, aBRepTransformation.Shape());
719 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
720 B.Add(aCompound, theShape.Located(aLocRes));
729 //=============================================================================
733 //=============================================================================
734 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
735 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
739 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
741 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
742 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
744 // Get last functions of the arguments
745 Handle(GEOM_Function) aPF = thePlane->GetLastFunction();
747 //Add a mirror function
748 Handle(GEOM_Function) aFunction =
749 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE);
750 if (aFunction.IsNull()) return NULL;
752 //Check if the function is set correctly
753 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
755 GEOMImpl_IMirror aTI (aFunction);
757 aTI.SetOriginal(aLastFunction);
762 if (!GetSolver()->ComputeFunction(aFunction)) {
763 SetErrorCode("Mirror driver failed");
767 catch (Standard_Failure& aFail) {
768 SetErrorCode(aFail.GetMessageString());
772 //Make a Python command
773 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPlane("
774 << theObject << ", " << thePlane << ")";
780 //=============================================================================
784 //=============================================================================
785 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
786 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
790 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
792 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
793 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
795 //Add a new Copy object
796 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
798 //Add a mirror function
799 Handle(GEOM_Function) aFunction =
800 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE_COPY);
802 //Check if the function is set correctly
803 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
805 GEOMImpl_IMirror aTI (aFunction);
806 aTI.SetPlane(thePlane->GetLastFunction());
807 aTI.SetOriginal(aLastFunction);
812 if (!GetSolver()->ComputeFunction(aFunction)) {
813 SetErrorCode("Mirror driver failed");
817 catch (Standard_Failure& aFail) {
818 SetErrorCode(aFail.GetMessageString());
822 //Make a Python command
823 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane("
824 << theObject << ", " << thePlane << ")";
830 //=============================================================================
834 //=============================================================================
835 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
836 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
840 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
842 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
843 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
845 // Get last functions of the arguments
846 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
848 //Add a mirror function
849 Handle(GEOM_Function) aFunction =
850 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT);
851 if (aFunction.IsNull()) return NULL;
853 //Check if the function is set correctly
854 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
856 GEOMImpl_IMirror aTI (aFunction);
858 aTI.SetOriginal(aLastFunction);
863 if (!GetSolver()->ComputeFunction(aFunction)) {
864 SetErrorCode("Mirror driver failed");
868 catch (Standard_Failure& aFail) {
869 SetErrorCode(aFail.GetMessageString());
873 //Make a Python command
874 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPoint("
875 << theObject << ", " << thePoint << ")";
881 //=============================================================================
885 //=============================================================================
886 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
887 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
891 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
893 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
894 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
896 //Add a new Copy object
897 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
899 //Add a mirror function
900 Handle(GEOM_Function) aFunction =
901 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT_COPY);
903 //Check if the function is set correctly
904 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
906 GEOMImpl_IMirror aTI (aFunction);
907 aTI.SetPoint(thePoint->GetLastFunction());
908 aTI.SetOriginal(aLastFunction);
913 if (!GetSolver()->ComputeFunction(aFunction)) {
914 SetErrorCode("Mirror driver failed");
918 catch (Standard_Failure& aFail) {
919 SetErrorCode(aFail.GetMessageString());
923 //Make a Python command
924 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint("
925 << theObject << ", " << thePoint << ")";
931 //=============================================================================
935 //=============================================================================
936 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
937 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
941 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
943 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
944 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
946 // Get last functions of the arguments
947 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
949 //Add a mirror function
950 Handle(GEOM_Function) aFunction =
951 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS);
952 if (aFunction.IsNull()) return NULL;
954 //Check if the function is set correctly
955 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
957 GEOMImpl_IMirror aTI (aFunction);
959 aTI.SetOriginal(aLastFunction);
964 if (!GetSolver()->ComputeFunction(aFunction)) {
965 SetErrorCode("Mirror driver failed");
969 catch (Standard_Failure& aFail) {
970 SetErrorCode(aFail.GetMessageString());
974 //Make a Python command
975 GEOM::TPythonDump(aFunction) << "geompy.MirrorByAxis("
976 << theObject << ", " << theAxis << ")";
982 //=============================================================================
986 //=============================================================================
987 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
988 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
992 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
994 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
995 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
997 //Add a new Copy object
998 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1000 //Add a mirror function
1001 Handle(GEOM_Function) aFunction =
1002 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS_COPY);
1004 //Check if the function is set correctly
1005 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
1007 GEOMImpl_IMirror aTI (aFunction);
1008 aTI.SetAxis(theAxis->GetLastFunction());
1009 aTI.SetOriginal(aLastFunction);
1011 //Compute the mirror
1014 if (!GetSolver()->ComputeFunction(aFunction)) {
1015 SetErrorCode("Mirror driver failed");
1019 catch (Standard_Failure& aFail) {
1020 SetErrorCode(aFail.GetMessageString());
1024 //Make a Python command
1025 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis("
1026 << theObject << ", " << theAxis << ")";
1033 //=============================================================================
1037 //=============================================================================
1039 GEOMImpl_ITransformOperations::OffsetShape (Handle(GEOM_Object) theObject,
1041 bool theJoinByPipes)
1045 if (theObject.IsNull()) return NULL;
1047 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1048 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1050 //Add a new Offset function
1051 Handle(GEOM_Function) aFunction =
1052 theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE);
1053 if (aFunction.IsNull()) return NULL;
1055 //Check if the function is set correctly
1056 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1058 GEOMImpl_IOffset aTI (aFunction);
1059 aTI.SetShape( anOriginal );
1060 aTI.SetValue( theOffset );
1061 aTI.SetJoinByPipes( theJoinByPipes );
1063 //Compute the offset
1066 if (!GetSolver()->ComputeFunction(aFunction)) {
1067 SetErrorCode("Offset driver failed");
1071 catch (Standard_Failure& aFail) {
1072 SetErrorCode(aFail.GetMessageString());
1076 //Make a Python command
1078 GEOM::TPythonDump(aFunction) << "geompy.Offset("
1079 << theObject << ", " << theOffset << ")";
1081 GEOM::TPythonDump(aFunction) << theObject << " = geompy.MakeOffsetIntersectionJoin("
1082 << theObject << ", " << theOffset << ")";
1088 //=============================================================================
1092 //=============================================================================
1094 GEOMImpl_ITransformOperations::OffsetShapeCopy( Handle(GEOM_Object) theObject,
1096 bool theJoinByPipes)
1100 if (theObject.IsNull()) return NULL;
1102 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1103 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1105 //Add a new Copy object
1106 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1108 //Add a new Offset function
1109 Handle(GEOM_Function) aFunction =
1110 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
1111 if (aFunction.IsNull()) return NULL;
1113 //Check if the function is set correctly
1114 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1116 GEOMImpl_IOffset aTI (aFunction);
1117 aTI.SetShape( anOriginal );
1118 aTI.SetValue( theOffset );
1119 aTI.SetJoinByPipes( theJoinByPipes );
1121 //Compute the offset
1124 if (!GetSolver()->ComputeFunction(aFunction)) {
1125 SetErrorCode("Offset driver failed");
1129 catch (Standard_Failure& aFail) {
1130 SetErrorCode(aFail.GetMessageString());
1134 //Make a Python command
1136 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
1137 << theObject << ", " << theOffset << ")";
1139 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffsetIntersectionJoin("
1140 << theObject << ", " << theOffset << ")";
1147 //=============================================================================
1151 //=============================================================================
1153 GEOMImpl_ITransformOperations::ProjectShapeCopy (Handle(GEOM_Object) theSource,
1154 Handle(GEOM_Object) theTarget)
1158 if (theSource.IsNull() || theTarget.IsNull()) return NULL;
1160 Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
1161 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
1163 Handle(GEOM_Object) aCopy;
1165 TopoDS_Shape aTarget = theTarget->GetValue();
1166 if ( aTarget.IsNull() ) return NULL;
1167 if ( aTarget.ShapeType() == TopAbs_EDGE ||
1168 aTarget.ShapeType() == TopAbs_WIRE )
1170 // a TPythonDump prevents dumping ProjectPointOnWire(),
1171 // dump of MakeProjection() is done at the end of this function
1172 GEOM::TPythonDump preventDump(aLastFunction, /*append=*/true);
1173 Standard_Integer dummy;
1174 ProjectPointOnWire( theSource, theTarget, aCopy, dummy );
1175 if ( aCopy.IsNull() || !IsDone() )
1180 //Add a new Projection object
1181 aCopy = GetEngine()->AddObject(GEOM_PROJECTION);
1183 //Add a Projection function
1184 Handle(GEOM_Function) aFunction =
1185 aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
1187 //Check if the function is set correctly
1188 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
1190 GEOMImpl_IMirror aTI (aFunction);
1191 aTI.SetPlane(theTarget->GetLastFunction());
1192 aTI.SetOriginal(aLastFunction);
1194 //Compute the Projection
1197 if (!GetSolver()->ComputeFunction(aFunction)) {
1198 SetErrorCode("Projection driver failed");
1202 catch (Standard_Failure& aFail) {
1203 SetErrorCode(aFail.GetMessageString());
1208 //Make a Python command
1209 Handle(GEOM_Function) aFunction = aCopy->GetLastFunction();
1210 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
1211 << theSource << ", " << theTarget << ")";
1217 //=============================================================================
1219 * ProjectPointOnWire
1221 //=============================================================================
1222 Standard_Real GEOMImpl_ITransformOperations::ProjectPointOnWire
1223 (Handle(GEOM_Object) thePoint,
1224 Handle(GEOM_Object) theWire,
1225 Handle(GEOM_Object) &thePointOnEdge,
1226 Standard_Integer &theEdgeInWireIndex)
1228 Standard_Real aResult = -1.;
1232 if (thePoint.IsNull() || theWire.IsNull()) {
1236 Handle(GEOM_Function) aLastFunction = thePoint->GetLastFunction();
1238 if (aLastFunction.IsNull()) {
1239 //There is no function which creates an object to be projected
1243 //Add a new Projection object
1244 thePointOnEdge = GetEngine()->AddObject(GEOM_PROJECTION);
1246 //Add a Projection function
1247 Handle(GEOM_Function) aFunction = thePointOnEdge->AddFunction
1248 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_WIRE);
1250 //Check if the function is set correctly
1251 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
1255 GEOMImpl_IProjection aProj (aFunction);
1256 aProj.SetPoint(aLastFunction);
1257 aProj.SetShape(theWire->GetLastFunction());
1259 //Compute the Projection
1262 if (!GetSolver()->ComputeFunction(aFunction)) {
1263 SetErrorCode("Projection driver failed");
1267 catch (Standard_Failure& aFail) {
1268 SetErrorCode(aFail.GetMessageString());
1272 aResult = aProj.GetU();
1273 theEdgeInWireIndex = aProj.GetIndex();
1276 //Make a Python command
1277 GEOM::TPythonDump(aFunction) << "(u, " << thePointOnEdge
1278 << ", EdgeInWireIndex) = geompy.MakeProjectionOnWire(" << thePoint
1279 << ", " << theWire << ")";
1286 //=============================================================================
1290 //=============================================================================
1291 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
1292 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1296 if (theObject.IsNull()) return NULL;
1298 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1299 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1301 //Add a scale function
1302 Handle(GEOM_Function) aFunction =
1303 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1304 if (aFunction.IsNull()) return NULL;
1306 //Check if the function is set correctly
1307 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1310 GEOMImpl_IScale aTI (aFunction);
1311 aTI.SetShape(anOriginal);
1312 aTI.SetFactor(theFactor);
1314 // Set point argument
1315 if (!thePoint.IsNull()) {
1316 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1323 if (!GetSolver()->ComputeFunction(aFunction)) {
1324 SetErrorCode("Scale driver failed");
1328 catch (Standard_Failure& aFail) {
1329 SetErrorCode(aFail.GetMessageString());
1333 //Make a Python command
1334 GEOM::TPythonDump(aFunction) << "geompy.Scale("
1335 << theObject << ", " << thePoint << ", " << theFactor << ")";
1341 //=============================================================================
1345 //=============================================================================
1346 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1347 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1351 if (theObject.IsNull()) return NULL;
1353 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1354 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1356 //Add a new Copy object
1357 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1359 //Add a scale function
1360 Handle(GEOM_Function) aFunction =
1361 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1362 if (aFunction.IsNull()) return NULL;
1364 //Check if the function is set correctly
1365 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1368 GEOMImpl_IScale aTI (aFunction);
1369 aTI.SetShape(anOriginal);
1370 aTI.SetFactor(theFactor);
1372 // Set point argument
1373 if (!thePoint.IsNull()) {
1374 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1381 if (!GetSolver()->ComputeFunction(aFunction)) {
1382 SetErrorCode("Scale driver failed");
1386 catch (Standard_Failure& aFail) {
1387 SetErrorCode(aFail.GetMessageString());
1391 //Make a Python command
1392 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
1393 << theObject << ", " << thePoint << ", " << theFactor << ")";
1399 //=============================================================================
1401 * ScaleShapeAlongAxes
1403 //=============================================================================
1404 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
1405 Handle(GEOM_Object) thePoint,
1413 if (theObject.IsNull()) return NULL;
1415 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1416 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1418 //Add a scale function
1419 Handle(GEOM_Object) aCopy; //Add a new Copy object
1420 Handle(GEOM_Function) aFunction;
1422 aCopy = GetEngine()->AddObject(theObject->GetType());
1423 aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
1426 aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
1428 if (aFunction.IsNull()) return NULL;
1430 //Check if the function is set correctly
1431 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1434 GEOMImpl_IScale aTI (aFunction);
1435 aTI.SetShape(anOriginal);
1436 aTI.SetFactorX(theFactorX);
1437 aTI.SetFactorY(theFactorY);
1438 aTI.SetFactorZ(theFactorZ);
1440 // Set point (optional argument)
1441 if (!thePoint.IsNull()) {
1442 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1449 if (!GetSolver()->ComputeFunction(aFunction)) {
1450 SetErrorCode("Scale driver failed");
1454 catch (Standard_Failure& aFail) {
1455 SetErrorCode(aFail.GetMessageString());
1461 //Make a Python command
1463 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
1464 << theObject << ", " << thePoint << ", "
1465 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1469 GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
1470 << theObject << ", " << thePoint << ", "
1471 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1475 //=============================================================================
1479 //=============================================================================
1480 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1481 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1485 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1487 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1488 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1490 //Add a Position function
1491 Standard_Integer aType = POSITION_SHAPE;
1492 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
1494 Handle(GEOM_Function) aFunction =
1495 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1496 if (aFunction.IsNull()) return NULL;
1498 //Check if the function is set correctly
1499 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1501 //Set operation arguments
1502 GEOMImpl_IPosition aTI (aFunction);
1503 aTI.SetShape(anOriginal);
1504 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1505 if (!theStartLCS.IsNull())
1506 aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction());
1508 //Compute the Position
1511 if (!GetSolver()->ComputeFunction(aFunction)) {
1512 SetErrorCode("Position driver failed");
1516 catch (Standard_Failure& aFail) {
1517 SetErrorCode(aFail.GetMessageString());
1521 //Make a Python command
1522 GEOM::TPythonDump(aFunction) << "geompy.Position("
1523 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1529 //=============================================================================
1533 //=============================================================================
1534 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1535 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1539 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1541 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1542 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1544 //Add a new Copy object
1545 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1547 //Add a position function
1548 Standard_Integer aType = POSITION_SHAPE_COPY;
1549 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
1551 Handle(GEOM_Function) aFunction =
1552 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1553 if (aFunction.IsNull()) return NULL;
1555 //Check if the function is set correctly
1556 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1558 GEOMImpl_IPosition aTI (aFunction);
1559 aTI.SetShape(anOriginal);
1560 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1561 if (!theStartLCS.IsNull())
1562 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1564 //Compute the position
1567 if (!GetSolver()->ComputeFunction(aFunction)) {
1568 SetErrorCode("Position driver failed");
1572 catch (Standard_Failure& aFail) {
1573 SetErrorCode(aFail.GetMessageString());
1577 //Make a Python command
1578 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
1579 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1585 //=============================================================================
1589 //=============================================================================
1590 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
1591 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
1592 double theDistance, bool theCopy, bool theReverse)
1596 if (theObject.IsNull() || thePath.IsNull()) return NULL;
1598 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1599 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1601 //Add a position function
1602 Handle(GEOM_Function) aFunction;
1603 Handle(GEOM_Object) aCopy;
1606 aCopy = GetEngine()->AddObject(theObject->GetType());
1607 aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1610 aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1612 if (aFunction.IsNull()) return NULL;
1614 //Check if the function is set correctly
1615 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1617 GEOMImpl_IPosition aTI (aFunction);
1618 aTI.SetShape(anOriginal);
1619 aTI.SetPath(thePath->GetLastFunction());
1620 aTI.SetDistance(theDistance);
1621 aTI.SetReverse(theReverse);
1623 //Compute the position
1626 if (!GetSolver()->ComputeFunction(aFunction)) {
1627 SetErrorCode("Position driver failed");
1631 catch (Standard_Failure& aFail) {
1632 SetErrorCode(aFail.GetMessageString());
1636 //Make a Python command
1638 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
1639 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1644 GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
1645 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1651 //=============================================================================
1655 //=============================================================================
1656 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1657 Handle(GEOM_Object) theAxis,
1662 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1664 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1665 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1667 // Get last functions of the arguments
1668 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1670 //Add a rotate function
1671 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1673 if (aFunction.IsNull()) return NULL;
1675 //Check if the function is set correctly
1676 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1678 GEOMImpl_IRotate aRI(aFunction);
1680 aRI.SetOriginal(aLastFunction);
1681 aRI.SetAngle(theAngle);
1683 //Compute the translation
1686 if (!GetSolver()->ComputeFunction(aFunction)) {
1687 SetErrorCode("Rotate driver failed");
1691 catch (Standard_Failure& aFail) {
1692 SetErrorCode(aFail.GetMessageString());
1696 //Make a Python command
1697 GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
1698 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1704 //=============================================================================
1708 //=============================================================================
1709 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
1710 Handle(GEOM_Object) theAxis,
1715 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1717 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1718 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1720 //Add a new Copy object
1721 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
1723 //Add a rotate function
1724 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1725 if (aFunction.IsNull()) return NULL;
1727 //Check if the function is set correctly
1728 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1730 GEOMImpl_IRotate aRI(aFunction);
1731 aRI.SetAxis(theAxis->GetLastFunction());
1732 aRI.SetOriginal(aLastFunction);
1733 aRI.SetAngle(theAngle);
1735 //Compute the translation
1738 if (!GetSolver()->ComputeFunction(aFunction)) {
1739 SetErrorCode("Rotate driver failed");
1743 catch (Standard_Failure& aFail) {
1744 SetErrorCode(aFail.GetMessageString());
1748 //Make a Python command
1749 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
1750 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1756 //=============================================================================
1758 * Rotate1D (for MultiRotate1DNbTimes)
1760 //=============================================================================
1761 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1762 Handle(GEOM_Object) theAxis,
1763 Standard_Integer theNbTimes)
1767 if (theObject.IsNull()) return NULL;
1769 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1770 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1772 //Add a new Copy object
1773 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1775 //Add a rotate function
1776 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1777 if (aFunction.IsNull()) return NULL;
1779 //Check if the function is set correctly
1780 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1782 GEOMImpl_IRotate aRI(aFunction);
1783 aRI.SetOriginal(aLastFunction);
1784 if (!theAxis.IsNull())
1785 aRI.SetAxis(theAxis->GetLastFunction());
1786 aRI.SetNbIter1(theNbTimes);
1788 //Compute the translation
1791 if (!GetSolver()->ComputeFunction(aFunction)) {
1792 SetErrorCode("Rotate driver failed");
1796 catch (Standard_Failure& aFail) {
1797 SetErrorCode(aFail.GetMessageString());
1801 //Make a Python command
1802 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
1803 << theObject << ", " << theAxis << ", " << theNbTimes << ")";
1809 //=============================================================================
1811 * Rotate1D (for MultiRotate1DByStep)
1813 //=============================================================================
1814 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1815 Handle(GEOM_Object) theAxis,
1816 double theAngleStep,
1817 Standard_Integer theNbSteps)
1821 if (theObject.IsNull()) return NULL;
1823 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1824 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1826 //Add a new Copy object
1827 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1829 //Add a rotate function
1830 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
1831 if (aFunction.IsNull()) return NULL;
1833 //Check if the function is set correctly
1834 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1836 //Convert angle into degrees
1837 double anAngleStep = theAngleStep * 180. / M_PI;
1839 GEOMImpl_IRotate aRI (aFunction);
1840 aRI.SetOriginal(aLastFunction);
1841 if (!theAxis.IsNull())
1842 aRI.SetAxis(theAxis->GetLastFunction());
1843 aRI.SetAngle(anAngleStep);
1844 aRI.SetNbIter1(theNbSteps);
1846 //Compute the translation
1849 if (!GetSolver()->ComputeFunction(aFunction)) {
1850 SetErrorCode("Rotate driver failed");
1854 catch (Standard_Failure& aFail) {
1855 SetErrorCode(aFail.GetMessageString());
1859 //Make a Python command
1860 GEOM::TPythonDump(aFunction)
1861 << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
1862 << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
1868 //=============================================================================
1870 * Rotate2D (for MultiRotate2DNbTimes)
1872 //=============================================================================
1873 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1874 Handle(GEOM_Object) theAxis,
1875 Standard_Integer theNbObjects,
1876 double theRadialStep,
1877 Standard_Integer theNbSteps)
1881 if (theObject.IsNull()) return NULL;
1883 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1884 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1886 //Add a new Copy object
1887 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1889 //Add a rotate function
1890 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1891 if (aFunction.IsNull()) return NULL;
1893 //Check if the function is set correctly
1894 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1896 double anAngle = 360. / (double)theNbObjects;
1898 GEOMImpl_IRotate aRI (aFunction);
1899 aRI.SetOriginal(aLastFunction);
1900 if (!theAxis.IsNull())
1901 aRI.SetAxis(theAxis->GetLastFunction());
1902 aRI.SetAngle(anAngle);
1903 aRI.SetNbIter1(theNbObjects);
1904 aRI.SetStep(theRadialStep);
1905 aRI.SetNbIter2(theNbSteps);
1907 //Compute the translation
1910 if (!GetSolver()->ComputeFunction(aFunction)) {
1911 SetErrorCode("Rotate driver failed");
1915 catch (Standard_Failure& aFail) {
1916 SetErrorCode(aFail.GetMessageString());
1920 //Make a Python command
1921 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
1922 << theObject << ", " << theAxis << ", " << theNbObjects
1923 << ", " << theRadialStep << ", " << theNbSteps << ")";
1929 //=============================================================================
1931 * Rotate2D (for MultiRotate2DByStep)
1933 //=============================================================================
1934 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1935 Handle(GEOM_Object) theAxis,
1936 double theAngleStep,
1937 Standard_Integer theNbTimes1,
1939 Standard_Integer theNbTimes2)
1943 if (theObject.IsNull()) return NULL;
1945 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1946 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1948 //Add a new Copy object
1949 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
1951 //Add a rotate function
1952 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1953 if (aFunction.IsNull()) return NULL;
1955 //Check if the function is set correctly
1956 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1958 //Convert angle into degrees
1959 double anAngleStep = theAngleStep * 180. / M_PI;
1961 GEOMImpl_IRotate aRI (aFunction);
1962 aRI.SetOriginal(aLastFunction);
1963 if (!theAxis.IsNull())
1964 aRI.SetAxis(theAxis->GetLastFunction());
1965 aRI.SetAngle(anAngleStep);
1966 aRI.SetNbIter1(theNbTimes1);
1967 aRI.SetStep(theStep);
1968 aRI.SetNbIter2(theNbTimes2);
1970 //Compute the translation
1973 if (!GetSolver()->ComputeFunction(aFunction)) {
1974 SetErrorCode("Rotate driver failed");
1978 catch (Standard_Failure& aFail) {
1979 SetErrorCode(aFail.GetMessageString());
1983 //Make a Python command
1984 GEOM::TPythonDump(aFunction)
1985 << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
1986 << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
1987 << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
1993 //=============================================================================
1997 //=============================================================================
1998 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject,
1999 Handle(GEOM_Object) theCentPoint,
2000 Handle(GEOM_Object) thePoint1,
2001 Handle(GEOM_Object) thePoint2)
2005 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2007 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2008 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2010 // Get last functions of the arguments
2011 Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
2012 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
2013 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
2016 //Add a rotate function
2017 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS);
2019 if (aFunction.IsNull()) return NULL;
2021 //Check if the function is set correctly
2022 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2024 GEOMImpl_IRotate aRI(aFunction);
2025 aRI.SetCentPoint(aCPF);
2026 aRI.SetPoint1(aP1F);
2027 aRI.SetPoint2(aP2F);
2028 aRI.SetOriginal(aLastFunction);
2030 //Compute the translation
2033 if (!GetSolver()->ComputeFunction(aFunction)) {
2034 SetErrorCode("Rotate driver failed");
2038 catch (Standard_Failure& aFail) {
2039 SetErrorCode(aFail.GetMessageString());
2043 //Make a Python command
2044 GEOM::TPythonDump(aFunction) << "geompy.RotateThreePoints(" << theObject
2045 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2051 //=============================================================================
2053 * RotateThreePointsCopy
2055 //=============================================================================
2056 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle(GEOM_Object) theObject,
2057 Handle(GEOM_Object) theCentPoint,
2058 Handle(GEOM_Object) thePoint1,
2059 Handle(GEOM_Object) thePoint2)
2063 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2065 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2066 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2068 //Add a new Copy object
2069 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
2071 //Add a rotate function
2072 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
2073 if (aFunction.IsNull()) return NULL;
2075 //Check if the function is set correctly
2076 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2078 GEOMImpl_IRotate aRI(aFunction);
2079 aRI.SetCentPoint(theCentPoint->GetLastFunction());
2080 aRI.SetPoint1(thePoint1->GetLastFunction());
2081 aRI.SetPoint2(thePoint2->GetLastFunction());
2082 aRI.SetOriginal(aLastFunction);
2084 //Compute the translation
2087 if (!GetSolver()->ComputeFunction(aFunction)) {
2088 SetErrorCode("Rotate driver failed");
2092 catch (Standard_Failure& aFail) {
2093 SetErrorCode(aFail.GetMessageString());
2097 //Make a Python command
2098 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
2099 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2105 //=============================================================================
2107 * TransformLikeOtherCopy
2109 //=============================================================================
2110 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
2111 (Handle(GEOM_Object) theObject,
2112 Handle(GEOM_Object) theSample)
2116 if (theObject.IsNull() || theSample.IsNull()) return NULL;
2118 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2119 if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
2121 Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
2122 if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
2124 // Add a new Copy object
2125 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
2127 // Add a transform function (depends on theSample function)
2128 Handle(GEOM_Function) aFunction =
2129 aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
2130 if (aFunction.IsNull()) return NULL;
2132 // Check if the function is set correctly
2133 if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
2135 if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
2136 switch (aSampleFunc->GetType()) {
2139 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2140 GEOMImpl_ITranslate aRI_target (aFunction);
2142 aRI_target.SetVector(aRI_sample.GetVector());
2143 aRI_target.SetStep1(aRI_sample.GetStep1());
2144 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2146 aRI_target.SetOriginal(aLastFunction);
2151 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2152 GEOMImpl_ITranslate aRI_target (aFunction);
2154 aRI_target.SetVector(aRI_sample.GetVector());
2155 aRI_target.SetStep1(aRI_sample.GetStep1());
2156 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2158 aRI_target.SetVector2(aRI_sample.GetVector2());
2159 aRI_target.SetStep2(aRI_sample.GetStep2());
2160 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2162 aRI_target.SetOriginal(aLastFunction);
2167 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2172 else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
2173 switch (aSampleFunc->GetType()) {
2176 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2177 GEOMImpl_IRotate aRI_target (aFunction);
2179 aRI_target.SetAxis(aRI_sample.GetAxis());
2180 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2182 aRI_target.SetOriginal(aLastFunction);
2187 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2188 GEOMImpl_IRotate aRI_target (aFunction);
2190 aRI_target.SetAxis(aRI_sample.GetAxis());
2192 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2193 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2195 aRI_target.SetAngle(aRI_sample.GetAngle());
2196 aRI_target.SetStep(aRI_sample.GetStep());
2198 aRI_target.SetDir2(aRI_sample.GetDir2());
2200 aRI_target.SetOriginal(aLastFunction);
2203 case ROTATE_THREE_POINTS_COPY:
2205 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2206 GEOMImpl_IRotate aRI_target (aFunction);
2208 aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
2209 aRI_target.SetPoint1(aRI_sample.GetPoint1());
2210 aRI_target.SetPoint2(aRI_sample.GetPoint2());
2212 aRI_target.SetOriginal(aLastFunction);
2217 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2223 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2227 // Compute the transformation
2230 if (!GetSolver()->ComputeFunction(aFunction)) {
2231 SetErrorCode("Driver failed");
2235 catch (Standard_Failure& aFail) {
2236 SetErrorCode(aFail.GetMessageString());
2240 //Make a Python command
2241 //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
2242 // << theObject << ", " << theSample << ")";
2248 //=============================================================================
2250 * MakeProjectionOnCylinder
2252 //=============================================================================
2253 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder
2254 (const Handle(GEOM_Object) &theObject,
2255 const Standard_Real theRadius,
2256 const Standard_Real theStartAngle,
2257 const Standard_Real theAngleLength,
2258 const Standard_Real theAngleRotation)
2262 if (theObject.IsNull()) {
2266 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2268 if (aLastFunction.IsNull()) {
2269 //There is no function which creates an object to be projected
2273 //Add a new Projection object
2274 Handle(GEOM_Object) aResult =
2275 GetEngine()->AddObject(GEOM_PROJECTION);
2277 //Add a Projection function
2278 Handle(GEOM_Function) aFunction = aResult->AddFunction
2279 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_CYLINDER);
2281 //Check if the function is set correctly
2282 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
2286 GEOMImpl_IProjOnCyl aProj (aFunction);
2288 aProj.SetShape(aLastFunction);
2289 aProj.SetRadius(theRadius);
2290 aProj.SetStartAngle(theStartAngle);
2291 aProj.SetAngleLength(theAngleLength);
2292 aProj.SetAngleRotation(theAngleRotation);
2294 //Compute the Projection
2297 if (!GetSolver()->ComputeFunction(aFunction)) {
2298 SetErrorCode("Projection driver failed");
2302 catch (Standard_Failure& aFail) {
2303 SetErrorCode(aFail.GetMessageString());
2307 //Make a Python command
2308 GEOM::TPythonDump(aFunction)
2309 << aResult << " = geompy.MakeProjectionOnCylinder("
2310 << theObject << ", " << theRadius << ", " << theStartAngle
2311 << ", " << theAngleLength << ", " << theAngleRotation << ")";