From 86019a6c24414f2ad9dc686c32ee9e97cc1174bd Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 11 Mar 2008 13:36:55 +0000 Subject: [PATCH] NPAL 12483 Translate an object given a vector and a length --- src/GEOM_SWIG/GEOM_TestAll.py | 2 ++ src/GEOM_SWIG/geompyDC.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index 4c2d3675a..07ed3e95d 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -171,6 +171,7 @@ def TestAll (geompy, math): #Transform objects Translation = geompy.MakeTranslationTwoPoints(Box, px, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr TranslVect = geompy.MakeTranslationVector(Box, vxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr + TranslVectD = geompy.MakeTranslationVectorDistance(Box, vxyz, 50.0) #(2 GEOM_Object_ptr)->GEOM_Object_ptr Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr RotatPnt = geompy.MakeRotationThreePoints(Box, px, py, pz) #(4 GEOM_Object_ptr)->GEOM_Object_ptr Scale = geompy.MakeScaleTransform(Box, p0, factor) # @@ -315,6 +316,7 @@ def TestAll (geompy, math): id_Translation = geompy.addToStudy(Translation, "Translation") id_TranslVect = geompy.addToStudy(TranslVect , "Translation along vector") + id_TranslVectD = geompy.addToStudy(TranslVectD, "Translation along vector with defined distance") id_Rotation = geompy.addToStudy(Rotation, "Rotation") id_RotatPnt = geompy.addToStudy(RotatPnt, "Rotation by three points") id_Scale = geompy.addToStudy(Scale, "Scale") diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 5853af966..cfd7fdb20 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -1615,6 +1615,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("TranslateVectorCopy", self.TrsfOp) return anObj + ## Translate the given object along the given vector on given distance, + # creating its copy before the translation. + # @param theObject The object to be translated. + # @param theVector The translation vector. + # @param theDistance The translation distance. + # @return New GEOM_Object, containing the translated object. + # + # Example: see GEOM_TestAll.py + def MakeTranslationVectorDistance(self,theObject, theVector, theDistance): + anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1) + RaiseIfFailed("TranslateVectorDistance", self.TrsfOp) + return anObj + ## Rotate the given object around the given axis # on the given angle, creating its copy before the rotatation. # @param theObject The object to be rotated.