3 #include "GEOMImpl_ITransformOperations.hxx"
7 #include "Utils_ExceptHandlers.hxx"
9 #include <TFunction_DriverTable.hxx>
10 #include <TFunction_Driver.hxx>
11 #include <TFunction_Logbook.hxx>
12 #include <TDF_Tool.hxx>
14 #include "GEOM_Function.hxx"
16 #include "GEOMImpl_TranslateDriver.hxx"
17 #include "GEOMImpl_MirrorDriver.hxx"
18 #include "GEOMImpl_OffsetDriver.hxx"
19 #include "GEOMImpl_ScaleDriver.hxx"
20 #include "GEOMImpl_RotateDriver.hxx"
21 #include "GEOMImpl_PositionDriver.hxx"
23 #include "GEOMImpl_ITranslate.hxx"
24 #include "GEOMImpl_IMirror.hxx"
25 #include "GEOMImpl_IOffset.hxx"
26 #include "GEOMImpl_IScale.hxx"
27 #include "GEOMImpl_IRotate.hxx"
28 #include "GEOMImpl_IPosition.hxx"
30 #include "GEOMImpl_Types.hxx"
32 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
34 //=============================================================================
38 //=============================================================================
40 GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine, int theDocID)
41 : GEOM_IOperations(theEngine, theDocID)
43 MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations");
46 //=============================================================================
50 //=============================================================================
52 GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations()
54 MESSAGE("GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations");
58 //=============================================================================
62 //=============================================================================
63 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
64 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
68 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
70 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
71 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
73 // Get last functions of the arguments
74 Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
75 Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
77 //Add a translate function
78 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS);
80 if (aFunction.IsNull()) return NULL;
82 //Check if the function is set correctly
83 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
85 GEOMImpl_ITranslate aTI (aFunction);
88 aTI.SetOriginal(aLastFunction);
90 //Compute the translation
92 if (!GetSolver()->ComputeFunction(aFunction)) {
93 SetErrorCode("Translation driver failed");
97 catch (Standard_Failure) {
98 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
99 SetErrorCode(aFail->GetMessageString());
103 //Make a Python command
104 TCollection_AsciiString anEntry, aDescr;
105 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
106 aDescr += (anEntry+" = ITransformOperations.TranslateTwoPoints(");
107 aDescr += (anEntry+", ");
108 TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
109 aDescr += (anEntry+", ");
110 TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
111 aDescr += (anEntry+")");
112 aFunction->SetDescription(aDescr);
118 //=============================================================================
122 //=============================================================================
123 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
124 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
128 if (theObject.IsNull()) return NULL;
130 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
131 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
133 //Add a translate function
134 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ);
136 if (aFunction.IsNull()) return NULL;
138 //Check if the function is set correctly
139 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
141 GEOMImpl_ITranslate aTI(aFunction);
145 aTI.SetOriginal(aLastFunction);
147 //Compute the translation
149 if (!GetSolver()->ComputeFunction(aFunction)) {
150 SetErrorCode("Translation driver failed");
154 catch (Standard_Failure) {
155 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
156 SetErrorCode(aFail->GetMessageString());
160 //Make a Python command
161 TCollection_AsciiString anEntry, aDescr;
162 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
163 aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZ(");
164 aDescr += (anEntry+", ");
165 aDescr += (TCollection_AsciiString(theX)+", ");
166 aDescr += (TCollection_AsciiString(theY)+", ");
167 aDescr += (TCollection_AsciiString(theZ)+")");
168 aFunction->SetDescription(aDescr);
175 //=============================================================================
177 * TranslateTwoPointsCopy
179 //=============================================================================
180 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
181 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
185 if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
187 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
188 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
190 //Add a new Copy object
191 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
193 //Add a translate function
194 Handle(GEOM_Function) aFunction =
195 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS_COPY);
197 //Check if the function is set correctly
198 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
200 GEOMImpl_ITranslate aTI(aFunction);
201 aTI.SetPoint1(thePoint1->GetLastFunction());
202 aTI.SetPoint2(thePoint2->GetLastFunction());
203 //aTI.SetShape(theObject->GetValue());
204 aTI.SetOriginal(aLastFunction);
206 //Compute the translation
208 if (!GetSolver()->ComputeFunction(aFunction)) {
209 SetErrorCode("Translation driver failed");
213 catch (Standard_Failure) {
214 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
215 SetErrorCode(aFail->GetMessageString());
219 //Make a Python command
220 TCollection_AsciiString anEntry, aDescr;
221 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
222 aDescr += (anEntry+" = ITransformOperations.TranslateTwoPointsCopy(");
223 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
224 aDescr += (anEntry+", ");
225 TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
226 aDescr += (anEntry+", ");
227 TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
228 aDescr += (anEntry+")");
229 aFunction->SetDescription(aDescr);
235 //=============================================================================
237 * TranslateDXDYDZCopy
239 //=============================================================================
240 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
241 (Handle(GEOM_Object) theObject, double theX, double theY, double theZ)
245 if (theObject.IsNull()) return NULL;
247 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
248 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
250 //Add a new Copy object
251 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
253 //Add a translate function
254 Handle(GEOM_Function) aFunction =
255 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ_COPY);
257 //Check if the function is set correctly
258 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
260 GEOMImpl_ITranslate aTI(aFunction);
264 aTI.SetOriginal(aLastFunction);
266 //Compute the translation
268 if (!GetSolver()->ComputeFunction(aFunction)) {
269 SetErrorCode("Translation driver failed");
273 catch (Standard_Failure) {
274 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
275 SetErrorCode(aFail->GetMessageString());
279 //Make a Python command
280 TCollection_AsciiString anEntry, aDescr;
281 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
282 aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZCopy(");
283 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
284 aDescr += (anEntry+", ");
285 aDescr += (TCollection_AsciiString(theX)+", ");
286 aDescr += (TCollection_AsciiString(theY)+", ");
287 aDescr += (TCollection_AsciiString(theZ)+")");
288 aFunction->SetDescription(aDescr);
295 //=============================================================================
299 //=============================================================================
300 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
301 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
305 if (theObject.IsNull() || theVector.IsNull()) return NULL;
307 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
308 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
310 // Get last functions of the arguments
311 Handle(GEOM_Function) aVF = theVector->GetLastFunction();
313 //Add a translate function
314 aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR);
316 if (aFunction.IsNull()) return NULL;
318 //Check if the function is set correctly
319 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
321 GEOMImpl_ITranslate aTI (aFunction);
323 aTI.SetOriginal(aLastFunction);
325 //Compute the translation
327 if (!GetSolver()->ComputeFunction(aFunction)) {
328 SetErrorCode("Translation driver failed");
332 catch (Standard_Failure) {
333 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
334 SetErrorCode(aFail->GetMessageString());
338 //Make a Python command
339 TCollection_AsciiString anEntry, aDescr;
340 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
341 aDescr += (anEntry+" = ITransformOperations.TranslateVector(");
342 aDescr += (anEntry+", ");
343 TDF_Tool::Entry(theVector->GetEntry(), anEntry);
344 aDescr += (anEntry+") ");
345 aFunction->SetDescription(aDescr);
351 //=============================================================================
353 * TranslateVectorCopy
355 //=============================================================================
356 Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
357 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector)
361 if (theObject.IsNull() || theVector.IsNull()) return NULL;
363 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
364 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
366 //Add a new Copy object
367 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
369 //Add a translate function
370 Handle(GEOM_Function) aFunction =
371 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_COPY);
373 //Check if the function is set correctly
374 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
376 GEOMImpl_ITranslate aTI(aFunction);
377 aTI.SetVector(theVector->GetLastFunction());
378 // aTI.SetShape(theObject->GetValue());
379 aTI.SetOriginal(aLastFunction);
381 //Compute the translation
383 if (!GetSolver()->ComputeFunction(aFunction)) {
384 SetErrorCode("Translation driver failed");
388 catch (Standard_Failure) {
389 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
390 SetErrorCode(aFail->GetMessageString());
394 //Make a Python command
395 TCollection_AsciiString anEntry, aDescr;
396 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
397 aDescr += (anEntry+" = ITransformOperations.TranslateVectorCopy(");
398 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
399 aDescr += (anEntry+", ");
400 TDF_Tool::Entry(theVector->GetEntry(), anEntry);
401 aDescr += (anEntry+")");
402 aFunction->SetDescription(aDescr);
408 //=============================================================================
412 //=============================================================================
413 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
414 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector,
415 double theStep, Standard_Integer theNbTimes)
419 if (theObject.IsNull() || theVector.IsNull()) return NULL;
421 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
422 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
424 //Add a new Copy object
425 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
427 //Add a translate function
428 Handle(GEOM_Function) aFunction =
429 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_1D);
431 //Check if the function is set correctly
432 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
434 GEOMImpl_ITranslate aTI(aFunction);
435 aTI.SetVector(theVector->GetLastFunction());
436 aTI.SetOriginal(aLastFunction);
437 aTI.SetStep1(theStep);
438 aTI.SetNbIter1(theNbTimes);
440 //Compute the translation
442 if (!GetSolver()->ComputeFunction(aFunction)) {
443 SetErrorCode("Translation driver failed");
447 catch (Standard_Failure) {
448 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
449 SetErrorCode(aFail->GetMessageString());
453 //Make a Python command
454 TCollection_AsciiString anEntry, aDescr;
455 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
456 aDescr += (anEntry+" = ITransformOperations.Translate1D(");
457 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
458 aDescr += (anEntry+", ");
459 TDF_Tool::Entry(theVector->GetEntry(), anEntry);
460 aDescr += (anEntry+", ");
461 aDescr += (TCollection_AsciiString(theStep)+", ");
462 aDescr += (TCollection_AsciiString(theNbTimes)+") ");
464 aFunction->SetDescription(aDescr);
470 //=============================================================================
474 //=============================================================================
475 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject,
476 Handle(GEOM_Object) theVector,
478 Standard_Integer theNbTimes1,
479 Handle(GEOM_Object) theVector2,
481 Standard_Integer theNbTimes2)
485 if (theObject.IsNull() || theVector.IsNull() || theVector2.IsNull()) return NULL;
487 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
488 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
490 //Add a new Copy object
491 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
493 //Add a translate function
494 Handle(GEOM_Function) aFunction =
495 aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_2D);
497 //Check if the function is set correctly
498 if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
500 GEOMImpl_ITranslate aTI(aFunction);
501 aTI.SetVector(theVector->GetLastFunction());
502 aTI.SetVector2(theVector2->GetLastFunction());
503 aTI.SetOriginal(aLastFunction);
504 aTI.SetStep1(theStep1);
505 aTI.SetNbIter1(theNbTimes1);
506 aTI.SetStep2(theStep2);
507 aTI.SetNbIter2(theNbTimes2);
509 //Compute the translation
511 if (!GetSolver()->ComputeFunction(aFunction)) {
512 SetErrorCode("Translation driver failed");
516 catch (Standard_Failure) {
517 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
518 SetErrorCode(aFail->GetMessageString());
522 //Make a Python command
523 TCollection_AsciiString anEntry, aDescr;
524 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
525 aDescr += (anEntry+" = ITransformOperations.Translate2D(");
526 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
527 aDescr += (anEntry+", ");
528 TDF_Tool::Entry(theVector->GetEntry(), anEntry);
529 aDescr += (anEntry+", ");
530 aDescr += (TCollection_AsciiString(theStep1)+", ");
531 aDescr += (TCollection_AsciiString(theNbTimes2)+", ");
532 TDF_Tool::Entry(theVector2->GetEntry(), anEntry);
533 aDescr += (anEntry+", ");
534 aDescr += (TCollection_AsciiString(theStep2)+", ");
535 aDescr += (TCollection_AsciiString(theNbTimes2)+") ");
537 aFunction->SetDescription(aDescr);
544 //=============================================================================
548 //=============================================================================
549 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
550 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
554 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
556 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
557 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
559 // Get last functions of the arguments
560 Handle(GEOM_Function) aPF = thePlane->GetLastFunction();
562 //Add a mirror function
563 Handle(GEOM_Function) aFunction =
564 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE);
565 if (aFunction.IsNull()) return NULL;
567 //Check if the function is set correctly
568 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
570 GEOMImpl_IMirror aTI (aFunction);
572 aTI.SetOriginal(aLastFunction);
576 if (!GetSolver()->ComputeFunction(aFunction)) {
577 SetErrorCode("Mirror driver failed");
581 catch (Standard_Failure) {
582 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
583 SetErrorCode(aFail->GetMessageString());
587 //Make a Python command
588 TCollection_AsciiString anEntry, aDescr;
589 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
590 aDescr += (anEntry + " = ITransformOperations.MirrorPlane(");
591 aDescr += (anEntry + ", ");
592 TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
593 aDescr += (anEntry + ") ");
594 aFunction->SetDescription(aDescr);
600 //=============================================================================
604 //=============================================================================
605 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
606 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane)
610 if (theObject.IsNull() || thePlane.IsNull()) return NULL;
612 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
613 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
615 //Add a new Copy object
616 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
618 //Add a mirror function
619 Handle(GEOM_Function) aFunction =
620 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE_COPY);
622 //Check if the function is set correctly
623 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
625 GEOMImpl_IMirror aTI (aFunction);
626 aTI.SetPlane(thePlane->GetLastFunction());
627 aTI.SetOriginal(aLastFunction);
631 if (!GetSolver()->ComputeFunction(aFunction)) {
632 SetErrorCode("Mirror driver failed");
636 catch (Standard_Failure) {
637 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
638 SetErrorCode(aFail->GetMessageString());
642 //Make a Python command
643 TCollection_AsciiString anEntry, aDescr;
644 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
645 aDescr += (anEntry + " = ITransformOperations.MirrorPlaneCopy(");
646 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
647 aDescr += (anEntry + ", ");
648 TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
649 aDescr += (anEntry + ")");
650 aFunction->SetDescription(aDescr);
656 //=============================================================================
660 //=============================================================================
661 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
662 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
666 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
668 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
669 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
671 // Get last functions of the arguments
672 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
674 //Add a mirror function
675 Handle(GEOM_Function) aFunction =
676 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT);
677 if (aFunction.IsNull()) return NULL;
679 //Check if the function is set correctly
680 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
682 GEOMImpl_IMirror aTI (aFunction);
684 aTI.SetOriginal(aLastFunction);
688 if (!GetSolver()->ComputeFunction(aFunction)) {
689 SetErrorCode("Mirror driver failed");
693 catch (Standard_Failure) {
694 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
695 SetErrorCode(aFail->GetMessageString());
699 //Make a Python command
700 TCollection_AsciiString anEntry, aDescr;
701 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
702 aDescr += (anEntry + " = ITransformOperations.MirrorPoint(");
703 aDescr += (anEntry + ", ");
704 TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
705 aDescr += (anEntry + ") ");
706 aFunction->SetDescription(aDescr);
712 //=============================================================================
716 //=============================================================================
717 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
718 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint)
722 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
724 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
725 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
727 //Add a new Copy object
728 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
730 //Add a mirror function
731 Handle(GEOM_Function) aFunction =
732 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT_COPY);
734 //Check if the function is set correctly
735 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
737 GEOMImpl_IMirror aTI (aFunction);
738 aTI.SetPoint(thePoint->GetLastFunction());
739 aTI.SetOriginal(aLastFunction);
743 if (!GetSolver()->ComputeFunction(aFunction)) {
744 SetErrorCode("Mirror driver failed");
748 catch (Standard_Failure) {
749 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
750 SetErrorCode(aFail->GetMessageString());
754 //Make a Python command
755 TCollection_AsciiString anEntry, aDescr;
756 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
757 aDescr += (anEntry + " = ITransformOperations.MirrorPointCopy(");
758 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
759 aDescr += (anEntry + ", ");
760 TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
761 aDescr += (anEntry + ")");
762 aFunction->SetDescription(aDescr);
768 //=============================================================================
772 //=============================================================================
773 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
774 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
778 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
780 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
781 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
783 // Get last functions of the arguments
784 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
786 //Add a mirror function
787 Handle(GEOM_Function) aFunction =
788 theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS);
789 if (aFunction.IsNull()) return NULL;
791 //Check if the function is set correctly
792 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
794 GEOMImpl_IMirror aTI (aFunction);
796 aTI.SetOriginal(aLastFunction);
800 if (!GetSolver()->ComputeFunction(aFunction)) {
801 SetErrorCode("Mirror driver failed");
805 catch (Standard_Failure) {
806 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
807 SetErrorCode(aFail->GetMessageString());
811 //Make a Python command
812 TCollection_AsciiString anEntry, aDescr;
813 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
814 aDescr += (anEntry + " = ITransformOperations.MirrorAxis(");
815 aDescr += (anEntry + ", ");
816 TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
817 aDescr += (anEntry + ") ");
818 aFunction->SetDescription(aDescr);
824 //=============================================================================
828 //=============================================================================
829 Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
830 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis)
834 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
836 Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
837 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
839 //Add a new Copy object
840 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
842 //Add a mirror function
843 Handle(GEOM_Function) aFunction =
844 aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS_COPY);
846 //Check if the function is set correctly
847 if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL;
849 GEOMImpl_IMirror aTI (aFunction);
850 aTI.SetAxis(theAxis->GetLastFunction());
851 aTI.SetOriginal(aLastFunction);
855 if (!GetSolver()->ComputeFunction(aFunction)) {
856 SetErrorCode("Mirror driver failed");
860 catch (Standard_Failure) {
861 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
862 SetErrorCode(aFail->GetMessageString());
866 //Make a Python command
867 TCollection_AsciiString anEntry, aDescr;
868 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
869 aDescr += (anEntry + " = ITransformOperations.MirrorAxisCopy(");
870 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
871 aDescr += (anEntry + ", ");
872 TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
873 aDescr += (anEntry + ")");
874 aFunction->SetDescription(aDescr);
881 //=============================================================================
885 //=============================================================================
886 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
887 (Handle(GEOM_Object) theObject, double theOffset)
891 if (theObject.IsNull()) return NULL;
893 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
894 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
896 //Add a new Offset function
897 Handle(GEOM_Function) aFunction =
898 theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE);
899 if (aFunction.IsNull()) return NULL;
901 //Check if the function is set correctly
902 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
904 GEOMImpl_IOffset aTI (aFunction);
905 aTI.SetShape(anOriginal);
906 aTI.SetValue(theOffset);
910 if (!GetSolver()->ComputeFunction(aFunction)) {
911 SetErrorCode("Offset driver failed");
915 catch (Standard_Failure) {
916 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
917 SetErrorCode(aFail->GetMessageString());
921 //Make a Python command
922 TCollection_AsciiString anEntry, aDescr;
923 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
924 aDescr += (anEntry+" = ITransformOperations.OffsetShape(");
925 aDescr += (anEntry+", ");
926 aDescr += TCollection_AsciiString(theOffset)+")";
927 aFunction->SetDescription(aDescr);
933 //=============================================================================
937 //=============================================================================
938 Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
939 (Handle(GEOM_Object) theObject, double theOffset)
943 if (theObject.IsNull()) return NULL;
945 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
946 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
948 //Add a new Copy object
949 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
951 //Add a new Offset function
952 Handle(GEOM_Function) aFunction =
953 aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY);
954 if (aFunction.IsNull()) return NULL;
956 //Check if the function is set correctly
957 if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
959 GEOMImpl_IOffset aTI (aFunction);
960 aTI.SetShape(anOriginal);
961 aTI.SetValue(theOffset);
965 if (!GetSolver()->ComputeFunction(aFunction)) {
966 SetErrorCode("Offset driver failed");
970 catch (Standard_Failure) {
971 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
972 SetErrorCode(aFail->GetMessageString());
976 //Make a Python command
977 TCollection_AsciiString anEntry, aDescr;
978 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
979 aDescr += (anEntry+" = ITransformOperations.OffsetShapeCopy(");
980 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
981 aDescr += (anEntry+", ");
982 aDescr += TCollection_AsciiString(theOffset)+")";
983 aFunction->SetDescription(aDescr);
990 //=============================================================================
994 //=============================================================================
995 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
996 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1000 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
1002 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1003 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1005 // Get last functions of the arguments
1006 Handle(GEOM_Function) aPF = thePoint->GetLastFunction();
1008 //Add a scale function
1009 Handle(GEOM_Function) aFunction =
1010 theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE);
1011 if (aFunction.IsNull()) return NULL;
1013 //Check if the function is set correctly
1014 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1016 GEOMImpl_IScale aTI (aFunction);
1017 aTI.SetShape(anOriginal);
1019 aTI.SetFactor(theFactor);
1023 if (!GetSolver()->ComputeFunction(aFunction)) {
1024 SetErrorCode("Scale driver failed");
1028 catch (Standard_Failure) {
1029 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1030 SetErrorCode(aFail->GetMessageString());
1034 //Make a Python command
1035 TCollection_AsciiString anEntry, aDescr;
1036 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1037 aDescr += (anEntry+" = ITransformOperations.ScaleShape(");
1038 aDescr += (anEntry+", ");
1039 TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
1040 aDescr += (anEntry+", ");
1041 aDescr += TCollection_AsciiString(theFactor)+")";
1042 aFunction->SetDescription(aDescr);
1048 //=============================================================================
1052 //=============================================================================
1053 Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
1054 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor)
1058 if (theObject.IsNull() || thePoint.IsNull()) return NULL;
1060 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1061 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
1063 //Add a new Copy object
1064 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1066 //Add a scale function
1067 Handle(GEOM_Function) aFunction =
1068 aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY);
1069 if (aFunction.IsNull()) return NULL;
1071 //Check if the function is set correctly
1072 if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL;
1074 GEOMImpl_IScale aTI (aFunction);
1075 aTI.SetShape(anOriginal);
1076 aTI.SetPoint(thePoint->GetLastFunction());
1077 aTI.SetFactor(theFactor);
1081 if (!GetSolver()->ComputeFunction(aFunction)) {
1082 SetErrorCode("Scale driver failed");
1086 catch (Standard_Failure) {
1087 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1088 SetErrorCode(aFail->GetMessageString());
1092 //Make a Python command
1093 TCollection_AsciiString anEntry, aDescr;
1094 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
1095 aDescr += (anEntry+" = ITransformOperations.ScaleShapeCopy(");
1096 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1097 aDescr += (anEntry+", ");
1098 TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
1099 aDescr += (anEntry+", ");
1100 aDescr += TCollection_AsciiString(theFactor)+")";
1101 aFunction->SetDescription(aDescr);
1107 //=============================================================================
1111 //=============================================================================
1112 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
1113 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1117 if (theObject.IsNull() || theStartLCS.IsNull() || theEndLCS.IsNull()) return NULL;
1119 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1120 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1122 // Get last functions of the arguments
1123 Handle(GEOM_Function) aStartLCS = theStartLCS->GetLastFunction();
1124 Handle(GEOM_Function) aEndLCS = theEndLCS->GetLastFunction();
1126 //Add a Position function
1127 Handle(GEOM_Function) aFunction =
1128 theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_SHAPE);
1129 if (aFunction.IsNull()) return NULL;
1131 //Check if the function is set correctly
1132 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1134 GEOMImpl_IPosition aTI (aFunction);
1135 aTI.SetShape(anOriginal);
1136 aTI.SetStartLCS(aStartLCS);
1137 aTI.SetEndLCS(aEndLCS);
1139 //Compute the Position
1141 if (!GetSolver()->ComputeFunction(aFunction)) {
1142 SetErrorCode("Position driver failed");
1146 catch (Standard_Failure) {
1147 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1148 SetErrorCode(aFail->GetMessageString());
1152 //Make a Python command
1153 TCollection_AsciiString anEntry, aDescr;
1154 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1155 aDescr += (anEntry+" = ITransformOperations.PositionShape(");
1156 aDescr += (anEntry+", ");
1157 TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry);
1158 aDescr += (anEntry+", ");
1159 TDF_Tool::Entry(theEndLCS->GetEntry(), anEntry);
1160 aDescr += (anEntry+") ");
1161 aFunction->SetDescription(aDescr);
1167 //=============================================================================
1171 //=============================================================================
1172 Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
1173 (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS)
1177 if (theObject.IsNull() || theStartLCS.IsNull() || theEndLCS.IsNull()) return NULL;
1179 Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
1180 if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
1182 //Add a new Copy object
1183 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1185 //Add a position function
1186 Handle(GEOM_Function) aFunction =
1187 aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_SHAPE_COPY);
1188 if (aFunction.IsNull()) return NULL;
1190 //Check if the function is set correctly
1191 if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
1193 GEOMImpl_IPosition aTI (aFunction);
1194 aTI.SetShape(anOriginal);
1195 aTI.SetStartLCS(theStartLCS->GetLastFunction());
1196 aTI.SetEndLCS(theEndLCS->GetLastFunction());
1198 //Compute the position
1200 if (!GetSolver()->ComputeFunction(aFunction)) {
1201 SetErrorCode("Position driver failed");
1205 catch (Standard_Failure) {
1206 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1207 SetErrorCode(aFail->GetMessageString());
1211 //Make a Python command
1212 TCollection_AsciiString anEntry, aDescr;
1213 TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
1214 aDescr += (anEntry+" = ITransformOperations.PositionShapeCopy(");
1215 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1216 aDescr += (anEntry+", ");
1217 TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry);
1218 aDescr += (anEntry+", ");
1219 TDF_Tool::Entry(theEndLCS->GetEntry(), anEntry);
1220 aDescr += (anEntry+")");
1221 aFunction->SetDescription(aDescr);
1227 //=============================================================================
1231 //=============================================================================
1232 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject,
1233 Handle(GEOM_Object) theAxis,
1238 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1240 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1241 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1243 // Get last functions of the arguments
1244 Handle(GEOM_Function) anAF = theAxis->GetLastFunction();
1246 //Add a rotate function
1247 aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE);
1249 if (aFunction.IsNull()) return NULL;
1251 //Check if the function is set correctly
1252 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1254 GEOMImpl_IRotate aRI(aFunction);
1256 aRI.SetOriginal(aLastFunction);
1257 aRI.SetAngle(theAngle);
1259 //Compute the translation
1261 if (!GetSolver()->ComputeFunction(aFunction)) {
1262 SetErrorCode("Rotate driver failed");
1266 catch (Standard_Failure) {
1267 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1268 SetErrorCode(aFail->GetMessageString());
1272 //Make a Python command
1273 TCollection_AsciiString anEntry, aDescr;
1274 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1275 aDescr += (anEntry+" = ITransformOperations.Rotate(");
1276 aDescr += (anEntry+", ");
1277 TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
1278 aDescr += (anEntry+", ");
1279 aDescr += (TCollection_AsciiString(theAngle)+") ");
1280 aFunction->SetDescription(aDescr);
1286 //=============================================================================
1290 //=============================================================================
1291 Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle)
1295 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1297 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1298 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1300 //Add a new Copy object
1301 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1303 //Add a rotate function
1304 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
1305 if (aFunction.IsNull()) return NULL;
1307 //Check if the function is set correctly
1308 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1310 GEOMImpl_IRotate aRI(aFunction);
1311 aRI.SetAxis(theAxis->GetLastFunction());
1312 aRI.SetOriginal(aLastFunction);
1313 aRI.SetAngle(theAngle);
1315 //Compute the translation
1317 if (!GetSolver()->ComputeFunction(aFunction)) {
1318 SetErrorCode("Rotate driver failed");
1322 catch (Standard_Failure) {
1323 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1324 SetErrorCode(aFail->GetMessageString());
1328 //Make a Python command
1329 TCollection_AsciiString anEntry, aDescr;
1330 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1331 aDescr += (anEntry+" = ITransformOperations.RotateCopy(");
1332 aDescr += (anEntry+", ");
1333 TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
1334 aDescr += (anEntry+", ");
1335 aDescr += (TCollection_AsciiString(theAngle)+") ");
1336 aFunction->SetDescription(aDescr);
1342 //=============================================================================
1346 //=============================================================================
1347 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
1348 Handle(GEOM_Object) theAxis,
1349 Standard_Integer theNbTimes)
1353 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1355 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1356 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1358 //Add a new Copy object
1359 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1361 //Add a rotate function
1362 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
1363 if (aFunction.IsNull()) return NULL;
1365 //Check if the function is set correctly
1366 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1368 GEOMImpl_IRotate aRI(aFunction);
1369 aRI.SetOriginal(aLastFunction);
1370 aRI.SetAxis(theAxis->GetLastFunction());
1371 aRI.SetNbIter1(theNbTimes);
1373 //Compute the translation
1375 if (!GetSolver()->ComputeFunction(aFunction)) {
1376 SetErrorCode("Rotate driver failed");
1380 catch (Standard_Failure) {
1381 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1382 SetErrorCode(aFail->GetMessageString());
1386 //Make a Python command
1387 TCollection_AsciiString anEntry, aDescr;
1388 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1389 aDescr += (anEntry+" = ITransformOperations.Rotate1D(");
1390 aDescr += (anEntry+", ");
1391 TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
1392 aDescr += (anEntry+", ");
1393 aDescr += (TCollection_AsciiString(theNbTimes)+") ");
1394 aFunction->SetDescription(aDescr);
1400 //=============================================================================
1404 //=============================================================================
1405 Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
1406 Handle(GEOM_Object) theAxis,
1408 Standard_Integer theNbTimes1,
1410 Standard_Integer theNbTimes2)
1414 if (theObject.IsNull() || theAxis.IsNull()) return NULL;
1416 Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
1417 if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
1419 //Add a new Copy object
1420 Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
1422 //Add a rotate function
1423 aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
1424 if (aFunction.IsNull()) return NULL;
1426 //Check if the function is set correctly
1427 if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
1429 GEOMImpl_IRotate aRI(aFunction);
1430 aRI.SetAxis(theAxis->GetLastFunction());
1431 aRI.SetOriginal(aLastFunction);
1432 aRI.SetNbIter1(theNbTimes1);
1433 aRI.SetNbIter2(theNbTimes2);
1434 aRI.SetAngle(theAngle);
1435 aRI.SetStep(theStep);
1437 //Compute the translation
1439 if (!GetSolver()->ComputeFunction(aFunction)) {
1440 SetErrorCode("Rotate driver failed");
1444 catch (Standard_Failure) {
1445 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1446 SetErrorCode(aFail->GetMessageString());
1450 //Make a Python command
1451 TCollection_AsciiString anEntry, aDescr;
1452 TDF_Tool::Entry(theObject->GetEntry(), anEntry);
1453 aDescr += (anEntry+" = ITransformOperations.Rotate2D(");
1454 aDescr += (anEntry+", ");
1455 TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
1456 aDescr += (anEntry+", ");
1457 aDescr += (TCollection_AsciiString(theAngle)+", ");
1458 aDescr += (TCollection_AsciiString(theNbTimes1)+", ");
1459 aDescr += (TCollection_AsciiString(theStep)+", ");
1460 aDescr += (TCollection_AsciiString(theNbTimes2)+") ");
1461 aFunction->SetDescription(aDescr);