mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-15 21:01:26 +05:00
PR: synchro smeshpyDC 7.1.0
This commit is contained in:
parent
734f635b5f
commit
78404cc226
@ -281,8 +281,8 @@ def FirstVertexOnCurve(edge):
|
|||||||
if not vv:
|
if not vv:
|
||||||
raise TypeError, "Given object has no vertices"
|
raise TypeError, "Given object has no vertices"
|
||||||
if len( vv ) == 1: return vv[0]
|
if len( vv ) == 1: return vv[0]
|
||||||
info = geomBuilder.KindOfShape(edge)
|
v0 = geomBuilder.MakeVertexOnCurve(edge,0.)
|
||||||
xyz = info[1:4] # coords of the first vertex
|
xyz = geomBuilder.PointCoordinates( v0 ) # coords of the first vertex
|
||||||
xyz1 = geomBuilder.PointCoordinates( vv[0] )
|
xyz1 = geomBuilder.PointCoordinates( vv[0] )
|
||||||
xyz2 = geomBuilder.PointCoordinates( vv[1] )
|
xyz2 = geomBuilder.PointCoordinates( vv[1] )
|
||||||
dist1, dist2 = 0,0
|
dist1, dist2 = 0,0
|
||||||
@ -740,6 +740,20 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
|||||||
return None
|
return None
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
|
elif CritType == FT_EntityType:
|
||||||
|
# Checks the Threshold
|
||||||
|
try:
|
||||||
|
aCriterion.Threshold = self.EnumToLong(aThreshold)
|
||||||
|
assert( aThreshold in SMESH.EntityType._items )
|
||||||
|
except:
|
||||||
|
if isinstance(aThreshold, int):
|
||||||
|
aCriterion.Threshold = aThreshold
|
||||||
|
else:
|
||||||
|
print "Error: The Threshold should be an integer or SMESH.EntityType."
|
||||||
|
return None
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
elif CritType == FT_GroupColor:
|
elif CritType == FT_GroupColor:
|
||||||
# Checks the Threshold
|
# Checks the Threshold
|
||||||
try:
|
try:
|
||||||
@ -2253,7 +2267,7 @@ class Mesh:
|
|||||||
def GetElemNbNodes(self, id):
|
def GetElemNbNodes(self, id):
|
||||||
return self.mesh.GetElemNbNodes(id)
|
return self.mesh.GetElemNbNodes(id)
|
||||||
|
|
||||||
## Returns the node ID the given index for the given element
|
## Returns the node ID the given (zero based) index for the given element
|
||||||
# \n If there is no element for the given ID - returns -1
|
# \n If there is no element for the given ID - returns -1
|
||||||
# \n If there is no node for the given index - returns -2
|
# \n If there is no node for the given index - returns -2
|
||||||
# @return an integer value
|
# @return an integer value
|
||||||
@ -3094,14 +3108,18 @@ class Mesh:
|
|||||||
return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
|
return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
|
||||||
MaxNbOfIterations, MaxAspectRatio, Method)
|
MaxNbOfIterations, MaxAspectRatio, Method)
|
||||||
|
|
||||||
## Converts the mesh to quadratic, deletes old elements, replacing
|
## Converts the mesh to quadratic or bi-quadratic, deletes old elements, replacing
|
||||||
# them with quadratic with the same id.
|
# them with quadratic with the same id.
|
||||||
# @param theForce3d new node creation method:
|
# @param theForce3d new node creation method:
|
||||||
# 0 - the medium node lies at the geometrical entity from which the mesh element is built
|
# 0 - the medium node lies at the geometrical entity from which the mesh element is built
|
||||||
# 1 - the medium node lies at the middle of the line segments connecting start and end node of a mesh element
|
# 1 - the medium node lies at the middle of the line segments connecting start and end node of a mesh element
|
||||||
# @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
|
# @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
|
||||||
|
# @param theToBiQuad If True, converts the mesh to bi-quadratic
|
||||||
# @ingroup l2_modif_tofromqu
|
# @ingroup l2_modif_tofromqu
|
||||||
def ConvertToQuadratic(self, theForce3d, theSubMesh=None):
|
def ConvertToQuadratic(self, theForce3d, theSubMesh=None, theToBiQuad=False):
|
||||||
|
if theToBiQuad:
|
||||||
|
self.editor.ConvertToBiQuadratic(theForce3d,theSubMesh)
|
||||||
|
else:
|
||||||
if theSubMesh:
|
if theSubMesh:
|
||||||
self.editor.ConvertToQuadraticObject(theForce3d,theSubMesh)
|
self.editor.ConvertToQuadraticObject(theForce3d,theSubMesh)
|
||||||
else:
|
else:
|
||||||
@ -3740,7 +3758,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
|
||||||
@ -3750,6 +3768,8 @@ class Mesh:
|
|||||||
IDsOfElements = self.GetElementsId()
|
IDsOfElements = self.GetElementsId()
|
||||||
if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)):
|
if ( isinstance( Vector, geomBuilder.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)
|
||||||
@ -3758,7 +3778,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
|
||||||
@ -3768,13 +3788,15 @@ class Mesh:
|
|||||||
IDsOfElements = self.GetElementsId()
|
IDsOfElements = self.GetElementsId()
|
||||||
if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)):
|
if ( isinstance( Vector, geomBuilder.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
|
||||||
@ -3784,6 +3806,8 @@ class Mesh:
|
|||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)):
|
if ( isinstance( Vector, geomBuilder.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)
|
||||||
@ -3792,16 +3816,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, geomBuilder.GEOM._objref_GEOM_Object)):
|
if isinstance( Vector, geomBuilder.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…
x
Reference in New Issue
Block a user