# @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
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
# @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
'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"
## 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.
# 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.
# @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.
## 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.
# @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
# @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)
# @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:
# @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:
# @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:
# @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:
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:
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)
# @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:
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)
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:
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)
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)
# @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:
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