1 // Copyright (C) 2007-2012 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
22 #include <Standard_Stream.hxx>
24 #include <GEOMImpl_ITransformOperations.hxx>
26 #include <GEOMImpl_TranslateDriver.hxx>
27 #include <GEOMImpl_MirrorDriver.hxx>
28 #include <GEOMImpl_ProjectionDriver.hxx>
29 #include <GEOMImpl_OffsetDriver.hxx>
30 #include <GEOMImpl_ScaleDriver.hxx>
31 #include <GEOMImpl_RotateDriver.hxx>
32 #include <GEOMImpl_PositionDriver.hxx>
34 #include <GEOMImpl_ITranslate.hxx>
35 #include <GEOMImpl_IMirror.hxx>
36 #include <GEOMImpl_IOffset.hxx>
37 #include <GEOMImpl_IScale.hxx>
38 #include <GEOMImpl_IRotate.hxx>
39 #include <GEOMImpl_IPosition.hxx>
41 #include <GEOMImpl_Types.hxx>
43 #include <GEOM_Function.hxx>
44 #include <GEOM_PythonDump.hxx>
46 #include <Basics_OCCTVersion.hxx>
48 #include "utilities.h"
50 #include <Utils_ExceptHandlers.hxx>
52 #include <TFunction_DriverTable.hxx>
53 #include <TFunction_Driver.hxx>
54 #include <TFunction_Logbook.hxx>
55 #include <TDF_Tool.hxx>
57 #include <BRep_Tool.hxx>
58 #include <BRep_Builder.hxx>
61 #include <TopoDS_Edge.hxx>
62 #include <TopoDS_Vertex.hxx>
63 #include <TopoDS_Compound.hxx>
66 #include <gp_Trsf.hxx>
68 #include <StdFail_NotDone.hxx>
69 #include <Standard_Failure.hxx>
70 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
72 //=============================================================================
76 //=============================================================================
78 GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine, int theDocID)
79 : GEOM_IOperations(theEngine, theDocID)
81 MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations");
84 //=============================================================================
88 //=============================================================================
90 GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations()
92 MESSAGE("GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations");
96 //=============================================================================
100 //=============================================================================
101 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
102 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
106 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
108 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
109 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
111 // Get last functions of the arguments
112 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
113 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
115 //Add a translate function
116 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS);
118 if (aFunction.IsNull()) return NULL;
120 //Check if the function is set correctly
121 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
123 GEOMImpl_ITranslate aTI (aFunction);
126 aTI.SetOriginal(aLastFunction);
128 //Compute the translation
130 #if OCC_VERSION_LARGE > 0x06010000
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
183 #if OCC_VERSION_LARGE > 0x06010000
186 if (!GetSolver()->ComputeFunction(aFunction)) {
187 SetErrorCode("Translation driver failed");
191 catch (Standard_Failure) {
192 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
193 SetErrorCode(aFail->GetMessageString());
197 //Make a Python command
198 GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ("
199 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
206 //=============================================================================
208 * TranslateTwoPointsCopy
210 //=============================================================================
211 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
212 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
216 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
218 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
219 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
221 //Add a new Copy object
222 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
224 //Add a translate function
225 Handle(GEOM_Function) aFunction =
226 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS_COPY);
228 //Check if the function is set correctly
229 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
231 GEOMImpl_ITranslate aTI(aFunction);
232 aTI.SetPoint1(thePoint1->GetLastFunction());
233 aTI.SetPoint2(thePoint2->GetLastFunction());
234 //aTI.SetShape(theObject->GetValue());
235 aTI.SetOriginal(aLastFunction);
237 //Compute the translation
239 #if OCC_VERSION_LARGE > 0x06010000
242 if (!GetSolver()->ComputeFunction(aFunction)) {
243 SetErrorCode("Translation driver failed");
247 catch (Standard_Failure) {
248 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
249 SetErrorCode(aFail->GetMessageString());
253 //Make a Python command
254 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints("
255 << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
261 //=============================================================================
263 * TranslateDXDYDZCopy
265 //=============================================================================
266 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
267 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
271 if (theObject.IsNull()) return NULL;
273 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
274 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
276 //Add a new Copy object
277 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
279 //Add a translate function
280 Handle(GEOM_Function) aFunction =
281 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ_COPY);
283 //Check if the function is set correctly
284 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
286 GEOMImpl_ITranslate aTI(aFunction);
290 aTI.SetOriginal(aLastFunction);
292 //Compute the translation
294 #if OCC_VERSION_LARGE > 0x06010000
297 if (!GetSolver()->ComputeFunction(aFunction)) {
298 SetErrorCode("Translation driver failed");
302 catch (Standard_Failure) {
303 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
304 SetErrorCode(aFail->GetMessageString());
308 //Make a Python command
309 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation("
310 << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
317 //=============================================================================
321 //=============================================================================
322 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
323 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
327 if (theObject.IsNull() || theVector.IsNull()) return NULL;
329 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
330 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
332 // Get last functions of the arguments
333 Handle(GEOM_Function) aVF = theVector->GetLastFunction();
335 //Add a translate function
336 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR);
338 if (aFunction.IsNull()) return NULL;
340 //Check if the function is set correctly
341 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
343 GEOMImpl_ITranslate aTI (aFunction);
345 aTI.SetOriginal(aLastFunction);
347 //Compute the translation
349 #if OCC_VERSION_LARGE > 0x06010000
352 if (!GetSolver()->ComputeFunction(aFunction)) {
353 SetErrorCode("Translation driver failed");
357 catch (Standard_Failure) {
358 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
359 SetErrorCode(aFail->GetMessageString());
363 //Make a Python command
364 GEOM::TPythonDump(aFunction) << "geompy.TranslateVector("
365 << theObject << ", " << theVector << ")";
370 //=============================================================================
372 * TranslateVectorCopy
374 //=============================================================================
375 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
376 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
380 if (theObject.IsNull() || theVector.IsNull()) return NULL;
382 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
383 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
385 //Add a new Copy object
386 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
388 //Add a translate function
389 Handle(GEOM_Function) aFunction =
390 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_COPY);
392 //Check if the function is set correctly
393 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
395 GEOMImpl_ITranslate aTI(aFunction);
396 aTI.SetVector(theVector->GetLastFunction());
397 // aTI.SetShape(theObject->GetValue());
398 aTI.SetOriginal(aLastFunction);
400 //Compute the translation
402 #if OCC_VERSION_LARGE > 0x06010000
405 if (!GetSolver()->ComputeFunction(aFunction)) {
406 SetErrorCode("Translation driver failed");
410 catch (Standard_Failure) {
411 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
412 SetErrorCode(aFail->GetMessageString());
416 //Make a Python command
417 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector("
418 << theObject << ", " << theVector << ")";
424 //=============================================================================
426 * TranslateVectorDistance
428 //=============================================================================
429 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance
430 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theDistance, bool theCopy)
434 if (theObject.IsNull() || theVector.IsNull()) return NULL;
436 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
437 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
439 Handle(GEOM_Object) aCopy; //Add a new Copy object
440 Handle(GEOM_Function) aFunction;
442 //Add a translate function
444 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
445 aFunction = aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
448 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
450 if (aFunction.IsNull()) return NULL;
452 //Check if the function is set correctly
453 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
455 GEOMImpl_ITranslate aTI(aFunction);
456 aTI.SetVector(theVector->GetLastFunction());
457 aTI.SetDistance(theDistance);
458 // aTI.SetShape(theObject->GetValue());
459 aTI.SetOriginal(aLastFunction);
461 //Compute the translation
463 #if OCC_VERSION_LARGE > 0x06010000
466 if (!GetSolver()->ComputeFunction(aFunction)) {
467 SetErrorCode("Translation driver failed");
471 catch (Standard_Failure) {
472 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
473 SetErrorCode(aFail->GetMessageString());
477 //Make a Python command
479 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVectorDistance("
480 << theObject << ", " << theVector << ", " << theDistance << ")";
485 GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance("
486 << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")";
491 //=============================================================================
495 //=============================================================================
496 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
497 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector,
498 double theStep, Standard_Integer theNbTimes)
502 if (theObject.IsNull()) return NULL;
504 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
505 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
507 //Add a new Copy object
508 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
510 //Add a translate function
511 Handle(GEOM_Function) aFunction =
512 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_1D);
514 //Check if the function is set correctly
515 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
517 GEOMImpl_ITranslate aTI (aFunction);
518 aTI.SetOriginal(aLastFunction);
519 if (!theVector.IsNull())
520 aTI.SetVector(theVector->GetLastFunction());
521 aTI.SetStep1(theStep);
522 aTI.SetNbIter1(theNbTimes);
524 //Compute the translation
526 #if OCC_VERSION_LARGE > 0x06010000
529 if (!GetSolver()->ComputeFunction(aFunction)) {
530 SetErrorCode("Translation driver failed");
534 catch (Standard_Failure) {
535 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
536 SetErrorCode(aFail->GetMessageString());
540 //Make a Python command
541 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D("
542 << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")";
548 //=============================================================================
552 //=============================================================================
553 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject,
554 Handle(GEOM_Object) theVector,
556 Standard_Integer theNbTimes1,
557 Handle(GEOM_Object) theVector2,
559 Standard_Integer theNbTimes2)
563 if (theObject.IsNull()) return NULL;
565 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
566 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
568 //Add a new Copy object
569 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
571 //Add a translate function
572 Handle(GEOM_Function) aFunction =
573 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_2D);
575 //Check if the function is set correctly
576 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
578 GEOMImpl_ITranslate aTI (aFunction);
579 aTI.SetOriginal(aLastFunction);
580 if (!theVector.IsNull())
581 aTI.SetVector(theVector->GetLastFunction());
582 aTI.SetStep1(theStep1);
583 aTI.SetNbIter1(theNbTimes1);
584 if (!theVector2.IsNull())
585 aTI.SetVector2(theVector2->GetLastFunction());
586 aTI.SetStep2(theStep2);
587 aTI.SetNbIter2(theNbTimes2);
589 //Compute the translation
591 #if OCC_VERSION_LARGE > 0x06010000
594 if (!GetSolver()->ComputeFunction(aFunction)) {
595 SetErrorCode("Translation driver failed");
599 catch (Standard_Failure) {
600 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
601 SetErrorCode(aFail->GetMessageString());
605 //Make a Python command
606 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D("
607 << theObject << ", " << theVector << ", " << theStep1 << ", " << theNbTimes1
608 << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")";
614 //=============================================================================
618 //=============================================================================
620 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape1D (const TopoDS_Shape& theShape,
621 GEOMImpl_ITranslate* theTI)
626 Handle(GEOM_Function) aVector = theTI->GetVector();
627 if (aVector.IsNull()) {
628 StdFail_NotDone::Raise("Invalid object is given for vector argument");
630 TopoDS_Shape aV = aVector->GetValue();
631 if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) {
632 StdFail_NotDone::Raise("Invalid object is given for vector argument");
634 TopoDS_Edge anEdge = TopoDS::Edge(aV);
636 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
637 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
638 if (aP1.Distance(aP2) < gp::Resolution()) {
639 StdFail_NotDone::Raise("Invalid object is given for vector argument");
643 Standard_Real step = theTI->GetStep1();
644 Standard_Integer nbtimes = theTI->GetNbIter1();
646 // Make multi-translation
649 TopoDS_Compound aCompound;
651 B.MakeCompound(aCompound);
653 gp_Vec Vec (aP1, aP2);
656 TopLoc_Location aLocOrig = theShape.Location();
657 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
659 for (int i = 0; i < nbtimes; i++) {
660 aVec = Vec * (i * step);
661 aTrsf.SetTranslation(aVec);
662 //NPAL18620: performance problem: multiple locations are accumulated
663 // in shape and need a great time to process
664 //BRepBuilderAPI_Transform aTransformation(theShape, aTrsf, Standard_False);
665 //B.Add(aCompound, aTransformation.Shape());
666 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
667 B.Add(aCompound, theShape.Located(aLocRes));
675 //=============================================================================
679 //=============================================================================
681 TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape2D (const TopoDS_Shape& theShape,
682 GEOMImpl_ITranslate* theTI)
687 Handle(GEOM_Function) aVector1 = theTI->GetVector();
688 Handle(GEOM_Function) aVector2 = theTI->GetVector2();
690 if (aVector1.IsNull() || aVector2.IsNull()) {
691 StdFail_NotDone::Raise("Invalid object is given for vector argument");
694 TopoDS_Shape aV1 = aVector1->GetValue();
695 TopoDS_Shape aV2 = aVector2->GetValue();
697 if (aV1.IsNull() || aV1.ShapeType() != TopAbs_EDGE ||
698 aV2.IsNull() || aV2.ShapeType() != TopAbs_EDGE) {
699 StdFail_NotDone::Raise("Invalid object is given for vector argument");
702 TopoDS_Edge anEdge1 = TopoDS::Edge(aV1);
703 TopoDS_Edge anEdge2 = TopoDS::Edge(aV2);
705 gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1));
706 gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge1));
707 gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2));
708 gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge2));
710 if (aP11.Distance(aP12) < gp::Resolution() ||
711 aP21.Distance(aP22) < gp::Resolution()) {
712 StdFail_NotDone::Raise("Invalid object is given for vector argument");
715 gp_Vec Vec1 (aP11, aP12);
716 gp_Vec Vec2 (aP21, aP22);
722 Standard_Real step1 = theTI->GetStep1(), step2 = theTI->GetStep2();
723 Standard_Integer nbtimes1 = theTI->GetNbIter1(), nbtimes2 = theTI->GetNbIter2();
725 // Make multi-translation
728 Standard_Real DX, DY, DZ;
729 TopoDS_Compound aCompound;
731 B.MakeCompound(aCompound);
733 TopLoc_Location aLocOrig = theShape.Location();
734 gp_Trsf aTrsfOrig = aLocOrig.Transformation();
736 for (int i = 0; i < nbtimes1; i++) {
737 for (int j = 0; j < nbtimes2; j++) {
738 DX = i * step1 * Vec1.X() + j * step2 * Vec2.X();
739 DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y();
740 DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z();
741 aVec.SetCoord(DX, DY, DZ);
742 aTrsf.SetTranslation(aVec);
743 //NPAL18620: performance problem: multiple locations are accumulated
744 // in shape and need a great time to process
745 //BRepBuilderAPI_Transform aBRepTransformation(theShape, aTrsf, Standard_False);
746 //B.Add(aCompound, aBRepTransformation.Shape());
747 TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
748 B.Add(aCompound, theShape.Located(aLocRes));
757 //=============================================================================
761 //=============================================================================
762 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
763 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
767 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
769 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
770 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
772 // Get last functions of the arguments
773 Handle(GEOM_Function) aPF = thePlane->GetLastFunction();
775 //Add a mirror function
776 Handle(GEOM_Function) aFunction =
777 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE);
778 if (aFunction.IsNull()) return NULL;
780 //Check if the function is set correctly
781 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
783 GEOMImpl_IMirror aTI (aFunction);
785 aTI.SetOriginal(aLastFunction);
789 #if OCC_VERSION_LARGE > 0x06010000
792 if (!GetSolver()->ComputeFunction(aFunction)) {
793 SetErrorCode("Mirror driver failed");
797 catch (Standard_Failure) {
798 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
799 SetErrorCode(aFail->GetMessageString());
803 //Make a Python command
804 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPlane("
805 << theObject << ", " << thePlane << ")";
811 //=============================================================================
815 //=============================================================================
816 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
817 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
821 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
823 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
824 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
826 //Add a new Copy object
827 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
829 //Add a mirror function
830 Handle(GEOM_Function) aFunction =
831 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE_COPY);
833 //Check if the function is set correctly
834 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
836 GEOMImpl_IMirror aTI (aFunction);
837 aTI.SetPlane(thePlane->GetLastFunction());
838 aTI.SetOriginal(aLastFunction);
842 #if OCC_VERSION_LARGE > 0x06010000
845 if (!GetSolver()->ComputeFunction(aFunction)) {
846 SetErrorCode("Mirror driver failed");
850 catch (Standard_Failure) {
851 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
852 SetErrorCode(aFail->GetMessageString());
856 //Make a Python command
857 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane("
858 << theObject << ", " << thePlane << ")";
864 //=============================================================================
868 //=============================================================================
869 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
870 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
874 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
876 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
877 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
879 // Get last functions of the arguments
880 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
882 //Add a mirror function
883 Handle(GEOM_Function) aFunction =
884 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT);
885 if (aFunction.IsNull()) return NULL;
887 //Check if the function is set correctly
888 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
890 GEOMImpl_IMirror aTI (aFunction);
892 aTI.SetOriginal(aLastFunction);
896 #if OCC_VERSION_LARGE > 0x06010000
899 if (!GetSolver()->ComputeFunction(aFunction)) {
900 SetErrorCode("Mirror driver failed");
904 catch (Standard_Failure) {
905 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
906 SetErrorCode(aFail->GetMessageString());
910 //Make a Python command
911 GEOM::TPythonDump(aFunction) << "geompy.MirrorByPoint("
912 << theObject << ", " << thePoint << ")";
918 //=============================================================================
922 //=============================================================================
923 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
924 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
928 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
930 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
931 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
933 //Add a new Copy object
934 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
936 //Add a mirror function
937 Handle(GEOM_Function) aFunction =
938 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT_COPY);
940 //Check if the function is set correctly
941 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
943 GEOMImpl_IMirror aTI (aFunction);
944 aTI.SetPoint(thePoint->GetLastFunction());
945 aTI.SetOriginal(aLastFunction);
949 #if OCC_VERSION_LARGE > 0x06010000
952 if (!GetSolver()->ComputeFunction(aFunction)) {
953 SetErrorCode("Mirror driver failed");
957 catch (Standard_Failure) {
958 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
959 SetErrorCode(aFail->GetMessageString());
963 //Make a Python command
964 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint("
965 << theObject << ", " << thePoint << ")";
971 //=============================================================================
975 //=============================================================================
976 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
977 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
981 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
983 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
984 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
986 // Get last functions of the arguments
987 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
989 //Add a mirror function
990 Handle(GEOM_Function) aFunction =
991 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS);
992 if (aFunction.IsNull()) return NULL;
994 //Check if the function is set correctly
995 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
997 GEOMImpl_IMirror aTI (aFunction);
999 aTI.SetOriginal(aLastFunction);
1001 //Compute the mirror
1003 #if OCC_VERSION_LARGE > 0x06010000
1006 if (!GetSolver()->ComputeFunction(aFunction)) {
1007 SetErrorCode("Mirror driver failed");
1011 catch (Standard_Failure) {
1012 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1013 SetErrorCode(aFail->GetMessageString());
1017 //Make a Python command
1018 GEOM::TPythonDump(aFunction) << "geompy.MirrorByAxis("
1019 << theObject << ", " << theAxis << ")";
1025 //=============================================================================
1029 //=============================================================================
1030 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
1031 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
1035 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1037 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
1038 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
1040 //Add a new Copy object
1041 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1043 //Add a mirror function
1044 Handle(GEOM_Function) aFunction =
1045 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS_COPY);
1047 //Check if the function is set correctly
1048 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
1050 GEOMImpl_IMirror aTI (aFunction);
1051 aTI.SetAxis(theAxis->GetLastFunction());
1052 aTI.SetOriginal(aLastFunction);
1054 //Compute the mirror
1056 #if OCC_VERSION_LARGE > 0x06010000
1059 if (!GetSolver()->ComputeFunction(aFunction)) {
1060 SetErrorCode("Mirror driver failed");
1064 catch (Standard_Failure) {
1065 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1066 SetErrorCode(aFail->GetMessageString());
1070 //Make a Python command
1071 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis("
1072 << theObject << ", " << theAxis << ")";
1079 //=============================================================================
1083 //=============================================================================
1084 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
1085 (Handle(GEOM_Object) theObject, double theOffset)
1089 if (theObject.IsNull()) return NULL;
1091 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1092 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1094 //Add a new Offset function
1095 Handle(GEOM_Function) aFunction =
1096 theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE);
1097 if (aFunction.IsNull()) return NULL;
1099 //Check if the function is set correctly
1100 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1102 GEOMImpl_IOffset aTI (aFunction);
1103 aTI.SetShape(anOriginal);
1104 aTI.SetValue(theOffset);
1106 //Compute the offset
1108 #if OCC_VERSION_LARGE > 0x06010000
1111 if (!GetSolver()->ComputeFunction(aFunction)) {
1112 SetErrorCode("Offset driver failed");
1116 catch (Standard_Failure) {
1117 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1118 SetErrorCode(aFail->GetMessageString());
1122 //Make a Python command
1123 GEOM::TPythonDump(aFunction) << "geompy.Offset("
1124 << theObject << ", " << theOffset << ")";
1130 //=============================================================================
1134 //=============================================================================
1135 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
1136 (Handle(GEOM_Object) theObject, double theOffset)
1140 if (theObject.IsNull()) return NULL;
1142 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1143 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
1145 //Add a new Copy object
1146 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1148 //Add a new Offset function
1149 Handle(GEOM_Function) aFunction =
1150 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
1151 if (aFunction.IsNull()) return NULL;
1153 //Check if the function is set correctly
1154 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
1156 GEOMImpl_IOffset aTI (aFunction);
1157 aTI.SetShape(anOriginal);
1158 aTI.SetValue(theOffset);
1160 //Compute the offset
1162 #if OCC_VERSION_LARGE > 0x06010000
1165 if (!GetSolver()->ComputeFunction(aFunction)) {
1166 SetErrorCode("Offset driver failed");
1170 catch (Standard_Failure) {
1171 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1172 SetErrorCode(aFail->GetMessageString());
1176 //Make a Python command
1177 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
1178 << theObject << ", " << theOffset << ")";
1185 //=============================================================================
1189 //=============================================================================
1190 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ProjectShapeCopy
1191 (Handle(GEOM_Object) theSource, Handle(GEOM_Object) theTarget)
1195 if (theSource.IsNull() || theTarget.IsNull()) return NULL;
1197 Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction();
1198 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected
1200 //Add a new Projection object
1201 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
1203 //Add a Projection function
1204 Handle(GEOM_Function) aFunction =
1205 aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY);
1207 //Check if the function is set correctly
1208 if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL;
1210 GEOMImpl_IMirror aTI (aFunction);
1211 aTI.SetPlane(theTarget->GetLastFunction());
1212 aTI.SetOriginal(aLastFunction);
1214 //Compute the Projection
1216 #if OCC_VERSION_LARGE > 0x06010000
1219 if (!GetSolver()->ComputeFunction(aFunction)) {
1220 SetErrorCode("Projection driver failed");
1224 catch (Standard_Failure) {
1225 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1226 SetErrorCode(aFail->GetMessageString());
1230 //Make a Python command
1231 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection("
1232 << theSource << ", " << theTarget << ")";
1239 //=============================================================================
1243 //=============================================================================
1244 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
1245 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1249 if (theObject.IsNull()) return NULL;
1251 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1252 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1254 //Add a scale function
1255 Handle(GEOM_Function) aFunction =
1256 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1257 if (aFunction.IsNull()) return NULL;
1259 //Check if the function is set correctly
1260 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1263 GEOMImpl_IScale aTI (aFunction);
1264 aTI.SetShape(anOriginal);
1265 aTI.SetFactor(theFactor);
1267 // Set point argument
1268 if (!thePoint.IsNull()) {
1269 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1275 #if OCC_VERSION_LARGE > 0x06010000
1278 if (!GetSolver()->ComputeFunction(aFunction)) {
1279 SetErrorCode("Scale driver failed");
1283 catch (Standard_Failure) {
1284 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1285 SetErrorCode(aFail->GetMessageString());
1289 //Make a Python command
1290 GEOM::TPythonDump(aFunction) << "geompy.Scale("
1291 << theObject << ", " << thePoint << ", " << theFactor << ")";
1297 //=============================================================================
1301 //=============================================================================
1302 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1303 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1307 if (theObject.IsNull()) return NULL;
1309 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1310 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1312 //Add a new Copy object
1313 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1315 //Add a scale function
1316 Handle(GEOM_Function) aFunction =
1317 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1318 if (aFunction.IsNull()) return NULL;
1320 //Check if the function is set correctly
1321 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1324 GEOMImpl_IScale aTI (aFunction);
1325 aTI.SetShape(anOriginal);
1326 aTI.SetFactor(theFactor);
1328 // Set point argument
1329 if (!thePoint.IsNull()) {
1330 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1336 #if OCC_VERSION_LARGE > 0x06010000
1339 if (!GetSolver()->ComputeFunction(aFunction)) {
1340 SetErrorCode("Scale driver failed");
1344 catch (Standard_Failure) {
1345 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1346 SetErrorCode(aFail->GetMessageString());
1350 //Make a Python command
1351 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
1352 << theObject << ", " << thePoint << ", " << theFactor << ")";
1358 //=============================================================================
1360 * ScaleShapeAlongAxes
1362 //=============================================================================
1363 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(GEOM_Object) theObject,
1364 Handle(GEOM_Object) thePoint,
1372 if (theObject.IsNull()) return NULL;
1374 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1375 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1377 //Add a scale function
1378 Handle(GEOM_Object) aCopy; //Add a new Copy object
1379 Handle(GEOM_Function) aFunction;
1381 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1382 aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
1385 aFunction = theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES);
1387 if (aFunction.IsNull()) return NULL;
1389 //Check if the function is set correctly
1390 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1393 GEOMImpl_IScale aTI (aFunction);
1394 aTI.SetShape(anOriginal);
1395 aTI.SetFactorX(theFactorX);
1396 aTI.SetFactorY(theFactorY);
1397 aTI.SetFactorZ(theFactorZ);
1399 // Set point (optional argument)
1400 if (!thePoint.IsNull()) {
1401 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1407 #if OCC_VERSION_LARGE > 0x06010000
1410 if (!GetSolver()->ComputeFunction(aFunction)) {
1411 SetErrorCode("Scale driver failed");
1415 catch (Standard_Failure) {
1416 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1417 SetErrorCode(aFail->GetMessageString());
1423 //Make a Python command
1425 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
1426 << theObject << ", " << thePoint << ", "
1427 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1431 GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
1432 << theObject << ", " << thePoint << ", "
1433 << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
1437 //=============================================================================
1441 //=============================================================================
1442 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1443 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1447 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1449 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1450 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1452 //Add a Position function
1453 Standard_Integer aType = POSITION_SHAPE;
1454 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
1456 Handle(GEOM_Function) aFunction =
1457 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1458 if (aFunction.IsNull()) return NULL;
1460 //Check if the function is set correctly
1461 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1463 //Set operation arguments
1464 GEOMImpl_IPosition aTI (aFunction);
1465 aTI.SetShape(anOriginal);
1466 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1467 if (!theStartLCS.IsNull())
1468 aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction());
1470 //Compute the Position
1472 #if OCC_VERSION_LARGE > 0x06010000
1475 if (!GetSolver()->ComputeFunction(aFunction)) {
1476 SetErrorCode("Position driver failed");
1480 catch (Standard_Failure) {
1481 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1482 SetErrorCode(aFail->GetMessageString());
1486 //Make a Python command
1487 GEOM::TPythonDump(aFunction) << "geompy.Position("
1488 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1494 //=============================================================================
1498 //=============================================================================
1499 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1500 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1504 if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
1506 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1507 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1509 //Add a new Copy object
1510 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1512 //Add a position function
1513 Standard_Integer aType = POSITION_SHAPE_COPY;
1514 if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
1516 Handle(GEOM_Function) aFunction =
1517 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
1518 if (aFunction.IsNull()) return NULL;
1520 //Check if the function is set correctly
1521 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1523 GEOMImpl_IPosition aTI (aFunction);
1524 aTI.SetShape(anOriginal);
1525 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1526 if (!theStartLCS.IsNull())
1527 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1529 //Compute the position
1531 #if OCC_VERSION_LARGE > 0x06010000
1534 if (!GetSolver()->ComputeFunction(aFunction)) {
1535 SetErrorCode("Position driver failed");
1539 catch (Standard_Failure) {
1540 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1541 SetErrorCode(aFail->GetMessageString());
1545 //Make a Python command
1546 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
1547 << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
1553 //=============================================================================
1557 //=============================================================================
1558 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
1559 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
1560 double theDistance, bool theCopy, bool theReverse)
1564 if (theObject.IsNull() || thePath.IsNull()) return NULL;
1566 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1567 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1569 //Add a position function
1570 Handle(GEOM_Function) aFunction;
1571 Handle(GEOM_Object) aCopy;
1574 aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1575 aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1578 aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
1580 if (aFunction.IsNull()) return NULL;
1582 //Check if the function is set correctly
1583 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1585 GEOMImpl_IPosition aTI (aFunction);
1586 aTI.SetShape(anOriginal);
1587 aTI.SetPath(thePath->GetLastFunction());
1588 aTI.SetDistance(theDistance);
1589 aTI.SetReverse(theReverse);
1591 //Compute the position
1593 #if OCC_VERSION_LARGE > 0x06010000
1596 if (!GetSolver()->ComputeFunction(aFunction)) {
1597 SetErrorCode("Position driver failed");
1601 catch (Standard_Failure) {
1602 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1603 SetErrorCode(aFail->GetMessageString());
1607 //Make a Python command
1609 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
1610 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1615 GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
1616 << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
1622 //=============================================================================
1626 //=============================================================================
1627 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1628 Handle(GEOM_Object) theAxis,
1633 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1635 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1636 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1638 // Get last functions of the arguments
1639 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1641 //Add a rotate function
1642 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1644 if (aFunction.IsNull()) return NULL;
1646 //Check if the function is set correctly
1647 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1649 GEOMImpl_IRotate aRI(aFunction);
1651 aRI.SetOriginal(aLastFunction);
1652 aRI.SetAngle(theAngle);
1654 //Compute the translation
1656 #if OCC_VERSION_LARGE > 0x06010000
1659 if (!GetSolver()->ComputeFunction(aFunction)) {
1660 SetErrorCode("Rotate driver failed");
1664 catch (Standard_Failure) {
1665 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1666 SetErrorCode(aFail->GetMessageString());
1670 //Make a Python command
1671 GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
1672 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1678 //=============================================================================
1682 //=============================================================================
1683 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
1684 Handle(GEOM_Object) theAxis,
1689 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1691 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1692 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1694 //Add a new Copy object
1695 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1697 //Add a rotate function
1698 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1699 if (aFunction.IsNull()) return NULL;
1701 //Check if the function is set correctly
1702 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1704 GEOMImpl_IRotate aRI(aFunction);
1705 aRI.SetAxis(theAxis->GetLastFunction());
1706 aRI.SetOriginal(aLastFunction);
1707 aRI.SetAngle(theAngle);
1709 //Compute the translation
1711 #if OCC_VERSION_LARGE > 0x06010000
1714 if (!GetSolver()->ComputeFunction(aFunction)) {
1715 SetErrorCode("Rotate driver failed");
1719 catch (Standard_Failure) {
1720 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1721 SetErrorCode(aFail->GetMessageString());
1725 //Make a Python command
1726 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
1727 << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1733 //=============================================================================
1735 * Rotate1D (for MultiRotate1DNbTimes)
1737 //=============================================================================
1738 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1739 Handle(GEOM_Object) theAxis,
1740 Standard_Integer theNbTimes)
1744 if (theObject.IsNull()) return NULL;
1746 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1747 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1749 //Add a new Copy object
1750 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1752 //Add a rotate function
1753 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1754 if (aFunction.IsNull()) return NULL;
1756 //Check if the function is set correctly
1757 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1759 GEOMImpl_IRotate aRI(aFunction);
1760 aRI.SetOriginal(aLastFunction);
1761 if (!theAxis.IsNull())
1762 aRI.SetAxis(theAxis->GetLastFunction());
1763 aRI.SetNbIter1(theNbTimes);
1765 //Compute the translation
1767 #if OCC_VERSION_LARGE > 0x06010000
1770 if (!GetSolver()->ComputeFunction(aFunction)) {
1771 SetErrorCode("Rotate driver failed");
1775 catch (Standard_Failure) {
1776 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1777 SetErrorCode(aFail->GetMessageString());
1781 //Make a Python command
1782 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
1783 << theObject << ", " << theAxis << ", " << theNbTimes << ")";
1789 //=============================================================================
1791 * Rotate1D (for MultiRotate1DByStep)
1793 //=============================================================================
1794 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1795 Handle(GEOM_Object) theAxis,
1796 double theAngleStep,
1797 Standard_Integer theNbSteps)
1801 if (theObject.IsNull()) return NULL;
1803 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1804 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1806 //Add a new Copy object
1807 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1809 //Add a rotate function
1810 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
1811 if (aFunction.IsNull()) return NULL;
1813 //Check if the function is set correctly
1814 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1816 //Convert angle into degrees
1817 double anAngleStep = theAngleStep * 180. / M_PI;
1819 GEOMImpl_IRotate aRI (aFunction);
1820 aRI.SetOriginal(aLastFunction);
1821 if (!theAxis.IsNull())
1822 aRI.SetAxis(theAxis->GetLastFunction());
1823 aRI.SetAngle(anAngleStep);
1824 aRI.SetNbIter1(theNbSteps);
1826 //Compute the translation
1828 #if OCC_VERSION_LARGE > 0x06010000
1831 if (!GetSolver()->ComputeFunction(aFunction)) {
1832 SetErrorCode("Rotate driver failed");
1836 catch (Standard_Failure) {
1837 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1838 SetErrorCode(aFail->GetMessageString());
1842 //Make a Python command
1843 GEOM::TPythonDump(aFunction)
1844 << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
1845 << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
1851 //=============================================================================
1853 * Rotate2D (for MultiRotate2DNbTimes)
1855 //=============================================================================
1856 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1857 Handle(GEOM_Object) theAxis,
1858 Standard_Integer theNbObjects,
1859 double theRadialStep,
1860 Standard_Integer theNbSteps)
1864 if (theObject.IsNull()) return NULL;
1866 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1867 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1869 //Add a new Copy object
1870 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1872 //Add a rotate function
1873 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1874 if (aFunction.IsNull()) return NULL;
1876 //Check if the function is set correctly
1877 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1879 double anAngle = 360. / (double)theNbObjects;
1881 GEOMImpl_IRotate aRI (aFunction);
1882 aRI.SetOriginal(aLastFunction);
1883 if (!theAxis.IsNull())
1884 aRI.SetAxis(theAxis->GetLastFunction());
1885 aRI.SetAngle(anAngle);
1886 aRI.SetNbIter1(theNbObjects);
1887 aRI.SetStep(theRadialStep);
1888 aRI.SetNbIter2(theNbSteps);
1890 //Compute the translation
1892 #if OCC_VERSION_LARGE > 0x06010000
1895 if (!GetSolver()->ComputeFunction(aFunction)) {
1896 SetErrorCode("Rotate driver failed");
1900 catch (Standard_Failure) {
1901 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1902 SetErrorCode(aFail->GetMessageString());
1906 //Make a Python command
1907 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
1908 << theObject << ", " << theAxis << ", " << theNbObjects
1909 << ", " << theRadialStep << ", " << theNbSteps << ")";
1915 //=============================================================================
1917 * Rotate2D (for MultiRotate2DByStep)
1919 //=============================================================================
1920 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1921 Handle(GEOM_Object) theAxis,
1922 double theAngleStep,
1923 Standard_Integer theNbTimes1,
1925 Standard_Integer theNbTimes2)
1929 if (theObject.IsNull()) return NULL;
1931 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1932 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1934 //Add a new Copy object
1935 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1937 //Add a rotate function
1938 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1939 if (aFunction.IsNull()) return NULL;
1941 //Check if the function is set correctly
1942 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1944 //Convert angle into degrees
1945 double anAngleStep = theAngleStep * 180. / M_PI;
1947 GEOMImpl_IRotate aRI (aFunction);
1948 aRI.SetOriginal(aLastFunction);
1949 if (!theAxis.IsNull())
1950 aRI.SetAxis(theAxis->GetLastFunction());
1951 aRI.SetAngle(anAngleStep);
1952 aRI.SetNbIter1(theNbTimes1);
1953 aRI.SetStep(theStep);
1954 aRI.SetNbIter2(theNbTimes2);
1956 //Compute the translation
1958 #if OCC_VERSION_LARGE > 0x06010000
1961 if (!GetSolver()->ComputeFunction(aFunction)) {
1962 SetErrorCode("Rotate driver failed");
1966 catch (Standard_Failure) {
1967 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1968 SetErrorCode(aFail->GetMessageString());
1972 //Make a Python command
1973 GEOM::TPythonDump(aFunction)
1974 << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
1975 << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
1976 << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
1982 //=============================================================================
1986 //=============================================================================
1987 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject,
1988 Handle(GEOM_Object) theCentPoint,
1989 Handle(GEOM_Object) thePoint1,
1990 Handle(GEOM_Object) thePoint2)
1994 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
1996 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1997 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1999 // Get last functions of the arguments
2000 Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
2001 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
2002 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
2005 //Add a rotate function
2006 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS);
2008 if (aFunction.IsNull()) return NULL;
2010 //Check if the function is set correctly
2011 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2013 GEOMImpl_IRotate aRI(aFunction);
2014 aRI.SetCentPoint(aCPF);
2015 aRI.SetPoint1(aP1F);
2016 aRI.SetPoint2(aP2F);
2017 aRI.SetOriginal(aLastFunction);
2019 //Compute the translation
2021 #if OCC_VERSION_LARGE > 0x06010000
2024 if (!GetSolver()->ComputeFunction(aFunction)) {
2025 SetErrorCode("Rotate driver failed");
2029 catch (Standard_Failure) {
2030 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2031 SetErrorCode(aFail->GetMessageString());
2035 //Make a Python command
2036 GEOM::TPythonDump(aFunction) << "geompy.RotateThreePoints(" << theObject
2037 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2043 //=============================================================================
2045 * RotateThreePointsCopy
2047 //=============================================================================
2048 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle(GEOM_Object) theObject,
2049 Handle(GEOM_Object) theCentPoint,
2050 Handle(GEOM_Object) thePoint1,
2051 Handle(GEOM_Object) thePoint2)
2055 if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
2057 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
2058 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
2060 //Add a new Copy object
2061 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
2063 //Add a rotate function
2064 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
2065 if (aFunction.IsNull()) return NULL;
2067 //Check if the function is set correctly
2068 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
2070 GEOMImpl_IRotate aRI(aFunction);
2071 aRI.SetCentPoint(theCentPoint->GetLastFunction());
2072 aRI.SetPoint1(thePoint1->GetLastFunction());
2073 aRI.SetPoint2(thePoint2->GetLastFunction());
2074 aRI.SetOriginal(aLastFunction);
2076 //Compute the translation
2078 #if OCC_VERSION_LARGE > 0x06010000
2081 if (!GetSolver()->ComputeFunction(aFunction)) {
2082 SetErrorCode("Rotate driver failed");
2086 catch (Standard_Failure) {
2087 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2088 SetErrorCode(aFail->GetMessageString());
2092 //Make a Python command
2093 GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
2094 << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
2100 //=============================================================================
2102 * TransformLikeOtherCopy
2104 //=============================================================================
2105 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
2106 (Handle(GEOM_Object) theObject,
2107 Handle(GEOM_Object) theSample)
2111 if (theObject.IsNull() || theSample.IsNull()) return NULL;
2113 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
2114 if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed
2116 Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction();
2117 if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
2119 // Add a new Copy object
2120 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
2122 // Add a transform function (depends on theSample function)
2123 Handle(GEOM_Function) aFunction =
2124 aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType());
2125 if (aFunction.IsNull()) return NULL;
2127 // Check if the function is set correctly
2128 if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL;
2130 if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) {
2131 switch (aSampleFunc->GetType()) {
2134 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2135 GEOMImpl_ITranslate aRI_target (aFunction);
2137 aRI_target.SetVector(aRI_sample.GetVector());
2138 aRI_target.SetStep1(aRI_sample.GetStep1());
2139 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2141 aRI_target.SetOriginal(aLastFunction);
2146 GEOMImpl_ITranslate aRI_sample (aSampleFunc);
2147 GEOMImpl_ITranslate aRI_target (aFunction);
2149 aRI_target.SetVector(aRI_sample.GetVector());
2150 aRI_target.SetStep1(aRI_sample.GetStep1());
2151 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2153 aRI_target.SetVector2(aRI_sample.GetVector2());
2154 aRI_target.SetStep2(aRI_sample.GetStep2());
2155 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2157 aRI_target.SetOriginal(aLastFunction);
2162 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2167 else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) {
2168 switch (aSampleFunc->GetType()) {
2171 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2172 GEOMImpl_IRotate aRI_target (aFunction);
2174 aRI_target.SetAxis(aRI_sample.GetAxis());
2175 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2177 aRI_target.SetOriginal(aLastFunction);
2182 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2183 GEOMImpl_IRotate aRI_target (aFunction);
2185 aRI_target.SetAxis(aRI_sample.GetAxis());
2187 aRI_target.SetNbIter1(aRI_sample.GetNbIter1());
2188 aRI_target.SetNbIter2(aRI_sample.GetNbIter2());
2190 aRI_target.SetAngle(aRI_sample.GetAngle());
2191 aRI_target.SetStep(aRI_sample.GetStep());
2193 aRI_target.SetDir2(aRI_sample.GetDir2());
2195 aRI_target.SetOriginal(aLastFunction);
2198 case ROTATE_THREE_POINTS_COPY:
2200 GEOMImpl_IRotate aRI_sample (aSampleFunc);
2201 GEOMImpl_IRotate aRI_target (aFunction);
2203 aRI_target.SetCentPoint(aRI_sample.GetCentPoint());
2204 aRI_target.SetPoint1(aRI_sample.GetPoint1());
2205 aRI_target.SetPoint2(aRI_sample.GetPoint2());
2207 aRI_target.SetOriginal(aLastFunction);
2212 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2218 SetErrorCode("Not implemented case of TransformLikeOtherCopy");
2222 // Compute the transformation
2224 #if OCC_VERSION_LARGE > 0x06010000
2227 if (!GetSolver()->ComputeFunction(aFunction)) {
2228 SetErrorCode("Driver failed");
2232 catch (Standard_Failure) {
2233 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2234 SetErrorCode(aFail->GetMessageString());
2238 //Make a Python command
2239 //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy("
2240 // << theObject << ", " << theSample << ")";