1 // Copyright (C) 2007-2014 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_IOffset.hxx>
39 #include <GEOMImpl_IScale.hxx>
40 #include <GEOMImpl_IRotate.hxx>
41 #include <GEOMImpl_IPosition.hxx>
43 #include <GEOMImpl_Types.hxx>
45 #include <GEOM_Function.hxx>
46 #include <GEOM_PythonDump.hxx>
48 #include <Basics_OCCTVersion.hxx>
50 #include "utilities.h"
52 #include <Utils_ExceptHandlers.hxx>
54 #include <TFunction_DriverTable.hxx>
55 #include <TFunction_Driver.hxx>
56 #include <TFunction_Logbook.hxx>
57 #include <TDF_Tool.hxx>
59 #include <BRep_Tool.hxx>
60 #include <BRep_Builder.hxx>
63 #include <TopoDS_Edge.hxx>
64 #include <TopoDS_Vertex.hxx>
65 #include <TopoDS_Compound.hxx>
68 #include <gp_Trsf.hxx>
70 #include <StdFail_NotDone.hxx>
71 #include <Standard_Failure.hxx>
72 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
74 //=============================================================================
78 //=============================================================================
80 GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine, int theDocID)
81 : GEOM_IOperations(theEngine, theDocID)
83 MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations");
86 //=============================================================================
90 //=============================================================================
92 GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations()
94 MESSAGE("GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations");
98 //=============================================================================
102 //=============================================================================
103 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
104 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
108 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
110 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
111 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
113 // Get last functions of the arguments
114 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
115 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
117 //Add a translate function
118 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS);
120 if (aFunction.IsNull()) return NULL;
122 //Check if the function is set correctly
123 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
125 GEOMImpl_ITranslate aTI (aFunction);
128 aTI.SetOriginal(aLastFunction);
130 //Compute the translation
133 if (!GetSolver()->ComputeFunction(aFunction)) {
134 SetErrorCode("Translation driver failed");
138 catch (Standard_Failure) {
139 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
140 SetErrorCode(aFail->GetMessageString());
144 //Make a Python command
145 GEOM::TPythonDump(aFunction) << "geompy.TranslateTwoPoints("
146 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
152 //=============================================================================
156 //=============================================================================
157 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
158 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
162 if (theObject.IsNull()) return NULL;
164 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
165 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
167 //Add a translate function
168 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ);
170 if (aFunction.IsNull()) return NULL;
172 //Check if the function is set correctly
173 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
175 GEOMImpl_ITranslate aTI(aFunction);
179 aTI.SetOriginal(aLastFunction);
181 //Compute the translation
184 if (!GetSolver()->ComputeFunction(aFunction)) {
185 SetErrorCode("Translation driver failed");
189 catch (Standard_Failure) {
190 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
191 SetErrorCode(aFail->GetMessageString());
195 //Make a Python command
196 GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ("
197 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
204 //=============================================================================
206 * TranslateTwoPointsCopy
208 //=============================================================================
209 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
210 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
214 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
216 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
217 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
219 //Add a new Copy object
220 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
222 //Add a translate function
223 Handle(GEOM_Function) aFunction =
224 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS_COPY);
226 //Check if the function is set correctly
227 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
229 GEOMImpl_ITranslate aTI(aFunction);
230 aTI.SetPoint1(thePoint1->GetLastFunction());
231 aTI.SetPoint2(thePoint2->GetLastFunction());
232 //aTI.SetShape(theObject->GetValue());
233 aTI.SetOriginal(aLastFunction);
235 //Compute the translation
238 if (!GetSolver()->ComputeFunction(aFunction)) {
239 SetErrorCode("Translation driver failed");
243 catch (Standard_Failure) {
244 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
245 SetErrorCode(aFail->GetMessageString());
249 //Make a Python command
250 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints("
251 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
257 //=============================================================================
259 * TranslateDXDYDZCopy
261 //=============================================================================
262 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
263 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
267 if (theObject.IsNull()) return NULL;
269 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
270 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
272 //Add a new Copy object
273 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
275 //Add a translate function
276 Handle(GEOM_Function) aFunction =
277 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ_COPY);
279 //Check if the function is set correctly
280 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
282 GEOMImpl_ITranslate aTI(aFunction);
286 aTI.SetOriginal(aLastFunction);
288 //Compute the translation
291 if (!GetSolver()->ComputeFunction(aFunction)) {
292 SetErrorCode("Translation driver failed");
296 catch (Standard_Failure) {
297 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
298 SetErrorCode(aFail->GetMessageString());
302 //Make a Python command
303 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation("
304 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
311 //=============================================================================
315 //=============================================================================
316 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
317 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
321 if (theObject.IsNull() || theVector.IsNull()) return NULL;
323 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
324 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
326 // Get last functions of the arguments
327 Handle(GEOM_Function) aVF = theVector->GetLastFunction();
329 //Add a translate function
330 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR);
332 if (aFunction.IsNull()) return NULL;
334 //Check if the function is set correctly
335 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
337 GEOMImpl_ITranslate aTI (aFunction);
339 aTI.SetOriginal(aLastFunction);
341 //Compute the translation
344 if (!GetSolver()->ComputeFunction(aFunction)) {
345 SetErrorCode("Translation driver failed");
349 catch (Standard_Failure) {
350 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
351 SetErrorCode(aFail->GetMessageString());
355 //Make a Python command
356 GEOM::TPythonDump(aFunction) << "geompy.TranslateVector("
357 << theObject << ", " << theVector << ")";
362 //=============================================================================
364 * TranslateVectorCopy
366 //=============================================================================
367 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
368 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
372 if (theObject.IsNull() || theVector.IsNull()) return NULL;
374 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
375 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
377 //Add a new Copy object
378 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
380 //Add a translate function
381 Handle(GEOM_Function) aFunction =
382 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_COPY);
384 //Check if the function is set correctly
385 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
387 GEOMImpl_ITranslate aTI(aFunction);
388 aTI.SetVector(theVector->GetLastFunction());
389 // aTI.SetShape(theObject->GetValue());
390 aTI.SetOriginal(aLastFunction);
392 //Compute the translation
395 if (!GetSolver()->ComputeFunction(aFunction)) {
396 SetErrorCode("Translation driver failed");
400 catch (Standard_Failure) {
401 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
402 SetErrorCode(aFail->GetMessageString());
406 //Make a Python command
407 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector("
408 << theObject << ", " << theVector << ")";
414 //=============================================================================
416 * TranslateVectorDistance
418 //=============================================================================
419 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance
420 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theDistance, bool theCopy)
424 if (theObject.IsNull() || theVector.IsNull()) return NULL;
426 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
427 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
429 Handle(GEOM_Object) aCopy; //Add a new Copy object
430 Handle(GEOM_Function) aFunction;
432 //Add a translate function
434 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
435 aFunction = aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
438 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
440 if (aFunction.IsNull()) return NULL;
442 //Check if the function is set correctly
443 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
445 GEOMImpl_ITranslate aTI(aFunction);
446 aTI.SetVector(theVector->GetLastFunction());
447 aTI.SetDistance(theDistance);
448 // aTI.SetShape(theObject->GetValue());
449 aTI.SetOriginal(aLastFunction);
451 //Compute the translation
454 if (!GetSolver()->ComputeFunction(aFunction)) {
455 SetErrorCode("Translation driver failed");
459 catch (Standard_Failure) {
460 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
461 SetErrorCode(aFail->GetMessageString());
465 //Make a Python command
467 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVectorDistance("
468 << theObject << ", " << theVector << ", " << theDistance << ")";
473 GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance("
474 << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")";
479 //=============================================================================
483 //=============================================================================
484 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
485 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector,
486 double theStep, Standard_Integer theNbTimes)
490 if (theObject.IsNull()) return NULL;
492 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
493 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
495 //Add a new Copy object
496 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
498 //Add a translate function
499 Handle(GEOM_Function) aFunction =
500 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_1D);
502 //Check if the function is set correctly
503 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
505 GEOMImpl_ITranslate aTI (aFunction);
506 aTI.SetOriginal(aLastFunction);
507 if (!theVector.IsNull())
508 aTI.SetVector(theVector->GetLastFunction());
509 aTI.SetStep1(theStep);
510 aTI.SetNbIter1(theNbTimes);
512 //Compute the translation
515 if (!GetSolver()->ComputeFunction(aFunction)) {
516 SetErrorCode("Translation driver failed");
520 catch (Standard_Failure) {
521 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
522 SetErrorCode(aFail->GetMessageString());
526 //Make a Python command
527 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D("
528 << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")";
534 //=============================================================================
538 //=============================================================================
539 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject,
540 Handle(GEOM_Object) theVector,
542 Standard_Integer theNbTimes1,
543 Handle(GEOM_Object) theVector2,
545 Standard_Integer theNbTimes2)
549 if (theObject.IsNull()) return NULL;
551 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
552 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
554 //Add a new Copy object
555 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
557 //Add a translate function
558 Handle(GEOM_Function) aFunction =
559 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_2D);
561 //Check if the function is set correctly
562 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
564 GEOMImpl_ITranslate aTI (aFunction);
565 aTI.SetOriginal(aLastFunction);
566 if (!theVector.IsNull())
567 aTI.SetVector(theVector->GetLastFunction());
568 aTI.SetStep1(theStep1);
569 aTI.SetNbIter1(theNbTimes1);
570 if (!theVector2.IsNull())
571 aTI.SetVector2(theVector2->GetLastFunction());
572 aTI.SetStep2(theStep2);
573 aTI.SetNbIter2(theNbTimes2);
575 //Compute the translation
578 if (!GetSolver()->ComputeFunction(aFunction)) {
579 SetErrorCode("Translation driver failed");
583 catch (Standard_Failure) {
584 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
585 SetErrorCode(aFail->GetMessageString());
589 //Make a Python command
590 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D("
591 << theObject << ", " << theVector << ", " << theStep1 << ", " << theNbTimes1
592 << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")";
598 //=============================================================================
602 //=============================================================================
604 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape1D (const TopoDS_Shape& theShape,
605 GEOMImpl_ITranslate* theTI)
610 Handle(GEOM_Function) aVector = theTI->GetVector();
611 if (aVector.IsNull()) {
612 StdFail_NotDone::Raise("Invalid object is given for vector argument");
614 TopoDS_Shape aV = aVector->GetValue();
615 if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) {
616 StdFail_NotDone::Raise("Invalid object is given for vector argument");
618 TopoDS_Edge anEdge = TopoDS::Edge(aV);
620 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
621 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
622 if (aP1.Distance(aP2) < gp::Resolution()) {
623 StdFail_NotDone::Raise("Invalid object is given for vector argument");
627 Standard_Real step = theTI->GetStep1();
628 Standard_Integer nbtimes = theTI->GetNbIter1();
630 // Make multi-translation
633 TopoDS_Compound aCompound;
635 B.MakeCompound(aCompound);
637 gp_Vec Vec (aP1, aP2);
640 TopLoc_Location aLocOrig = theShape.Location();
641 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
643 for (int i = 0; i < nbtimes; i++) {
644 aVec = Vec * (i * step);
645 aTrsf.SetTranslation(aVec);
646 //NPAL18620: performance problem: multiple locations are accumulated
647 // in shape and need a great time to process
648 //BRepBuilderAPI_Transform aTransformation(theShape, aTrsf, Standard_False);
649 //B.Add(aCompound, aTransformation.Shape());
650 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
651 B.Add(aCompound, theShape.Located(aLocRes));
659 //=============================================================================
663 //=============================================================================
665 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape2D (const TopoDS_Shape& theShape,
666 GEOMImpl_ITranslate* theTI)
671 Handle(GEOM_Function) aVector1 = theTI->GetVector();
672 Handle(GEOM_Function) aVector2 = theTI->GetVector2();
674 if (aVector1.IsNull() || aVector2.IsNull()) {
675 StdFail_NotDone::Raise("Invalid object is given for vector argument");
678 TopoDS_Shape aV1 = aVector1->GetValue();
679 TopoDS_Shape aV2 = aVector2->GetValue();
681 if (aV1.IsNull() || aV1.ShapeType() != TopAbs_EDGE ||
682 aV2.IsNull() || aV2.ShapeType() != TopAbs_EDGE) {
683 StdFail_NotDone::Raise("Invalid object is given for vector argument");
686 TopoDS_Edge anEdge1 = TopoDS::Edge(aV1);
687 TopoDS_Edge anEdge2 = TopoDS::Edge(aV2);
689 gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1));
690 gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge1));
691 gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2));
692 gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge2));
694 if (aP11.Distance(aP12) < gp::Resolution() ||
695 aP21.Distance(aP22) < gp::Resolution()) {
696 StdFail_NotDone::Raise("Invalid object is given for vector argument");
699 gp_Vec Vec1 (aP11, aP12);
700 gp_Vec Vec2 (aP21, aP22);
706 Standard_Real step1 = theTI->GetStep1(), step2 = theTI->GetStep2();
707 Standard_Integer nbtimes1 = theTI->GetNbIter1(), nbtimes2 = theTI->GetNbIter2();
709 // Make multi-translation
712 Standard_Real DX, DY, DZ;
713 TopoDS_Compound aCompound;
715 B.MakeCompound(aCompound);
717 TopLoc_Location aLocOrig = theShape.Location();
718 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
720 for (int i = 0; i < nbtimes1; i++) {
721 for (int j = 0; j < nbtimes2; j++) {
722 DX = i * step1 * Vec1.X() + j * step2 * Vec2.X();
723 DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y();
724 DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z();
725 aVec.SetCoord(DX, DY, DZ);
726 aTrsf.SetTranslation(aVec);
727 //NPAL18620: performance problem: multiple locations are accumulated
728 // in shape and need a great time to process
729 //BRepBuilderAPI_Transform aBRepTransformation(theShape, aTrsf, Standard_False);
730 //B.Add(aCompound, aBRepTransformation.Shape());
731 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
732 B.Add(aCompound, theShape.Located(aLocRes));
741 //=============================================================================
745 //=============================================================================
746 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
747 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
751 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
753 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
754 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
756 // Get last functions of the arguments
757 Handle(GEOM_Function) aPF = thePlane->GetLastFunction();
759 //Add a mirror function
760 Handle(GEOM_Function) aFunction =
761 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE);
762 if (aFunction.IsNull()) return NULL;
764 //Check if the function is set correctly
765 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
767 GEOMImpl_IMirror aTI (aFunction);
769 aTI.SetOriginal(aLastFunction);
774 if (!GetSolver()->ComputeFunction(aFunction)) {
775 SetErrorCode("Mirror driver failed");
779 catch (Standard_Failure) {
780 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
781 SetErrorCode(aFail->GetMessageString());
785 //Make a Python command
786 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPlane("
787 << theObject << ", " << thePlane << ")";
793 //=============================================================================
797 //=============================================================================
798 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
799 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
803 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
805 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
806 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
808 //Add a new Copy object
809 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
811 //Add a mirror function
812 Handle(GEOM_Function) aFunction =
813 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE_COPY);
815 //Check if the function is set correctly
816 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
818 GEOMImpl_IMirror aTI (aFunction);
819 aTI.SetPlane(thePlane->GetLastFunction());
820 aTI.SetOriginal(aLastFunction);
825 if (!GetSolver()->ComputeFunction(aFunction)) {
826 SetErrorCode("Mirror driver failed");
830 catch (Standard_Failure) {
831 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
832 SetErrorCode(aFail->GetMessageString());
836 //Make a Python command
837 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane("
838 << theObject << ", " << thePlane << ")";
844 //=============================================================================
848 //=============================================================================
849 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
850 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
854 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
856 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
857 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
859 // Get last functions of the arguments
860 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
862 //Add a mirror function
863 Handle(GEOM_Function) aFunction =
864 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT);
865 if (aFunction.IsNull()) return NULL;
867 //Check if the function is set correctly
868 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
870 GEOMImpl_IMirror aTI (aFunction);
872 aTI.SetOriginal(aLastFunction);
877 if (!GetSolver()->ComputeFunction(aFunction)) {
878 SetErrorCode("Mirror driver failed");
882 catch (Standard_Failure) {
883 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
884 SetErrorCode(aFail->GetMessageString());
888 //Make a Python command
889 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPoint("
890 << theObject << ", " << thePoint << ")";
896 //=============================================================================
900 //=============================================================================
901 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
902 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
906 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
908 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
909 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
911 //Add a new Copy object
912 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
914 //Add a mirror function
915 Handle(GEOM_Function) aFunction =
916 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT_COPY);
918 //Check if the function is set correctly
919 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
921 GEOMImpl_IMirror aTI (aFunction);
922 aTI.SetPoint(thePoint->GetLastFunction());
923 aTI.SetOriginal(aLastFunction);
928 if (!GetSolver()->ComputeFunction(aFunction)) {
929 SetErrorCode("Mirror driver failed");
933 catch (Standard_Failure) {
934 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
935 SetErrorCode(aFail->GetMessageString());
939 //Make a Python command
940 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint("
941 << theObject << ", " << thePoint << ")";
947 //=============================================================================
951 //=============================================================================
952 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
953 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
957 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
959 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
960 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
962 // Get last functions of the arguments
963 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
965 //Add a mirror function
966 Handle(GEOM_Function) aFunction =
967 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS);
968 if (aFunction.IsNull()) return NULL;
970 //Check if the function is set correctly
971 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
973 GEOMImpl_IMirror aTI (aFunction);
975 aTI.SetOriginal(aLastFunction);
980 if (!GetSolver()->ComputeFunction(aFunction)) {
981 SetErrorCode("Mirror driver failed");
985 catch (Standard_Failure) {
986 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
987 SetErrorCode(aFail->GetMessageString());
991 //Make a Python command
992 GEOM::TPythonDump(aFunction) << "geompy.MirrorByAxis("
993 << theObject << ", " << theAxis << ")";
999 //=============================================================================
1003 //=============================================================================
1004 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
1005 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
1009 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1011 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
1012 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
1014 //Add a new Copy object
1015 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1017 //Add a mirror function
1018 Handle(GEOM_Function) aFunction =
1019 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS_COPY);
1021 //Check if the function is set correctly
1022 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
1024 GEOMImpl_IMirror aTI (aFunction);
1025 aTI.SetAxis(theAxis->GetLastFunction());
1026 aTI.SetOriginal(aLastFunction);
1028 //Compute the mirror
1031 if (!GetSolver()->ComputeFunction(aFunction)) {
1032 SetErrorCode("Mirror driver failed");
1036 catch (Standard_Failure) {
1037 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1038 SetErrorCode(aFail->GetMessageString());
1042 //Make a Python command
1043 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis("
1044 << theObject << ", " << theAxis << ")";
1051 //=============================================================================
1055 //=============================================================================
1056 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
1057 (Handle(GEOM_Object) theObject, double theOffset)
1061 if (theObject.IsNull()) return NULL;
1063 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1064 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1066 //Add a new Offset function
1067 Handle(GEOM_Function) aFunction =
1068 theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE);
1069 if (aFunction.IsNull()) return NULL;
1071 //Check if the function is set correctly
1072 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1074 GEOMImpl_IOffset aTI (aFunction);
1075 aTI.SetShape(anOriginal);
1076 aTI.SetValue(theOffset);
1078 //Compute the offset
1081 if (!GetSolver()->ComputeFunction(aFunction)) {
1082 SetErrorCode("Offset driver failed");
1086 catch (Standard_Failure) {
1087 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1088 SetErrorCode(aFail->GetMessageString());
1092 //Make a Python command
1093 GEOM::TPythonDump(aFunction) << "geompy.Offset("
1094 << theObject << ", " << theOffset << ")";
1100 //=============================================================================
1104 //=============================================================================
1105 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
1106 (Handle(GEOM_Object) theObject, double theOffset)
1110 if (theObject.IsNull()) return NULL;
1112 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1113 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1115 //Add a new Copy object
1116 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1118 //Add a new Offset function
1119 Handle(GEOM_Function) aFunction =
1120 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
1121 if (aFunction.IsNull()) return NULL;
1123 //Check if the function is set correctly
1124 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1126 GEOMImpl_IOffset aTI (aFunction);
1127 aTI.SetShape(anOriginal);
1128 aTI.SetValue(theOffset);
1130 //Compute the offset
1133 if (!GetSolver()->ComputeFunction(aFunction)) {
1134 SetErrorCode("Offset driver failed");
1138 catch (Standard_Failure) {
1139 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1140 SetErrorCode(aFail->GetMessageString());
1144 //Make a Python command
1145 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
1146 << theObject << ", " << theOffset << ")";
1153 //=============================================================================
1157 //=============================================================================
1158 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ProjectShapeCopy
1159 (Handle(GEOM_Object) theSource, Handle(GEOM_Object) theTarget)
1163 if (theSource.IsNull() || theTarget.IsNull()) return NULL;
1165 Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
1166 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
1168 //Add a new Projection object
1169 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1171 //Add a Projection function
1172 Handle(GEOM_Function) aFunction =
1173 aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
1175 //Check if the function is set correctly
1176 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
1178 GEOMImpl_IMirror aTI (aFunction);
1179 aTI.SetPlane(theTarget->GetLastFunction());
1180 aTI.SetOriginal(aLastFunction);
1182 //Compute the Projection
1185 if (!GetSolver()->ComputeFunction(aFunction)) {
1186 SetErrorCode("Projection driver failed");
1190 catch (Standard_Failure) {
1191 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1192 SetErrorCode(aFail->GetMessageString());
1196 //Make a Python command
1197 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
1198 << theSource << ", " << theTarget << ")";
1204 //=============================================================================
1206 * ProjectPointOnWire
1208 //=============================================================================
1209 Standard_Real GEOMImpl_ITransformOperations::ProjectPointOnWire
1210 (Handle(GEOM_Object) thePoint,
1211 Handle(GEOM_Object) theWire,
1212 Handle(GEOM_Object) &thePointOnEdge,
1213 Standard_Integer &theEdgeInWireIndex)
1215 Standard_Real aResult = -1.;
1219 if (thePoint.IsNull() || theWire.IsNull()) {
1223 Handle(GEOM_Function) aLastFunction = thePoint->GetLastFunction();
1225 if (aLastFunction.IsNull()) {
1226 //There is no function which creates an object to be projected
1230 //Add a new Projection object
1231 thePointOnEdge = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1233 //Add a Projection function
1234 Handle(GEOM_Function) aFunction = thePointOnEdge->AddFunction
1235 (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_WIRE);
1237 //Check if the function is set correctly
1238 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
1242 GEOMImpl_IProjection aProj (aFunction);
1243 aProj.SetPoint(aLastFunction);
1244 aProj.SetShape(theWire->GetLastFunction());
1246 //Compute the Projection
1249 if (!GetSolver()->ComputeFunction(aFunction)) {
1250 SetErrorCode("Projection driver failed");
1254 catch (Standard_Failure) {
1255 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1256 SetErrorCode(aFail->GetMessageString());
1260 aResult = aProj.GetU();
1261 theEdgeInWireIndex = aProj.GetIndex();
1264 //Make a Python command
1265 GEOM::TPythonDump(aFunction) << "(u, " << thePointOnEdge
1266 << ", EdgeInWireIndex) = geompy.MakeProjectionOnWire(" << thePoint
1267 << ", " << theWire << ")";
1274 //=============================================================================
1278 //=============================================================================
1279 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
1280 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1284 if (theObject.IsNull()) return NULL;
1286 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1287 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1289 //Add a scale function
1290 Handle(GEOM_Function) aFunction =
1291 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1292 if (aFunction.IsNull()) return NULL;
1294 //Check if the function is set correctly
1295 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1298 GEOMImpl_IScale aTI (aFunction);
1299 aTI.SetShape(anOriginal);
1300 aTI.SetFactor(theFactor);
1302 // Set point argument
1303 if (!thePoint.IsNull()) {
1304 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1311 if (!GetSolver()->ComputeFunction(aFunction)) {
1312 SetErrorCode("Scale driver failed");
1316 catch (Standard_Failure) {
1317 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1318 SetErrorCode(aFail->GetMessageString());
1322 //Make a Python command
1323 GEOM::TPythonDump(aFunction) << "geompy.Scale("
1324 << theObject << ", " << thePoint << ", " << theFactor << ")";
1330 //=============================================================================
1334 //=============================================================================
1335 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1336 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1340 if (theObject.IsNull()) return NULL;
1342 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1343 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1345 //Add a new Copy object
1346 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1348 //Add a scale function
1349 Handle(GEOM_Function) aFunction =
1350 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1351 if (aFunction.IsNull()) return NULL;
1353 //Check if the function is set correctly
1354 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1357 GEOMImpl_IScale aTI (aFunction);
1358 aTI.SetShape(anOriginal);
1359 aTI.SetFactor(theFactor);
1361 // Set point argument
1362 if (!thePoint.IsNull()) {
1363 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1370 if (!GetSolver()->ComputeFunction(aFunction)) {
1371 SetErrorCode("Scale driver failed");
1375 catch (Standard_Failure) {
1376 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1377 SetErrorCode(aFail->GetMessageString());
1381 //Make a Python command
1382 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
1383 << theObject << ", " << thePoint << ", " << theFactor << ")";
1389 //=============================================================================
1391 * ScaleShapeAlongAxes
1393 //=============================================================================
1394 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
1395 Handle(GEOM_Object) thePoint,
1403 if (theObject.IsNull()) return NULL;
1405 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1406 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1408 //Add a scale function
1409 Handle(GEOM_Object) aCopy; //Add a new Copy object
1410 Handle(GEOM_Function) aFunction;
1412 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1413 aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
1416 aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
1418 if (aFunction.IsNull()) return NULL;
1420 //Check if the function is set correctly
1421 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1424 GEOMImpl_IScale aTI (aFunction);
1425 aTI.SetShape(anOriginal);
1426 aTI.SetFactorX(theFactorX);
1427 aTI.SetFactorY(theFactorY);
1428 aTI.SetFactorZ(theFactorZ);
1430 // Set point (optional argument)
1431 if (!thePoint.IsNull()) {
1432 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1439 if (!GetSolver()->ComputeFunction(aFunction)) {
1440 SetErrorCode("Scale driver failed");
1444 catch (Standard_Failure) {
1445 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1446 SetErrorCode(aFail->GetMessageString());
1452 //Make a Python command
1454 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
1455 << theObject << ", " << thePoint << ", "
1456 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1460 GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
1461 << theObject << ", " << thePoint << ", "
1462 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1466 //=============================================================================
1470 //=============================================================================
1471 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1472 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1476 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1478 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1479 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1481 //Add a Position function
1482 Standard_Integer aType = POSITION_SHAPE;
1483 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
1485 Handle(GEOM_Function) aFunction =
1486 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1487 if (aFunction.IsNull()) return NULL;
1489 //Check if the function is set correctly
1490 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1492 //Set operation arguments
1493 GEOMImpl_IPosition aTI (aFunction);
1494 aTI.SetShape(anOriginal);
1495 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1496 if (!theStartLCS.IsNull())
1497 aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction());
1499 //Compute the Position
1502 if (!GetSolver()->ComputeFunction(aFunction)) {
1503 SetErrorCode("Position driver failed");
1507 catch (Standard_Failure) {
1508 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1509 SetErrorCode(aFail->GetMessageString());
1513 //Make a Python command
1514 GEOM::TPythonDump(aFunction) << "geompy.Position("
1515 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1521 //=============================================================================
1525 //=============================================================================
1526 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1527 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1531 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1533 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1534 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1536 //Add a new Copy object
1537 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1539 //Add a position function
1540 Standard_Integer aType = POSITION_SHAPE_COPY;
1541 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
1543 Handle(GEOM_Function) aFunction =
1544 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1545 if (aFunction.IsNull()) return NULL;
1547 //Check if the function is set correctly
1548 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1550 GEOMImpl_IPosition aTI (aFunction);
1551 aTI.SetShape(anOriginal);
1552 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1553 if (!theStartLCS.IsNull())
1554 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1556 //Compute the position
1559 if (!GetSolver()->ComputeFunction(aFunction)) {
1560 SetErrorCode("Position driver failed");
1564 catch (Standard_Failure) {
1565 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1566 SetErrorCode(aFail->GetMessageString());
1570 //Make a Python command
1571 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
1572 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1578 //=============================================================================
1582 //=============================================================================
1583 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
1584 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
1585 double theDistance, bool theCopy, bool theReverse)
1589 if (theObject.IsNull() || thePath.IsNull()) return NULL;
1591 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1592 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1594 //Add a position function
1595 Handle(GEOM_Function) aFunction;
1596 Handle(GEOM_Object) aCopy;
1599 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1600 aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1603 aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1605 if (aFunction.IsNull()) return NULL;
1607 //Check if the function is set correctly
1608 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1610 GEOMImpl_IPosition aTI (aFunction);
1611 aTI.SetShape(anOriginal);
1612 aTI.SetPath(thePath->GetLastFunction());
1613 aTI.SetDistance(theDistance);
1614 aTI.SetReverse(theReverse);
1616 //Compute the position
1619 if (!GetSolver()->ComputeFunction(aFunction)) {
1620 SetErrorCode("Position driver failed");
1624 catch (Standard_Failure) {
1625 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1626 SetErrorCode(aFail->GetMessageString());
1630 //Make a Python command
1632 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
1633 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1638 GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
1639 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1645 //=============================================================================
1649 //=============================================================================
1650 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1651 Handle(GEOM_Object) theAxis,
1656 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1658 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1659 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1661 // Get last functions of the arguments
1662 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1664 //Add a rotate function
1665 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1667 if (aFunction.IsNull()) return NULL;
1669 //Check if the function is set correctly
1670 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1672 GEOMImpl_IRotate aRI(aFunction);
1674 aRI.SetOriginal(aLastFunction);
1675 aRI.SetAngle(theAngle);
1677 //Compute the translation
1680 if (!GetSolver()->ComputeFunction(aFunction)) {
1681 SetErrorCode("Rotate driver failed");
1685 catch (Standard_Failure) {
1686 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1687 SetErrorCode(aFail->GetMessageString());
1691 //Make a Python command
1692 GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
1693 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1699 //=============================================================================
1703 //=============================================================================
1704 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
1705 Handle(GEOM_Object) theAxis,
1710 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1712 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1713 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1715 //Add a new Copy object
1716 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1718 //Add a rotate function
1719 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1720 if (aFunction.IsNull()) return NULL;
1722 //Check if the function is set correctly
1723 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1725 GEOMImpl_IRotate aRI(aFunction);
1726 aRI.SetAxis(theAxis->GetLastFunction());
1727 aRI.SetOriginal(aLastFunction);
1728 aRI.SetAngle(theAngle);
1730 //Compute the translation
1733 if (!GetSolver()->ComputeFunction(aFunction)) {
1734 SetErrorCode("Rotate driver failed");
1738 catch (Standard_Failure) {
1739 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1740 SetErrorCode(aFail->GetMessageString());
1744 //Make a Python command
1745 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
1746 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1752 //=============================================================================
1754 * Rotate1D (for MultiRotate1DNbTimes)
1756 //=============================================================================
1757 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1758 Handle(GEOM_Object) theAxis,
1759 Standard_Integer theNbTimes)
1763 if (theObject.IsNull()) return NULL;
1765 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1766 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1768 //Add a new Copy object
1769 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1771 //Add a rotate function
1772 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1773 if (aFunction.IsNull()) return NULL;
1775 //Check if the function is set correctly
1776 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1778 GEOMImpl_IRotate aRI(aFunction);
1779 aRI.SetOriginal(aLastFunction);
1780 if (!theAxis.IsNull())
1781 aRI.SetAxis(theAxis->GetLastFunction());
1782 aRI.SetNbIter1(theNbTimes);
1784 //Compute the translation
1787 if (!GetSolver()->ComputeFunction(aFunction)) {
1788 SetErrorCode("Rotate driver failed");
1792 catch (Standard_Failure) {
1793 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1794 SetErrorCode(aFail->GetMessageString());
1798 //Make a Python command
1799 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
1800 << theObject << ", " << theAxis << ", " << theNbTimes << ")";
1806 //=============================================================================
1808 * Rotate1D (for MultiRotate1DByStep)
1810 //=============================================================================
1811 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1812 Handle(GEOM_Object) theAxis,
1813 double theAngleStep,
1814 Standard_Integer theNbSteps)
1818 if (theObject.IsNull()) return NULL;
1820 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1821 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1823 //Add a new Copy object
1824 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1826 //Add a rotate function
1827 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
1828 if (aFunction.IsNull()) return NULL;
1830 //Check if the function is set correctly
1831 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1833 //Convert angle into degrees
1834 double anAngleStep = theAngleStep * 180. / M_PI;
1836 GEOMImpl_IRotate aRI (aFunction);
1837 aRI.SetOriginal(aLastFunction);
1838 if (!theAxis.IsNull())
1839 aRI.SetAxis(theAxis->GetLastFunction());
1840 aRI.SetAngle(anAngleStep);
1841 aRI.SetNbIter1(theNbSteps);
1843 //Compute the translation
1846 if (!GetSolver()->ComputeFunction(aFunction)) {
1847 SetErrorCode("Rotate driver failed");
1851 catch (Standard_Failure) {
1852 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1853 SetErrorCode(aFail->GetMessageString());
1857 //Make a Python command
1858 GEOM::TPythonDump(aFunction)
1859 << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
1860 << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
1866 //=============================================================================
1868 * Rotate2D (for MultiRotate2DNbTimes)
1870 //=============================================================================
1871 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1872 Handle(GEOM_Object) theAxis,
1873 Standard_Integer theNbObjects,
1874 double theRadialStep,
1875 Standard_Integer theNbSteps)
1879 if (theObject.IsNull()) return NULL;
1881 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1882 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1884 //Add a new Copy object
1885 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1887 //Add a rotate function
1888 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1889 if (aFunction.IsNull()) return NULL;
1891 //Check if the function is set correctly
1892 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1894 double anAngle = 360. / (double)theNbObjects;
1896 GEOMImpl_IRotate aRI (aFunction);
1897 aRI.SetOriginal(aLastFunction);
1898 if (!theAxis.IsNull())
1899 aRI.SetAxis(theAxis->GetLastFunction());
1900 aRI.SetAngle(anAngle);
1901 aRI.SetNbIter1(theNbObjects);
1902 aRI.SetStep(theRadialStep);
1903 aRI.SetNbIter2(theNbSteps);
1905 //Compute the translation
1908 if (!GetSolver()->ComputeFunction(aFunction)) {
1909 SetErrorCode("Rotate driver failed");
1913 catch (Standard_Failure) {
1914 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1915 SetErrorCode(aFail->GetMessageString());
1919 //Make a Python command
1920 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
1921 << theObject << ", " << theAxis << ", " << theNbObjects
1922 << ", " << theRadialStep << ", " << theNbSteps << ")";
1928 //=============================================================================
1930 * Rotate2D (for MultiRotate2DByStep)
1932 //=============================================================================
1933 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1934 Handle(GEOM_Object) theAxis,
1935 double theAngleStep,
1936 Standard_Integer theNbTimes1,
1938 Standard_Integer theNbTimes2)
1942 if (theObject.IsNull()) return NULL;
1944 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1945 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1947 //Add a new Copy object
1948 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1950 //Add a rotate function
1951 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1952 if (aFunction.IsNull()) return NULL;
1954 //Check if the function is set correctly
1955 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1957 //Convert angle into degrees
1958 double anAngleStep = theAngleStep * 180. / M_PI;
1960 GEOMImpl_IRotate aRI (aFunction);
1961 aRI.SetOriginal(aLastFunction);
1962 if (!theAxis.IsNull())
1963 aRI.SetAxis(theAxis->GetLastFunction());
1964 aRI.SetAngle(anAngleStep);
1965 aRI.SetNbIter1(theNbTimes1);
1966 aRI.SetStep(theStep);
1967 aRI.SetNbIter2(theNbTimes2);
1969 //Compute the translation
1972 if (!GetSolver()->ComputeFunction(aFunction)) {
1973 SetErrorCode("Rotate driver failed");
1977 catch (Standard_Failure) {
1978 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
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) {
2039 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
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(GetDocID(), theObject->GetType());
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) {
2094 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2095 SetErrorCode(aFail->GetMessageString());
2099 //Make a Python command
2100 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
2101 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2107 //=============================================================================
2109 * TransformLikeOtherCopy
2111 //=============================================================================
2112 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
2113 (Handle(GEOM_Object) theObject,
2114 Handle(GEOM_Object) theSample)
2118 if (theObject.IsNull() || theSample.IsNull()) return NULL;
2120 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2121 if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
2123 Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
2124 if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
2126 // Add a new Copy object
2127 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
2129 // Add a transform function (depends on theSample function)
2130 Handle(GEOM_Function) aFunction =
2131 aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
2132 if (aFunction.IsNull()) return NULL;
2134 // Check if the function is set correctly
2135 if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
2137 if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
2138 switch (aSampleFunc->GetType()) {
2141 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2142 GEOMImpl_ITranslate aRI_target (aFunction);
2144 aRI_target.SetVector(aRI_sample.GetVector());
2145 aRI_target.SetStep1(aRI_sample.GetStep1());
2146 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2148 aRI_target.SetOriginal(aLastFunction);
2153 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2154 GEOMImpl_ITranslate aRI_target (aFunction);
2156 aRI_target.SetVector(aRI_sample.GetVector());
2157 aRI_target.SetStep1(aRI_sample.GetStep1());
2158 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2160 aRI_target.SetVector2(aRI_sample.GetVector2());
2161 aRI_target.SetStep2(aRI_sample.GetStep2());
2162 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2164 aRI_target.SetOriginal(aLastFunction);
2169 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2174 else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
2175 switch (aSampleFunc->GetType()) {
2178 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2179 GEOMImpl_IRotate aRI_target (aFunction);
2181 aRI_target.SetAxis(aRI_sample.GetAxis());
2182 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2184 aRI_target.SetOriginal(aLastFunction);
2189 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2190 GEOMImpl_IRotate aRI_target (aFunction);
2192 aRI_target.SetAxis(aRI_sample.GetAxis());
2194 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2195 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2197 aRI_target.SetAngle(aRI_sample.GetAngle());
2198 aRI_target.SetStep(aRI_sample.GetStep());
2200 aRI_target.SetDir2(aRI_sample.GetDir2());
2202 aRI_target.SetOriginal(aLastFunction);
2205 case ROTATE_THREE_POINTS_COPY:
2207 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2208 GEOMImpl_IRotate aRI_target (aFunction);
2210 aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
2211 aRI_target.SetPoint1(aRI_sample.GetPoint1());
2212 aRI_target.SetPoint2(aRI_sample.GetPoint2());
2214 aRI_target.SetOriginal(aLastFunction);
2219 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2225 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2229 // Compute the transformation
2232 if (!GetSolver()->ComputeFunction(aFunction)) {
2233 SetErrorCode("Driver failed");
2237 catch (Standard_Failure) {
2238 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2239 SetErrorCode(aFail->GetMessageString());
2243 //Make a Python command
2244 //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
2245 // << theObject << ", " << theSample << ")";