mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-16 16:50:36 +05:00
In Translate*() allow for definition of Vector as a list of 3 components
This commit is contained in:
parent
71b66afd04
commit
31345e6622
@ -3666,7 +3666,7 @@ class Mesh:
|
|||||||
|
|
||||||
## Translates the elements
|
## Translates the elements
|
||||||
# @param IDsOfElements list of elements ids
|
# @param IDsOfElements list of elements ids
|
||||||
# @param Vector the direction of translation (DirStruct or vector)
|
# @param Vector the direction of translation (DirStruct or vector or 3 vector components)
|
||||||
# @param Copy allows copying the translated elements
|
# @param Copy allows copying the translated elements
|
||||||
# @param MakeGroups forces the generation of new groups from existing ones (if Copy)
|
# @param MakeGroups forces the generation of new groups from existing ones (if Copy)
|
||||||
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
|
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
|
||||||
@ -3676,6 +3676,8 @@ class Mesh:
|
|||||||
IDsOfElements = self.GetElementsId()
|
IDsOfElements = self.GetElementsId()
|
||||||
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Vector = self.smeshpyD.GetDirStruct(Vector)
|
Vector = self.smeshpyD.GetDirStruct(Vector)
|
||||||
|
if isinstance( Vector, list ):
|
||||||
|
Vector = self.smeshpyD.MakeDirStruct(*Vector)
|
||||||
self.mesh.SetParameters(Vector.PS.parameters)
|
self.mesh.SetParameters(Vector.PS.parameters)
|
||||||
if Copy and MakeGroups:
|
if Copy and MakeGroups:
|
||||||
return self.editor.TranslateMakeGroups(IDsOfElements, Vector)
|
return self.editor.TranslateMakeGroups(IDsOfElements, Vector)
|
||||||
@ -3684,7 +3686,7 @@ class Mesh:
|
|||||||
|
|
||||||
## Creates a new mesh of translated elements
|
## Creates a new mesh of translated elements
|
||||||
# @param IDsOfElements list of elements ids
|
# @param IDsOfElements list of elements ids
|
||||||
# @param Vector the direction of translation (DirStruct or vector)
|
# @param Vector the direction of translation (DirStruct or vector or 3 vector components)
|
||||||
# @param MakeGroups forces the generation of new groups from existing ones
|
# @param MakeGroups forces the generation of new groups from existing ones
|
||||||
# @param NewMeshName the name of the newly created mesh
|
# @param NewMeshName the name of the newly created mesh
|
||||||
# @return instance of Mesh class
|
# @return instance of Mesh class
|
||||||
@ -3694,13 +3696,15 @@ class Mesh:
|
|||||||
IDsOfElements = self.GetElementsId()
|
IDsOfElements = self.GetElementsId()
|
||||||
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Vector = self.smeshpyD.GetDirStruct(Vector)
|
Vector = self.smeshpyD.GetDirStruct(Vector)
|
||||||
|
if isinstance( Vector, list ):
|
||||||
|
Vector = self.smeshpyD.MakeDirStruct(*Vector)
|
||||||
self.mesh.SetParameters(Vector.PS.parameters)
|
self.mesh.SetParameters(Vector.PS.parameters)
|
||||||
mesh = self.editor.TranslateMakeMesh(IDsOfElements, Vector, MakeGroups, NewMeshName)
|
mesh = self.editor.TranslateMakeMesh(IDsOfElements, Vector, MakeGroups, NewMeshName)
|
||||||
return Mesh ( self.smeshpyD, self.geompyD, mesh )
|
return Mesh ( self.smeshpyD, self.geompyD, mesh )
|
||||||
|
|
||||||
## Translates the object
|
## Translates the object
|
||||||
# @param theObject the object to translate (mesh, submesh, or group)
|
# @param theObject the object to translate (mesh, submesh, or group)
|
||||||
# @param Vector direction of translation (DirStruct or geom vector)
|
# @param Vector direction of translation (DirStruct or geom vector or 3 vector components)
|
||||||
# @param Copy allows copying the translated elements
|
# @param Copy allows copying the translated elements
|
||||||
# @param MakeGroups forces the generation of new groups from existing ones (if Copy)
|
# @param MakeGroups forces the generation of new groups from existing ones (if Copy)
|
||||||
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
|
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
|
||||||
@ -3710,6 +3714,8 @@ class Mesh:
|
|||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Vector = self.smeshpyD.GetDirStruct(Vector)
|
Vector = self.smeshpyD.GetDirStruct(Vector)
|
||||||
|
if isinstance( Vector, list ):
|
||||||
|
Vector = self.smeshpyD.MakeDirStruct(*Vector)
|
||||||
self.mesh.SetParameters(Vector.PS.parameters)
|
self.mesh.SetParameters(Vector.PS.parameters)
|
||||||
if Copy and MakeGroups:
|
if Copy and MakeGroups:
|
||||||
return self.editor.TranslateObjectMakeGroups(theObject, Vector)
|
return self.editor.TranslateObjectMakeGroups(theObject, Vector)
|
||||||
@ -3718,16 +3724,18 @@ class Mesh:
|
|||||||
|
|
||||||
## Creates a new mesh from the translated object
|
## Creates a new mesh from the translated object
|
||||||
# @param theObject the object to translate (mesh, submesh, or group)
|
# @param theObject the object to translate (mesh, submesh, or group)
|
||||||
# @param Vector the direction of translation (DirStruct or geom vector)
|
# @param Vector the direction of translation (DirStruct or geom vector or 3 vector components)
|
||||||
# @param MakeGroups forces the generation of new groups from existing ones
|
# @param MakeGroups forces the generation of new groups from existing ones
|
||||||
# @param NewMeshName the name of the newly created mesh
|
# @param NewMeshName the name of the newly created mesh
|
||||||
# @return instance of Mesh class
|
# @return instance of Mesh class
|
||||||
# @ingroup l2_modif_trsf
|
# @ingroup l2_modif_trsf
|
||||||
def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
|
def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
|
||||||
if (isinstance(theObject, Mesh)):
|
if isinstance( theObject, Mesh ):
|
||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if (isinstance(Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
if isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object ):
|
||||||
Vector = self.smeshpyD.GetDirStruct(Vector)
|
Vector = self.smeshpyD.GetDirStruct(Vector)
|
||||||
|
if isinstance( Vector, list ):
|
||||||
|
Vector = self.smeshpyD.MakeDirStruct(*Vector)
|
||||||
self.mesh.SetParameters(Vector.PS.parameters)
|
self.mesh.SetParameters(Vector.PS.parameters)
|
||||||
mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
|
mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
|
||||||
return Mesh( self.smeshpyD, self.geompyD, mesh )
|
return Mesh( self.smeshpyD, self.geompyD, mesh )
|
||||||
|
Loading…
Reference in New Issue
Block a user