1 // Copyright (C) 2007-2013 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.
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_IOffset.hxx>
38 #include <GEOMImpl_IScale.hxx>
39 #include <GEOMImpl_IRotate.hxx>
40 #include <GEOMImpl_IPosition.hxx>
42 #include <GEOMImpl_Types.hxx>
44 #include <GEOM_Function.hxx>
45 #include <GEOM_PythonDump.hxx>
47 #include <Basics_OCCTVersion.hxx>
49 #include "utilities.h"
51 #include <Utils_ExceptHandlers.hxx>
53 #include <TFunction_DriverTable.hxx>
54 #include <TFunction_Driver.hxx>
55 #include <TFunction_Logbook.hxx>
56 #include <TDF_Tool.hxx>
58 #include <BRep_Tool.hxx>
59 #include <BRep_Builder.hxx>
62 #include <TopoDS_Edge.hxx>
63 #include <TopoDS_Vertex.hxx>
64 #include <TopoDS_Compound.hxx>
67 #include <gp_Trsf.hxx>
69 #include <StdFail_NotDone.hxx>
70 #include <Standard_Failure.hxx>
71 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
73 //=============================================================================
77 //=============================================================================
79 GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine, int theDocID)
80 : GEOM_IOperations(theEngine, theDocID)
82 MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations");
85 //=============================================================================
89 //=============================================================================
91 GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations()
93 MESSAGE("GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations");
97 //=============================================================================
101 //=============================================================================
102 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
103 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
107 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
109 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
110 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
112 // Get last functions of the arguments
113 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
114 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
116 //Add a translate function
117 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS);
119 if (aFunction.IsNull()) return NULL;
121 //Check if the function is set correctly
122 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
124 GEOMImpl_ITranslate aTI (aFunction);
127 aTI.SetOriginal(aLastFunction);
129 //Compute the translation
131 #if OCC_VERSION_LARGE > 0x06010000
134 if (!GetSolver()->ComputeFunction(aFunction)) {
135 SetErrorCode("Translation driver failed");
139 catch (Standard_Failure) {
140 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
141 SetErrorCode(aFail->GetMessageString());
145 //Make a Python command
146 GEOM::TPythonDump(aFunction) << "geompy.TranslateTwoPoints("
147 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
153 //=============================================================================
157 //=============================================================================
158 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
159 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
163 if (theObject.IsNull()) return NULL;
165 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
166 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
168 //Add a translate function
169 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ);
171 if (aFunction.IsNull()) return NULL;
173 //Check if the function is set correctly
174 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
176 GEOMImpl_ITranslate aTI(aFunction);
180 aTI.SetOriginal(aLastFunction);
182 //Compute the translation
184 #if OCC_VERSION_LARGE > 0x06010000
187 if (!GetSolver()->ComputeFunction(aFunction)) {
188 SetErrorCode("Translation driver failed");
192 catch (Standard_Failure) {
193 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
194 SetErrorCode(aFail->GetMessageString());
198 //Make a Python command
199 GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ("
200 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
207 //=============================================================================
209 * TranslateTwoPointsCopy
211 //=============================================================================
212 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
213 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
217 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
219 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
220 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
222 //Add a new Copy object
223 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
225 //Add a translate function
226 Handle(GEOM_Function) aFunction =
227 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS_COPY);
229 //Check if the function is set correctly
230 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
232 GEOMImpl_ITranslate aTI(aFunction);
233 aTI.SetPoint1(thePoint1->GetLastFunction());
234 aTI.SetPoint2(thePoint2->GetLastFunction());
235 //aTI.SetShape(theObject->GetValue());
236 aTI.SetOriginal(aLastFunction);
238 //Compute the translation
240 #if OCC_VERSION_LARGE > 0x06010000
243 if (!GetSolver()->ComputeFunction(aFunction)) {
244 SetErrorCode("Translation driver failed");
248 catch (Standard_Failure) {
249 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
250 SetErrorCode(aFail->GetMessageString());
254 //Make a Python command
255 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints("
256 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
262 //=============================================================================
264 * TranslateDXDYDZCopy
266 //=============================================================================
267 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
268 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
272 if (theObject.IsNull()) return NULL;
274 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
275 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
277 //Add a new Copy object
278 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
280 //Add a translate function
281 Handle(GEOM_Function) aFunction =
282 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ_COPY);
284 //Check if the function is set correctly
285 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
287 GEOMImpl_ITranslate aTI(aFunction);
291 aTI.SetOriginal(aLastFunction);
293 //Compute the translation
295 #if OCC_VERSION_LARGE > 0x06010000
298 if (!GetSolver()->ComputeFunction(aFunction)) {
299 SetErrorCode("Translation driver failed");
303 catch (Standard_Failure) {
304 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
305 SetErrorCode(aFail->GetMessageString());
309 //Make a Python command
310 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation("
311 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
318 //=============================================================================
322 //=============================================================================
323 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
324 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
328 if (theObject.IsNull() || theVector.IsNull()) return NULL;
330 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
331 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
333 // Get last functions of the arguments
334 Handle(GEOM_Function) aVF = theVector->GetLastFunction();
336 //Add a translate function
337 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR);
339 if (aFunction.IsNull()) return NULL;
341 //Check if the function is set correctly
342 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
344 GEOMImpl_ITranslate aTI (aFunction);
346 aTI.SetOriginal(aLastFunction);
348 //Compute the translation
350 #if OCC_VERSION_LARGE > 0x06010000
353 if (!GetSolver()->ComputeFunction(aFunction)) {
354 SetErrorCode("Translation driver failed");
358 catch (Standard_Failure) {
359 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
360 SetErrorCode(aFail->GetMessageString());
364 //Make a Python command
365 GEOM::TPythonDump(aFunction) << "geompy.TranslateVector("
366 << theObject << ", " << theVector << ")";
371 //=============================================================================
373 * TranslateVectorCopy
375 //=============================================================================
376 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
377 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
381 if (theObject.IsNull() || theVector.IsNull()) return NULL;
383 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
384 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
386 //Add a new Copy object
387 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
389 //Add a translate function
390 Handle(GEOM_Function) aFunction =
391 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_COPY);
393 //Check if the function is set correctly
394 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
396 GEOMImpl_ITranslate aTI(aFunction);
397 aTI.SetVector(theVector->GetLastFunction());
398 // aTI.SetShape(theObject->GetValue());
399 aTI.SetOriginal(aLastFunction);
401 //Compute the translation
403 #if OCC_VERSION_LARGE > 0x06010000
406 if (!GetSolver()->ComputeFunction(aFunction)) {
407 SetErrorCode("Translation driver failed");
411 catch (Standard_Failure) {
412 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
413 SetErrorCode(aFail->GetMessageString());
417 //Make a Python command
418 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector("
419 << theObject << ", " << theVector << ")";
425 //=============================================================================
427 * TranslateVectorDistance
429 //=============================================================================
430 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance
431 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theDistance, bool theCopy)
435 if (theObject.IsNull() || theVector.IsNull()) return NULL;
437 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
438 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
440 Handle(GEOM_Object) aCopy; //Add a new Copy object
441 Handle(GEOM_Function) aFunction;
443 //Add a translate function
445 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
446 aFunction = aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
449 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
451 if (aFunction.IsNull()) return NULL;
453 //Check if the function is set correctly
454 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
456 GEOMImpl_ITranslate aTI(aFunction);
457 aTI.SetVector(theVector->GetLastFunction());
458 aTI.SetDistance(theDistance);
459 // aTI.SetShape(theObject->GetValue());
460 aTI.SetOriginal(aLastFunction);
462 //Compute the translation
464 #if OCC_VERSION_LARGE > 0x06010000
467 if (!GetSolver()->ComputeFunction(aFunction)) {
468 SetErrorCode("Translation driver failed");
472 catch (Standard_Failure) {
473 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
474 SetErrorCode(aFail->GetMessageString());
478 //Make a Python command
480 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVectorDistance("
481 << theObject << ", " << theVector << ", " << theDistance << ")";
486 GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance("
487 << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")";
492 //=============================================================================
496 //=============================================================================
497 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
498 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector,
499 double theStep, Standard_Integer theNbTimes)
503 if (theObject.IsNull()) return NULL;
505 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
506 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
508 //Add a new Copy object
509 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
511 //Add a translate function
512 Handle(GEOM_Function) aFunction =
513 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_1D);
515 //Check if the function is set correctly
516 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
518 GEOMImpl_ITranslate aTI (aFunction);
519 aTI.SetOriginal(aLastFunction);
520 if (!theVector.IsNull())
521 aTI.SetVector(theVector->GetLastFunction());
522 aTI.SetStep1(theStep);
523 aTI.SetNbIter1(theNbTimes);
525 //Compute the translation
527 #if OCC_VERSION_LARGE > 0x06010000
530 if (!GetSolver()->ComputeFunction(aFunction)) {
531 SetErrorCode("Translation driver failed");
535 catch (Standard_Failure) {
536 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
537 SetErrorCode(aFail->GetMessageString());
541 //Make a Python command
542 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D("
543 << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")";
549 //=============================================================================
553 //=============================================================================
554 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject,
555 Handle(GEOM_Object) theVector,
557 Standard_Integer theNbTimes1,
558 Handle(GEOM_Object) theVector2,
560 Standard_Integer theNbTimes2)
564 if (theObject.IsNull()) return NULL;
566 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
567 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
569 //Add a new Copy object
570 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
572 //Add a translate function
573 Handle(GEOM_Function) aFunction =
574 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_2D);
576 //Check if the function is set correctly
577 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
579 GEOMImpl_ITranslate aTI (aFunction);
580 aTI.SetOriginal(aLastFunction);
581 if (!theVector.IsNull())
582 aTI.SetVector(theVector->GetLastFunction());
583 aTI.SetStep1(theStep1);
584 aTI.SetNbIter1(theNbTimes1);
585 if (!theVector2.IsNull())
586 aTI.SetVector2(theVector2->GetLastFunction());
587 aTI.SetStep2(theStep2);
588 aTI.SetNbIter2(theNbTimes2);
590 //Compute the translation
592 #if OCC_VERSION_LARGE > 0x06010000
595 if (!GetSolver()->ComputeFunction(aFunction)) {
596 SetErrorCode("Translation driver failed");
600 catch (Standard_Failure) {
601 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
602 SetErrorCode(aFail->GetMessageString());
606 //Make a Python command
607 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D("
608 << theObject << ", " << theVector << ", " << theStep1 << ", " << theNbTimes1
609 << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")";
615 //=============================================================================
619 //=============================================================================
621 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape1D (const TopoDS_Shape& theShape,
622 GEOMImpl_ITranslate* theTI)
627 Handle(GEOM_Function) aVector = theTI->GetVector();
628 if (aVector.IsNull()) {
629 StdFail_NotDone::Raise("Invalid object is given for vector argument");
631 TopoDS_Shape aV = aVector->GetValue();
632 if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) {
633 StdFail_NotDone::Raise("Invalid object is given for vector argument");
635 TopoDS_Edge anEdge = TopoDS::Edge(aV);
637 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
638 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
639 if (aP1.Distance(aP2) < gp::Resolution()) {
640 StdFail_NotDone::Raise("Invalid object is given for vector argument");
644 Standard_Real step = theTI->GetStep1();
645 Standard_Integer nbtimes = theTI->GetNbIter1();
647 // Make multi-translation
650 TopoDS_Compound aCompound;
652 B.MakeCompound(aCompound);
654 gp_Vec Vec (aP1, aP2);
657 TopLoc_Location aLocOrig = theShape.Location();
658 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
660 for (int i = 0; i < nbtimes; i++) {
661 aVec = Vec * (i * step);
662 aTrsf.SetTranslation(aVec);
663 //NPAL18620: performance problem: multiple locations are accumulated
664 // in shape and need a great time to process
665 //BRepBuilderAPI_Transform aTransformation(theShape, aTrsf, Standard_False);
666 //B.Add(aCompound, aTransformation.Shape());
667 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
668 B.Add(aCompound, theShape.Located(aLocRes));
676 //=============================================================================
680 //=============================================================================
682 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape2D (const TopoDS_Shape& theShape,
683 GEOMImpl_ITranslate* theTI)
688 Handle(GEOM_Function) aVector1 = theTI->GetVector();
689 Handle(GEOM_Function) aVector2 = theTI->GetVector2();
691 if (aVector1.IsNull() || aVector2.IsNull()) {
692 StdFail_NotDone::Raise("Invalid object is given for vector argument");
695 TopoDS_Shape aV1 = aVector1->GetValue();
696 TopoDS_Shape aV2 = aVector2->GetValue();
698 if (aV1.IsNull() || aV1.ShapeType() != TopAbs_EDGE ||
699 aV2.IsNull() || aV2.ShapeType() != TopAbs_EDGE) {
700 StdFail_NotDone::Raise("Invalid object is given for vector argument");
703 TopoDS_Edge anEdge1 = TopoDS::Edge(aV1);
704 TopoDS_Edge anEdge2 = TopoDS::Edge(aV2);
706 gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1));
707 gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge1));
708 gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2));
709 gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge2));
711 if (aP11.Distance(aP12) < gp::Resolution() ||
712 aP21.Distance(aP22) < gp::Resolution()) {
713 StdFail_NotDone::Raise("Invalid object is given for vector argument");
716 gp_Vec Vec1 (aP11, aP12);
717 gp_Vec Vec2 (aP21, aP22);
723 Standard_Real step1 = theTI->GetStep1(), step2 = theTI->GetStep2();
724 Standard_Integer nbtimes1 = theTI->GetNbIter1(), nbtimes2 = theTI->GetNbIter2();
726 // Make multi-translation
729 Standard_Real DX, DY, DZ;
730 TopoDS_Compound aCompound;
732 B.MakeCompound(aCompound);
734 TopLoc_Location aLocOrig = theShape.Location();
735 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
737 for (int i = 0; i < nbtimes1; i++) {
738 for (int j = 0; j < nbtimes2; j++) {
739 DX = i * step1 * Vec1.X() + j * step2 * Vec2.X();
740 DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y();
741 DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z();
742 aVec.SetCoord(DX, DY, DZ);
743 aTrsf.SetTranslation(aVec);
744 //NPAL18620: performance problem: multiple locations are accumulated
745 // in shape and need a great time to process
746 //BRepBuilderAPI_Transform aBRepTransformation(theShape, aTrsf, Standard_False);
747 //B.Add(aCompound, aBRepTransformation.Shape());
748 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
749 B.Add(aCompound, theShape.Located(aLocRes));
758 //=============================================================================
762 //=============================================================================
763 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
764 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
768 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
770 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
771 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
773 // Get last functions of the arguments
774 Handle(GEOM_Function) aPF = thePlane->GetLastFunction();
776 //Add a mirror function
777 Handle(GEOM_Function) aFunction =
778 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE);
779 if (aFunction.IsNull()) return NULL;
781 //Check if the function is set correctly
782 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
784 GEOMImpl_IMirror aTI (aFunction);
786 aTI.SetOriginal(aLastFunction);
790 #if OCC_VERSION_LARGE > 0x06010000
793 if (!GetSolver()->ComputeFunction(aFunction)) {
794 SetErrorCode("Mirror driver failed");
798 catch (Standard_Failure) {
799 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
800 SetErrorCode(aFail->GetMessageString());
804 //Make a Python command
805 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPlane("
806 << theObject << ", " << thePlane << ")";
812 //=============================================================================
816 //=============================================================================
817 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
818 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
822 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
824 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
825 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
827 //Add a new Copy object
828 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
830 //Add a mirror function
831 Handle(GEOM_Function) aFunction =
832 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE_COPY);
834 //Check if the function is set correctly
835 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
837 GEOMImpl_IMirror aTI (aFunction);
838 aTI.SetPlane(thePlane->GetLastFunction());
839 aTI.SetOriginal(aLastFunction);
843 #if OCC_VERSION_LARGE > 0x06010000
846 if (!GetSolver()->ComputeFunction(aFunction)) {
847 SetErrorCode("Mirror driver failed");
851 catch (Standard_Failure) {
852 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
853 SetErrorCode(aFail->GetMessageString());
857 //Make a Python command
858 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane("
859 << theObject << ", " << thePlane << ")";
865 //=============================================================================
869 //=============================================================================
870 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
871 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
875 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
877 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
878 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
880 // Get last functions of the arguments
881 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
883 //Add a mirror function
884 Handle(GEOM_Function) aFunction =
885 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT);
886 if (aFunction.IsNull()) return NULL;
888 //Check if the function is set correctly
889 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
891 GEOMImpl_IMirror aTI (aFunction);
893 aTI.SetOriginal(aLastFunction);
897 #if OCC_VERSION_LARGE > 0x06010000
900 if (!GetSolver()->ComputeFunction(aFunction)) {
901 SetErrorCode("Mirror driver failed");
905 catch (Standard_Failure) {
906 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
907 SetErrorCode(aFail->GetMessageString());
911 //Make a Python command
912 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPoint("
913 << theObject << ", " << thePoint << ")";
919 //=============================================================================
923 //=============================================================================
924 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
925 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
929 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
931 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
932 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
934 //Add a new Copy object
935 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
937 //Add a mirror function
938 Handle(GEOM_Function) aFunction =
939 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT_COPY);
941 //Check if the function is set correctly
942 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
944 GEOMImpl_IMirror aTI (aFunction);
945 aTI.SetPoint(thePoint->GetLastFunction());
946 aTI.SetOriginal(aLastFunction);
950 #if OCC_VERSION_LARGE > 0x06010000
953 if (!GetSolver()->ComputeFunction(aFunction)) {
954 SetErrorCode("Mirror driver failed");
958 catch (Standard_Failure) {
959 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
960 SetErrorCode(aFail->GetMessageString());
964 //Make a Python command
965 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint("
966 << theObject << ", " << thePoint << ")";
972 //=============================================================================
976 //=============================================================================
977 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
978 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
982 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
984 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
985 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
987 // Get last functions of the arguments
988 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
990 //Add a mirror function
991 Handle(GEOM_Function) aFunction =
992 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS);
993 if (aFunction.IsNull()) return NULL;
995 //Check if the function is set correctly
996 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
998 GEOMImpl_IMirror aTI (aFunction);
1000 aTI.SetOriginal(aLastFunction);
1002 //Compute the mirror
1004 #if OCC_VERSION_LARGE > 0x06010000
1007 if (!GetSolver()->ComputeFunction(aFunction)) {
1008 SetErrorCode("Mirror driver failed");
1012 catch (Standard_Failure) {
1013 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1014 SetErrorCode(aFail->GetMessageString());
1018 //Make a Python command
1019 GEOM::TPythonDump(aFunction) << "geompy.MirrorByAxis("
1020 << theObject << ", " << theAxis << ")";
1026 //=============================================================================
1030 //=============================================================================
1031 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
1032 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
1036 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1038 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
1039 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
1041 //Add a new Copy object
1042 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1044 //Add a mirror function
1045 Handle(GEOM_Function) aFunction =
1046 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS_COPY);
1048 //Check if the function is set correctly
1049 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
1051 GEOMImpl_IMirror aTI (aFunction);
1052 aTI.SetAxis(theAxis->GetLastFunction());
1053 aTI.SetOriginal(aLastFunction);
1055 //Compute the mirror
1057 #if OCC_VERSION_LARGE > 0x06010000
1060 if (!GetSolver()->ComputeFunction(aFunction)) {
1061 SetErrorCode("Mirror driver failed");
1065 catch (Standard_Failure) {
1066 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1067 SetErrorCode(aFail->GetMessageString());
1071 //Make a Python command
1072 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis("
1073 << theObject << ", " << theAxis << ")";
1080 //=============================================================================
1084 //=============================================================================
1085 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
1086 (Handle(GEOM_Object) theObject, double theOffset)
1090 if (theObject.IsNull()) return NULL;
1092 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1093 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1095 //Add a new Offset function
1096 Handle(GEOM_Function) aFunction =
1097 theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE);
1098 if (aFunction.IsNull()) return NULL;
1100 //Check if the function is set correctly
1101 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1103 GEOMImpl_IOffset aTI (aFunction);
1104 aTI.SetShape(anOriginal);
1105 aTI.SetValue(theOffset);
1107 //Compute the offset
1109 #if OCC_VERSION_LARGE > 0x06010000
1112 if (!GetSolver()->ComputeFunction(aFunction)) {
1113 SetErrorCode("Offset driver failed");
1117 catch (Standard_Failure) {
1118 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1119 SetErrorCode(aFail->GetMessageString());
1123 //Make a Python command
1124 GEOM::TPythonDump(aFunction) << "geompy.Offset("
1125 << theObject << ", " << theOffset << ")";
1131 //=============================================================================
1135 //=============================================================================
1136 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
1137 (Handle(GEOM_Object) theObject, double theOffset)
1141 if (theObject.IsNull()) return NULL;
1143 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1144 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1146 //Add a new Copy object
1147 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1149 //Add a new Offset function
1150 Handle(GEOM_Function) aFunction =
1151 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
1152 if (aFunction.IsNull()) return NULL;
1154 //Check if the function is set correctly
1155 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1157 GEOMImpl_IOffset aTI (aFunction);
1158 aTI.SetShape(anOriginal);
1159 aTI.SetValue(theOffset);
1161 //Compute the offset
1163 #if OCC_VERSION_LARGE > 0x06010000
1166 if (!GetSolver()->ComputeFunction(aFunction)) {
1167 SetErrorCode("Offset driver failed");
1171 catch (Standard_Failure) {
1172 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1173 SetErrorCode(aFail->GetMessageString());
1177 //Make a Python command
1178 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
1179 << theObject << ", " << theOffset << ")";
1186 //=============================================================================
1190 //=============================================================================
1191 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ProjectShapeCopy
1192 (Handle(GEOM_Object) theSource, Handle(GEOM_Object) theTarget)
1196 if (theSource.IsNull() || theTarget.IsNull()) return NULL;
1198 Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
1199 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
1201 //Add a new Projection object
1202 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1204 //Add a Projection function
1205 Handle(GEOM_Function) aFunction =
1206 aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
1208 //Check if the function is set correctly
1209 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
1211 GEOMImpl_IMirror aTI (aFunction);
1212 aTI.SetPlane(theTarget->GetLastFunction());
1213 aTI.SetOriginal(aLastFunction);
1215 //Compute the Projection
1217 #if OCC_VERSION_LARGE > 0x06010000
1220 if (!GetSolver()->ComputeFunction(aFunction)) {
1221 SetErrorCode("Projection driver failed");
1225 catch (Standard_Failure) {
1226 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1227 SetErrorCode(aFail->GetMessageString());
1231 //Make a Python command
1232 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
1233 << theSource << ", " << theTarget << ")";
1240 //=============================================================================
1244 //=============================================================================
1245 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
1246 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1250 if (theObject.IsNull()) return NULL;
1252 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1253 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1255 //Add a scale function
1256 Handle(GEOM_Function) aFunction =
1257 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1258 if (aFunction.IsNull()) return NULL;
1260 //Check if the function is set correctly
1261 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1264 GEOMImpl_IScale aTI (aFunction);
1265 aTI.SetShape(anOriginal);
1266 aTI.SetFactor(theFactor);
1268 // Set point argument
1269 if (!thePoint.IsNull()) {
1270 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1276 #if OCC_VERSION_LARGE > 0x06010000
1279 if (!GetSolver()->ComputeFunction(aFunction)) {
1280 SetErrorCode("Scale driver failed");
1284 catch (Standard_Failure) {
1285 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1286 SetErrorCode(aFail->GetMessageString());
1290 //Make a Python command
1291 GEOM::TPythonDump(aFunction) << "geompy.Scale("
1292 << theObject << ", " << thePoint << ", " << theFactor << ")";
1298 //=============================================================================
1302 //=============================================================================
1303 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1304 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1308 if (theObject.IsNull()) return NULL;
1310 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1311 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1313 //Add a new Copy object
1314 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1316 //Add a scale function
1317 Handle(GEOM_Function) aFunction =
1318 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1319 if (aFunction.IsNull()) return NULL;
1321 //Check if the function is set correctly
1322 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1325 GEOMImpl_IScale aTI (aFunction);
1326 aTI.SetShape(anOriginal);
1327 aTI.SetFactor(theFactor);
1329 // Set point argument
1330 if (!thePoint.IsNull()) {
1331 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1337 #if OCC_VERSION_LARGE > 0x06010000
1340 if (!GetSolver()->ComputeFunction(aFunction)) {
1341 SetErrorCode("Scale driver failed");
1345 catch (Standard_Failure) {
1346 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1347 SetErrorCode(aFail->GetMessageString());
1351 //Make a Python command
1352 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
1353 << theObject << ", " << thePoint << ", " << theFactor << ")";
1359 //=============================================================================
1361 * ScaleShapeAlongAxes
1363 //=============================================================================
1364 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
1365 Handle(GEOM_Object) thePoint,
1373 if (theObject.IsNull()) return NULL;
1375 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1376 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1378 //Add a scale function
1379 Handle(GEOM_Object) aCopy; //Add a new Copy object
1380 Handle(GEOM_Function) aFunction;
1382 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1383 aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
1386 aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
1388 if (aFunction.IsNull()) return NULL;
1390 //Check if the function is set correctly
1391 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1394 GEOMImpl_IScale aTI (aFunction);
1395 aTI.SetShape(anOriginal);
1396 aTI.SetFactorX(theFactorX);
1397 aTI.SetFactorY(theFactorY);
1398 aTI.SetFactorZ(theFactorZ);
1400 // Set point (optional argument)
1401 if (!thePoint.IsNull()) {
1402 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1408 #if OCC_VERSION_LARGE > 0x06010000
1411 if (!GetSolver()->ComputeFunction(aFunction)) {
1412 SetErrorCode("Scale driver failed");
1416 catch (Standard_Failure) {
1417 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1418 SetErrorCode(aFail->GetMessageString());
1424 //Make a Python command
1426 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
1427 << theObject << ", " << thePoint << ", "
1428 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1432 GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
1433 << theObject << ", " << thePoint << ", "
1434 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1438 //=============================================================================
1442 //=============================================================================
1443 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1444 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1448 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1450 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1451 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1453 //Add a Position function
1454 Standard_Integer aType = POSITION_SHAPE;
1455 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
1457 Handle(GEOM_Function) aFunction =
1458 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1459 if (aFunction.IsNull()) return NULL;
1461 //Check if the function is set correctly
1462 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1464 //Set operation arguments
1465 GEOMImpl_IPosition aTI (aFunction);
1466 aTI.SetShape(anOriginal);
1467 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1468 if (!theStartLCS.IsNull())
1469 aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction());
1471 //Compute the Position
1473 #if OCC_VERSION_LARGE > 0x06010000
1476 if (!GetSolver()->ComputeFunction(aFunction)) {
1477 SetErrorCode("Position driver failed");
1481 catch (Standard_Failure) {
1482 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1483 SetErrorCode(aFail->GetMessageString());
1487 //Make a Python command
1488 GEOM::TPythonDump(aFunction) << "geompy.Position("
1489 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1495 //=============================================================================
1499 //=============================================================================
1500 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1501 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1505 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1507 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1508 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1510 //Add a new Copy object
1511 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1513 //Add a position function
1514 Standard_Integer aType = POSITION_SHAPE_COPY;
1515 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
1517 Handle(GEOM_Function) aFunction =
1518 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1519 if (aFunction.IsNull()) return NULL;
1521 //Check if the function is set correctly
1522 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1524 GEOMImpl_IPosition aTI (aFunction);
1525 aTI.SetShape(anOriginal);
1526 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1527 if (!theStartLCS.IsNull())
1528 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1530 //Compute the position
1532 #if OCC_VERSION_LARGE > 0x06010000
1535 if (!GetSolver()->ComputeFunction(aFunction)) {
1536 SetErrorCode("Position driver failed");
1540 catch (Standard_Failure) {
1541 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1542 SetErrorCode(aFail->GetMessageString());
1546 //Make a Python command
1547 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
1548 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1554 //=============================================================================
1558 //=============================================================================
1559 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
1560 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
1561 double theDistance, bool theCopy, bool theReverse)
1565 if (theObject.IsNull() || thePath.IsNull()) return NULL;
1567 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1568 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1570 //Add a position function
1571 Handle(GEOM_Function) aFunction;
1572 Handle(GEOM_Object) aCopy;
1575 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1576 aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1579 aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1581 if (aFunction.IsNull()) return NULL;
1583 //Check if the function is set correctly
1584 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1586 GEOMImpl_IPosition aTI (aFunction);
1587 aTI.SetShape(anOriginal);
1588 aTI.SetPath(thePath->GetLastFunction());
1589 aTI.SetDistance(theDistance);
1590 aTI.SetReverse(theReverse);
1592 //Compute the position
1594 #if OCC_VERSION_LARGE > 0x06010000
1597 if (!GetSolver()->ComputeFunction(aFunction)) {
1598 SetErrorCode("Position driver failed");
1602 catch (Standard_Failure) {
1603 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1604 SetErrorCode(aFail->GetMessageString());
1608 //Make a Python command
1610 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
1611 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1616 GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
1617 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1623 //=============================================================================
1627 //=============================================================================
1628 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1629 Handle(GEOM_Object) theAxis,
1634 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1636 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1637 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1639 // Get last functions of the arguments
1640 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1642 //Add a rotate function
1643 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1645 if (aFunction.IsNull()) return NULL;
1647 //Check if the function is set correctly
1648 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1650 GEOMImpl_IRotate aRI(aFunction);
1652 aRI.SetOriginal(aLastFunction);
1653 aRI.SetAngle(theAngle);
1655 //Compute the translation
1657 #if OCC_VERSION_LARGE > 0x06010000
1660 if (!GetSolver()->ComputeFunction(aFunction)) {
1661 SetErrorCode("Rotate driver failed");
1665 catch (Standard_Failure) {
1666 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1667 SetErrorCode(aFail->GetMessageString());
1671 //Make a Python command
1672 GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
1673 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1679 //=============================================================================
1683 //=============================================================================
1684 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
1685 Handle(GEOM_Object) theAxis,
1690 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1692 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1693 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1695 //Add a new Copy object
1696 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1698 //Add a rotate function
1699 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1700 if (aFunction.IsNull()) return NULL;
1702 //Check if the function is set correctly
1703 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1705 GEOMImpl_IRotate aRI(aFunction);
1706 aRI.SetAxis(theAxis->GetLastFunction());
1707 aRI.SetOriginal(aLastFunction);
1708 aRI.SetAngle(theAngle);
1710 //Compute the translation
1712 #if OCC_VERSION_LARGE > 0x06010000
1715 if (!GetSolver()->ComputeFunction(aFunction)) {
1716 SetErrorCode("Rotate driver failed");
1720 catch (Standard_Failure) {
1721 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1722 SetErrorCode(aFail->GetMessageString());
1726 //Make a Python command
1727 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
1728 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1734 //=============================================================================
1736 * Rotate1D (for MultiRotate1DNbTimes)
1738 //=============================================================================
1739 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1740 Handle(GEOM_Object) theAxis,
1741 Standard_Integer theNbTimes)
1745 if (theObject.IsNull()) return NULL;
1747 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1748 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1750 //Add a new Copy object
1751 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1753 //Add a rotate function
1754 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1755 if (aFunction.IsNull()) return NULL;
1757 //Check if the function is set correctly
1758 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1760 GEOMImpl_IRotate aRI(aFunction);
1761 aRI.SetOriginal(aLastFunction);
1762 if (!theAxis.IsNull())
1763 aRI.SetAxis(theAxis->GetLastFunction());
1764 aRI.SetNbIter1(theNbTimes);
1766 //Compute the translation
1768 #if OCC_VERSION_LARGE > 0x06010000
1771 if (!GetSolver()->ComputeFunction(aFunction)) {
1772 SetErrorCode("Rotate driver failed");
1776 catch (Standard_Failure) {
1777 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1778 SetErrorCode(aFail->GetMessageString());
1782 //Make a Python command
1783 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
1784 << theObject << ", " << theAxis << ", " << theNbTimes << ")";
1790 //=============================================================================
1792 * Rotate1D (for MultiRotate1DByStep)
1794 //=============================================================================
1795 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1796 Handle(GEOM_Object) theAxis,
1797 double theAngleStep,
1798 Standard_Integer theNbSteps)
1802 if (theObject.IsNull()) return NULL;
1804 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1805 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1807 //Add a new Copy object
1808 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1810 //Add a rotate function
1811 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
1812 if (aFunction.IsNull()) return NULL;
1814 //Check if the function is set correctly
1815 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1817 //Convert angle into degrees
1818 double anAngleStep = theAngleStep * 180. / M_PI;
1820 GEOMImpl_IRotate aRI (aFunction);
1821 aRI.SetOriginal(aLastFunction);
1822 if (!theAxis.IsNull())
1823 aRI.SetAxis(theAxis->GetLastFunction());
1824 aRI.SetAngle(anAngleStep);
1825 aRI.SetNbIter1(theNbSteps);
1827 //Compute the translation
1829 #if OCC_VERSION_LARGE > 0x06010000
1832 if (!GetSolver()->ComputeFunction(aFunction)) {
1833 SetErrorCode("Rotate driver failed");
1837 catch (Standard_Failure) {
1838 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1839 SetErrorCode(aFail->GetMessageString());
1843 //Make a Python command
1844 GEOM::TPythonDump(aFunction)
1845 << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
1846 << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
1852 //=============================================================================
1854 * Rotate2D (for MultiRotate2DNbTimes)
1856 //=============================================================================
1857 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1858 Handle(GEOM_Object) theAxis,
1859 Standard_Integer theNbObjects,
1860 double theRadialStep,
1861 Standard_Integer theNbSteps)
1865 if (theObject.IsNull()) return NULL;
1867 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1868 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1870 //Add a new Copy object
1871 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1873 //Add a rotate function
1874 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1875 if (aFunction.IsNull()) return NULL;
1877 //Check if the function is set correctly
1878 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1880 double anAngle = 360. / (double)theNbObjects;
1882 GEOMImpl_IRotate aRI (aFunction);
1883 aRI.SetOriginal(aLastFunction);
1884 if (!theAxis.IsNull())
1885 aRI.SetAxis(theAxis->GetLastFunction());
1886 aRI.SetAngle(anAngle);
1887 aRI.SetNbIter1(theNbObjects);
1888 aRI.SetStep(theRadialStep);
1889 aRI.SetNbIter2(theNbSteps);
1891 //Compute the translation
1893 #if OCC_VERSION_LARGE > 0x06010000
1896 if (!GetSolver()->ComputeFunction(aFunction)) {
1897 SetErrorCode("Rotate driver failed");
1901 catch (Standard_Failure) {
1902 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1903 SetErrorCode(aFail->GetMessageString());
1907 //Make a Python command
1908 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
1909 << theObject << ", " << theAxis << ", " << theNbObjects
1910 << ", " << theRadialStep << ", " << theNbSteps << ")";
1916 //=============================================================================
1918 * Rotate2D (for MultiRotate2DByStep)
1920 //=============================================================================
1921 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1922 Handle(GEOM_Object) theAxis,
1923 double theAngleStep,
1924 Standard_Integer theNbTimes1,
1926 Standard_Integer theNbTimes2)
1930 if (theObject.IsNull()) return NULL;
1932 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1933 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1935 //Add a new Copy object
1936 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1938 //Add a rotate function
1939 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1940 if (aFunction.IsNull()) return NULL;
1942 //Check if the function is set correctly
1943 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1945 //Convert angle into degrees
1946 double anAngleStep = theAngleStep * 180. / M_PI;
1948 GEOMImpl_IRotate aRI (aFunction);
1949 aRI.SetOriginal(aLastFunction);
1950 if (!theAxis.IsNull())
1951 aRI.SetAxis(theAxis->GetLastFunction());
1952 aRI.SetAngle(anAngleStep);
1953 aRI.SetNbIter1(theNbTimes1);
1954 aRI.SetStep(theStep);
1955 aRI.SetNbIter2(theNbTimes2);
1957 //Compute the translation
1959 #if OCC_VERSION_LARGE > 0x06010000
1962 if (!GetSolver()->ComputeFunction(aFunction)) {
1963 SetErrorCode("Rotate driver failed");
1967 catch (Standard_Failure) {
1968 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1969 SetErrorCode(aFail->GetMessageString());
1973 //Make a Python command
1974 GEOM::TPythonDump(aFunction)
1975 << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
1976 << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
1977 << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
1983 //=============================================================================
1987 //=============================================================================
1988 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject,
1989 Handle(GEOM_Object) theCentPoint,
1990 Handle(GEOM_Object) thePoint1,
1991 Handle(GEOM_Object) thePoint2)
1995 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
1997 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1998 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2000 // Get last functions of the arguments
2001 Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
2002 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
2003 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
2006 //Add a rotate function
2007 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS);
2009 if (aFunction.IsNull()) return NULL;
2011 //Check if the function is set correctly
2012 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2014 GEOMImpl_IRotate aRI(aFunction);
2015 aRI.SetCentPoint(aCPF);
2016 aRI.SetPoint1(aP1F);
2017 aRI.SetPoint2(aP2F);
2018 aRI.SetOriginal(aLastFunction);
2020 //Compute the translation
2022 #if OCC_VERSION_LARGE > 0x06010000
2025 if (!GetSolver()->ComputeFunction(aFunction)) {
2026 SetErrorCode("Rotate driver failed");
2030 catch (Standard_Failure) {
2031 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2032 SetErrorCode(aFail->GetMessageString());
2036 //Make a Python command
2037 GEOM::TPythonDump(aFunction) << "geompy.RotateThreePoints(" << theObject
2038 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2044 //=============================================================================
2046 * RotateThreePointsCopy
2048 //=============================================================================
2049 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle(GEOM_Object) theObject,
2050 Handle(GEOM_Object) theCentPoint,
2051 Handle(GEOM_Object) thePoint1,
2052 Handle(GEOM_Object) thePoint2)
2056 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2058 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2059 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2061 //Add a new Copy object
2062 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
2064 //Add a rotate function
2065 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
2066 if (aFunction.IsNull()) return NULL;
2068 //Check if the function is set correctly
2069 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2071 GEOMImpl_IRotate aRI(aFunction);
2072 aRI.SetCentPoint(theCentPoint->GetLastFunction());
2073 aRI.SetPoint1(thePoint1->GetLastFunction());
2074 aRI.SetPoint2(thePoint2->GetLastFunction());
2075 aRI.SetOriginal(aLastFunction);
2077 //Compute the translation
2079 #if OCC_VERSION_LARGE > 0x06010000
2082 if (!GetSolver()->ComputeFunction(aFunction)) {
2083 SetErrorCode("Rotate driver failed");
2087 catch (Standard_Failure) {
2088 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2089 SetErrorCode(aFail->GetMessageString());
2093 //Make a Python command
2094 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
2095 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2101 //=============================================================================
2103 * TransformLikeOtherCopy
2105 //=============================================================================
2106 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
2107 (Handle(GEOM_Object) theObject,
2108 Handle(GEOM_Object) theSample)
2112 if (theObject.IsNull() || theSample.IsNull()) return NULL;
2114 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2115 if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
2117 Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
2118 if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
2120 // Add a new Copy object
2121 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
2123 // Add a transform function (depends on theSample function)
2124 Handle(GEOM_Function) aFunction =
2125 aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
2126 if (aFunction.IsNull()) return NULL;
2128 // Check if the function is set correctly
2129 if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
2131 if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
2132 switch (aSampleFunc->GetType()) {
2135 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2136 GEOMImpl_ITranslate aRI_target (aFunction);
2138 aRI_target.SetVector(aRI_sample.GetVector());
2139 aRI_target.SetStep1(aRI_sample.GetStep1());
2140 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2142 aRI_target.SetOriginal(aLastFunction);
2147 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2148 GEOMImpl_ITranslate aRI_target (aFunction);
2150 aRI_target.SetVector(aRI_sample.GetVector());
2151 aRI_target.SetStep1(aRI_sample.GetStep1());
2152 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2154 aRI_target.SetVector2(aRI_sample.GetVector2());
2155 aRI_target.SetStep2(aRI_sample.GetStep2());
2156 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2158 aRI_target.SetOriginal(aLastFunction);
2163 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2168 else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
2169 switch (aSampleFunc->GetType()) {
2172 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2173 GEOMImpl_IRotate aRI_target (aFunction);
2175 aRI_target.SetAxis(aRI_sample.GetAxis());
2176 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2178 aRI_target.SetOriginal(aLastFunction);
2183 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2184 GEOMImpl_IRotate aRI_target (aFunction);
2186 aRI_target.SetAxis(aRI_sample.GetAxis());
2188 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2189 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2191 aRI_target.SetAngle(aRI_sample.GetAngle());
2192 aRI_target.SetStep(aRI_sample.GetStep());
2194 aRI_target.SetDir2(aRI_sample.GetDir2());
2196 aRI_target.SetOriginal(aLastFunction);
2199 case ROTATE_THREE_POINTS_COPY:
2201 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2202 GEOMImpl_IRotate aRI_target (aFunction);
2204 aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
2205 aRI_target.SetPoint1(aRI_sample.GetPoint1());
2206 aRI_target.SetPoint2(aRI_sample.GetPoint2());
2208 aRI_target.SetOriginal(aLastFunction);
2213 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2219 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2223 // Compute the transformation
2225 #if OCC_VERSION_LARGE > 0x06010000
2228 if (!GetSolver()->ComputeFunction(aFunction)) {
2229 SetErrorCode("Driver failed");
2233 catch (Standard_Failure) {
2234 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2235 SetErrorCode(aFail->GetMessageString());
2239 //Make a Python command
2240 //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
2241 // << theObject << ", " << theSample << ")";