PAL16617 (Modification/Transformation operations with copy don't create a new mesh)

+    SMESH_Mesh MirrorMakeMesh (in long_array IDsOfElements,
+    SMESH_Mesh MirrorObjectMakeMesh (in SMESH_IDSource theObject,
+    SMESH_Mesh TranslateMakeMesh (in long_array IDsOfElements,
+    SMESH_Mesh TranslateObjectMakeMesh (in SMESH_IDSource theObject,
+    SMESH_Mesh RotateMakeMesh (in long_array IDsOfElements,
+    SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
This commit is contained in:
eap 2007-12-19 15:17:34 +00:00
parent 556f0b415d
commit a818f7f6ff

View File

@ -231,7 +231,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @return an instance of Mesh class
def CreateMeshesFromUNV( self,theFileName ):
aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromUNV(self,theFileName)
aMesh = Mesh(self,self.geompyD,aSmeshMesh)
aMesh = Mesh(self.smeshpyD, self.geompyD, aSmeshMesh)
return aMesh
## Create Mesh object(s) importing data from given MED file
@ -240,7 +240,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromMED(self,theFileName)
aMeshes = []
for iMesh in range(len(aSmeshMeshes)) :
aMesh = Mesh(self,self.geompyD,aSmeshMeshes[iMesh])
aMesh = Mesh(self.smeshpyD, self.geompyD, aSmeshMeshes[iMesh])
aMeshes.append(aMesh)
return aMeshes, aStatus
@ -248,7 +248,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @return an instance of Mesh class
def CreateMeshesFromSTL( self, theFileName ):
aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromSTL(self,theFileName)
aMesh = Mesh(self,self.geompyD,aSmeshMesh)
aMesh = Mesh(self.smeshpyD, self.geompyD, aSmeshMesh)
return aMesh
## From SMESH_Gen interface
@ -1759,7 +1759,7 @@ class Mesh:
'its expectation' % ( glob, dim, name ))
else:
reason = "For unknown reason."+\
" Revise Mesh.Compute() implementation in smesh.py!"
" Revise Mesh.Compute() implementation in smeshDC.py!"
pass
if allReasons != "":
allReasons += "\n"
@ -2557,6 +2557,8 @@ class Mesh:
## Reorient all elements of the object
# @param theObject is mesh, submesh or group
def ReorientObject(self, theObject):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.ReorientObject(theObject)
## Fuse neighbour triangles into quadrangles.
@ -2577,6 +2579,8 @@ class Mesh:
# is still performed; theMaxAngle is mesured in radians.
# @return TRUE in case of success, FALSE otherwise.
def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.TriToQuadObject(theObject, self.smeshpyD.GetFunctor(theCriterion), MaxAngle)
## Split quadrangles into triangles.
@ -2592,6 +2596,8 @@ class Mesh:
# @param theObject object to taking list of elements from, is mesh, submesh or group
# @param theCriterion is FT_...; used to choose a diagonal for splitting.
def QuadToTriObject (self, theObject, theCriterion):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.QuadToTriObject(theObject, self.smeshpyD.GetFunctor(theCriterion))
## Split quadrangles into triangles.
@ -2606,6 +2612,8 @@ class Mesh:
## Split quadrangles into triangles.
# @param theObject is object to taking list of elements from, is mesh, submesh or group
def SplitQuadObject (self, theObject, Diag13):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.SplitQuadObject(theObject, Diag13)
## Find better splitting of the given quadrangle.
@ -2778,7 +2786,9 @@ class Mesh:
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
def SmoothObject(self, theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxxAspectRatio, Method):
return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxxAspectRatio, Method)
## Parametric smooth the given elements
@ -2804,6 +2814,8 @@ class Mesh:
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
def SmoothParametricObject(self, theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method)
@ -2852,6 +2864,8 @@ class Mesh:
# @param Tolerance tolerance
# @param MakeGroups to generate new groups from existing ones
def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)):
Axix = self.smeshpyD.GetAxisStruct(Axix)
if MakeGroups:
@ -2899,6 +2913,8 @@ class Mesh:
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if MakeGroups:
@ -2912,6 +2928,8 @@ class Mesh:
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if MakeGroups:
@ -2925,6 +2943,8 @@ class Mesh:
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if MakeGroups:
@ -2976,6 +2996,8 @@ class Mesh:
def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
if MakeGroups:
@ -3003,6 +3025,22 @@ class Mesh:
self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
return []
## Create a new mesh by symmetrical copy of mesh elements
# @param IDsOfElements list of elements ids
# @param Mirror is AxisStruct or geom object(point, line, plane)
# @param theMirrorType is POINT, AXIS or PLANE
# If the Mirror is geom object this parameter is unnecessary
# @param MakeGroups to generate new groups from existing ones
# @param NewMeshName is a name of new mesh to create
def MirrorMakeMesh(self, IDsOfElements, Mirror, theMirrorType, MakeGroups=0, NewMeshName=""):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
Mirror = self.smeshpyD.GetAxisStruct(Mirror)
mesh = self.editor.MirrorMakeMesh(IDsOfElements, Mirror, theMirrorType,
MakeGroups, NewMeshName)
return Mesh(self.smeshpyD,self.geompyD,mesh)
## Symmetrical copy of object
# @param theObject mesh, submesh or group
# @param Mirror is AxisStruct or geom object(point, line, plane)
@ -3011,6 +3049,8 @@ class Mesh:
# @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
# @param MakeGroups to generate new groups from existing ones (if Copy)
def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
Mirror = self.smeshpyD.GetAxisStruct(Mirror)
if Copy and MakeGroups:
@ -3018,6 +3058,22 @@ class Mesh:
self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
return []
## Create a new mesh by symmetrical copy of object
# @param theObject mesh, submesh or group
# @param Mirror is AxisStruct or geom object(point, line, plane)
# @param theMirrorType is POINT, AXIS or PLANE
# If the Mirror is geom object this parameter is unnecessary
# @param MakeGroups to generate new groups from existing ones
# @param NewMeshName is a name of new mesh to create
def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
Mirror = GetAxisStruct(Mirror)
mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType,
MakeGroups, NewMeshName)
return Mesh( self.smeshpyD,self.geompyD,mesh )
## Translates the elements
# @param IDsOfElements list of elements ids
# @param Vector direction of translation(DirStruct or vector)
@ -3033,12 +3089,27 @@ class Mesh:
self.editor.Translate(IDsOfElements, Vector, Copy)
return []
## Create a new mesh of translated elements
# @param IDsOfElements list of elements ids
# @param Vector direction of translation(DirStruct or vector)
# @param MakeGroups to generate new groups from existing ones
# @param NewMeshName is a name of new mesh to create
def TranslateMakeMesh(self, IDsOfElements, Vector, MakeGroups=False, NewMeshName=""):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
Vector = self.smeshpyD.GetDirStruct(Vector)
mesh = self.editor.TranslateMakeMesh(IDsOfElements, Vector, MakeGroups, NewMeshName)
return Mesh ( self.smeshpyD, self.geompyD, mesh )
## Translates the object
# @param theObject object to translate(mesh, submesh, or group)
# @param Vector direction of translation(DirStruct or geom vector)
# @param Copy allows to copy the translated elements
# @param MakeGroups to generate new groups from existing ones (if Copy)
def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
Vector = self.smeshpyD.GetDirStruct(Vector)
if Copy and MakeGroups:
@ -3046,6 +3117,19 @@ class Mesh:
self.editor.TranslateObject(theObject, Vector, Copy)
return []
## Create a new mesh from translated object
# @param theObject object to translate(mesh, submesh, or group)
# @param Vector direction of translation(DirStruct or geom vector)
# @param MakeGroups to generate new groups from existing ones
# @param NewMeshName is a name of new mesh to create
def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
Vector = self.smeshpyD.GetDirStruct(Vector)
mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
return Mesh( self.smeshpyD, self.geompyD, mesh )
## Rotates the elements
# @param IDsOfElements list of elements ids
# @param Axis axis of rotation(AxisStruct or geom line)
@ -3062,6 +3146,21 @@ class Mesh:
self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
return []
## Create a new mesh of rotated elements
# @param IDsOfElements list of element ids
# @param Axis axis of rotation(AxisStruct or geom line)
# @param AngleInRadians angle of rotation(in radians)
# @param MakeGroups to generate new groups from existing ones
# @param NewMeshName is a name of new mesh to create
def RotateMakeMesh (self, IDsOfElements, Axis, AngleInRadians, MakeGroups=0, NewMeshName=""):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
Axis = self.smeshpyD.GetAxisStruct(Axis)
mesh = self.editor.RotateMakeMesh(IDsOfElements, Axis, AngleInRadians,
MakeGroups, NewMeshName)
return Mesh( self.smeshpyD, self.geompyD, mesh )
## Rotates the object
# @param theObject object to rotate(mesh, submesh, or group)
# @param Axis axis of rotation(AxisStruct or geom line)
@ -3069,6 +3168,8 @@ class Mesh:
# @param Copy allows to copy the rotated elements
# @param MakeGroups to generate new groups from existing ones (if Copy)
def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
Axis = self.smeshpyD.GetAxisStruct(Axis)
if Copy and MakeGroups:
@ -3076,6 +3177,21 @@ class Mesh:
self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
return []
## Create a new mesh from a rotated object
# @param theObject object to rotate (mesh, submesh, or group)
# @param Axis axis of rotation(AxisStruct or geom line)
# @param AngleInRadians angle of rotation(in radians)
# @param MakeGroups to generate new groups from existing ones
# @param NewMeshName is a name of new mesh to create
def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
Axis = self.smeshpyD.GetAxisStruct(Axis)
mesh = self.editor.RotateObjectMakeMesh(theObject, Axis, AngleInRadians,
MakeGroups, NewMeshName)
return Mesh( self.smeshpyD, self.geompyD, mesh )
## Find group of nodes close to each other within Tolerance.
# @param Tolerance tolerance value
# @param list of group of nodes