mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-30 01:20:33 +05:00
Add Tolerance arg to GetCriterion(), GetFilter() and MakeGroup()
0020945: EDF 1465 SMESH: create a new mesh from a selected group or from selected elements + def CopyMesh( self, meshPart, meshName, toCopyGroups=False, toKeepIDs=False)
This commit is contained in:
parent
7c4f753517
commit
6a8deb485f
@ -659,27 +659,6 @@ class smeshDC(SMESH._objref_SMESH_Gen):
|
|||||||
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
|
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
|
||||||
return aMesh
|
return aMesh
|
||||||
|
|
||||||
## From SMESH_Gen interface
|
|
||||||
# @return the list of integer values
|
|
||||||
# @ingroup l1_auxiliary
|
|
||||||
def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
|
|
||||||
return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)
|
|
||||||
|
|
||||||
## From SMESH_Gen interface. Creates a pattern
|
|
||||||
# @return an instance of SMESH_Pattern
|
|
||||||
#
|
|
||||||
# <a href="../tui_modifying_meshes_page.html#tui_pattern_mapping">Example of Patterns usage</a>
|
|
||||||
# @ingroup l2_modif_patterns
|
|
||||||
def GetPattern(self):
|
|
||||||
return SMESH._objref_SMESH_Gen.GetPattern(self)
|
|
||||||
|
|
||||||
## Sets number of segments per diagonal of boundary box of geometry by which
|
|
||||||
# default segment length of appropriate 1D hypotheses is defined.
|
|
||||||
# Default value is 10
|
|
||||||
# @ingroup l1_auxiliary
|
|
||||||
def SetBoundaryBoxSegmentation(self, nbSegments):
|
|
||||||
SMESH._objref_SMESH_Gen.SetBoundaryBoxSegmentation(self,nbSegments)
|
|
||||||
|
|
||||||
## Concatenate the given meshes into one mesh.
|
## Concatenate the given meshes into one mesh.
|
||||||
# @return an instance of Mesh class
|
# @return an instance of Mesh class
|
||||||
# @param meshes the meshes to combine into one mesh
|
# @param meshes the meshes to combine into one mesh
|
||||||
@ -703,6 +682,41 @@ class smeshDC(SMESH._objref_SMESH_Gen):
|
|||||||
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
|
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
|
||||||
return aMesh
|
return aMesh
|
||||||
|
|
||||||
|
## Create a mesh by copying a part of another mesh.
|
||||||
|
# @param meshPart a part of mesh to copy, either a Mesh, a sub-mesh or a group;
|
||||||
|
# to copy nodes or elements not contained in any mesh object,
|
||||||
|
# pass result of Mesh.GetIDSource( list_of_ids, type ) as meshPart
|
||||||
|
# @param meshName a name of the new mesh
|
||||||
|
# @param toCopyGroups to create in the new mesh groups the copied elements belongs to
|
||||||
|
# @param toKeepIDs to preserve IDs of the copied elements or not
|
||||||
|
# @return an instance of Mesh class
|
||||||
|
def CopyMesh( self, meshPart, meshName, toCopyGroups=False, toKeepIDs=False):
|
||||||
|
if (isinstance( meshPart, Mesh )):
|
||||||
|
meshPart = meshPart.GetMesh()
|
||||||
|
mesh = SMESH._objref_SMESH_Gen.CopyMesh( self,meshPart,meshName,toCopyGroups,toKeepIDs )
|
||||||
|
return Mesh(self, self.geompyD, mesh)
|
||||||
|
|
||||||
|
## From SMESH_Gen interface
|
||||||
|
# @return the list of integer values
|
||||||
|
# @ingroup l1_auxiliary
|
||||||
|
def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
|
||||||
|
return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)
|
||||||
|
|
||||||
|
## From SMESH_Gen interface. Creates a pattern
|
||||||
|
# @return an instance of SMESH_Pattern
|
||||||
|
#
|
||||||
|
# <a href="../tui_modifying_meshes_page.html#tui_pattern_mapping">Example of Patterns usage</a>
|
||||||
|
# @ingroup l2_modif_patterns
|
||||||
|
def GetPattern(self):
|
||||||
|
return SMESH._objref_SMESH_Gen.GetPattern(self)
|
||||||
|
|
||||||
|
## Sets number of segments per diagonal of boundary box of geometry by which
|
||||||
|
# default segment length of appropriate 1D hypotheses is defined.
|
||||||
|
# Default value is 10
|
||||||
|
# @ingroup l1_auxiliary
|
||||||
|
def SetBoundaryBoxSegmentation(self, nbSegments):
|
||||||
|
SMESH._objref_SMESH_Gen.SetBoundaryBoxSegmentation(self,nbSegments)
|
||||||
|
|
||||||
# Filtering. Auxiliary functions:
|
# Filtering. Auxiliary functions:
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|
||||||
@ -731,6 +745,8 @@ class smeshDC(SMESH._objref_SMESH_Gen):
|
|||||||
# @param UnaryOp FT_LogicalNOT or FT_Undefined
|
# @param UnaryOp FT_LogicalNOT or FT_Undefined
|
||||||
# @param BinaryOp a binary logical operation FT_LogicalAND, FT_LogicalOR or
|
# @param BinaryOp a binary logical operation FT_LogicalAND, FT_LogicalOR or
|
||||||
# FT_Undefined (must be for the last criterion of all criteria)
|
# FT_Undefined (must be for the last criterion of all criteria)
|
||||||
|
# @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
|
||||||
|
# FT_LyingOnGeom, FT_CoplanarFaces criteria
|
||||||
# @return SMESH.Filter.Criterion
|
# @return SMESH.Filter.Criterion
|
||||||
# @ingroup l1_controls
|
# @ingroup l1_controls
|
||||||
def GetCriterion(self,elementType,
|
def GetCriterion(self,elementType,
|
||||||
@ -738,10 +754,12 @@ class smeshDC(SMESH._objref_SMESH_Gen):
|
|||||||
Compare = FT_EqualTo,
|
Compare = FT_EqualTo,
|
||||||
Treshold="",
|
Treshold="",
|
||||||
UnaryOp=FT_Undefined,
|
UnaryOp=FT_Undefined,
|
||||||
BinaryOp=FT_Undefined):
|
BinaryOp=FT_Undefined,
|
||||||
|
Tolerance=1e-07):
|
||||||
aCriterion = self.GetEmptyCriterion()
|
aCriterion = self.GetEmptyCriterion()
|
||||||
aCriterion.TypeOfElement = elementType
|
aCriterion.TypeOfElement = elementType
|
||||||
aCriterion.Type = self.EnumToLong(CritType)
|
aCriterion.Type = self.EnumToLong(CritType)
|
||||||
|
aCriterion.Tolerance = Tolerance
|
||||||
|
|
||||||
aTreshold = Treshold
|
aTreshold = Treshold
|
||||||
|
|
||||||
@ -831,14 +849,17 @@ class smeshDC(SMESH._objref_SMESH_Gen):
|
|||||||
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
|
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
|
||||||
# @param Treshold the threshold value (range of id ids as string, shape, numeric)
|
# @param Treshold the threshold value (range of id ids as string, shape, numeric)
|
||||||
# @param UnaryOp FT_LogicalNOT or FT_Undefined
|
# @param UnaryOp FT_LogicalNOT or FT_Undefined
|
||||||
|
# @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
|
||||||
|
# FT_LyingOnGeom, FT_CoplanarFaces criteria
|
||||||
# @return SMESH_Filter
|
# @return SMESH_Filter
|
||||||
# @ingroup l1_controls
|
# @ingroup l1_controls
|
||||||
def GetFilter(self,elementType,
|
def GetFilter(self,elementType,
|
||||||
CritType=FT_Undefined,
|
CritType=FT_Undefined,
|
||||||
Compare=FT_EqualTo,
|
Compare=FT_EqualTo,
|
||||||
Treshold="",
|
Treshold="",
|
||||||
UnaryOp=FT_Undefined):
|
UnaryOp=FT_Undefined,
|
||||||
aCriterion = self.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined)
|
Tolerance=1e-07):
|
||||||
|
aCriterion = self.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined,Tolerance)
|
||||||
aFilterMgr = self.CreateFilterManager()
|
aFilterMgr = self.CreateFilterManager()
|
||||||
aFilter = aFilterMgr.CreateFilter()
|
aFilter = aFilterMgr.CreateFilter()
|
||||||
aCriteria = []
|
aCriteria = []
|
||||||
@ -1730,6 +1751,8 @@ class Mesh:
|
|||||||
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
|
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
|
||||||
# @param Treshold the threshold value (range of id ids as string, shape, numeric)
|
# @param Treshold the threshold value (range of id ids as string, shape, numeric)
|
||||||
# @param UnaryOp FT_LogicalNOT or FT_Undefined
|
# @param UnaryOp FT_LogicalNOT or FT_Undefined
|
||||||
|
# @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
|
||||||
|
# FT_LyingOnGeom, FT_CoplanarFaces criteria
|
||||||
# @return SMESH_Group
|
# @return SMESH_Group
|
||||||
# @ingroup l2_grps_create
|
# @ingroup l2_grps_create
|
||||||
def MakeGroup(self,
|
def MakeGroup(self,
|
||||||
@ -1738,8 +1761,9 @@ class Mesh:
|
|||||||
CritType=FT_Undefined,
|
CritType=FT_Undefined,
|
||||||
Compare=FT_EqualTo,
|
Compare=FT_EqualTo,
|
||||||
Treshold="",
|
Treshold="",
|
||||||
UnaryOp=FT_Undefined):
|
UnaryOp=FT_Undefined,
|
||||||
aCriterion = self.smeshpyD.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined)
|
Tolerance=1e-07):
|
||||||
|
aCriterion = self.smeshpyD.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined,Tolerance)
|
||||||
group = self.MakeGroupByCriterion(groupName, aCriterion)
|
group = self.MakeGroupByCriterion(groupName, aCriterion)
|
||||||
return group
|
return group
|
||||||
|
|
||||||
@ -1954,6 +1978,13 @@ class Mesh:
|
|||||||
def GetMeshEditor(self):
|
def GetMeshEditor(self):
|
||||||
return self.mesh.GetMeshEditor()
|
return self.mesh.GetMeshEditor()
|
||||||
|
|
||||||
|
## Wrap a list of IDs of elements or nodes into SMESH_IDSource which
|
||||||
|
# can be passed as argument to accepting mesh, group or sub-mesh
|
||||||
|
# @return an instance of SMESH_IDSource
|
||||||
|
# @ingroup l1_auxiliary
|
||||||
|
def GetIDSource(self, ids, elemType):
|
||||||
|
return self.GetMeshEditor().MakeIDSource(ids, elemType)
|
||||||
|
|
||||||
## Gets MED Mesh
|
## Gets MED Mesh
|
||||||
# @return an instance of SALOME_MED::MESH
|
# @return an instance of SALOME_MED::MESH
|
||||||
# @ingroup l1_auxiliary
|
# @ingroup l1_auxiliary
|
||||||
@ -3656,7 +3687,7 @@ class Mesh:
|
|||||||
if ( isinstance( theObject, Mesh )):
|
if ( isinstance( theObject, Mesh )):
|
||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( theObject, list )):
|
if ( isinstance( theObject, list )):
|
||||||
theObject = self.editor.MakeIDSource(theObject, SMESH.ALL)
|
theObject = self.GetIDSource(theObject, SMESH.ALL)
|
||||||
|
|
||||||
thePoint, Parameters = ParsePointStruct(thePoint)
|
thePoint, Parameters = ParsePointStruct(thePoint)
|
||||||
self.mesh.SetParameters(Parameters)
|
self.mesh.SetParameters(Parameters)
|
||||||
@ -3677,7 +3708,7 @@ class Mesh:
|
|||||||
if (isinstance(theObject, Mesh)):
|
if (isinstance(theObject, Mesh)):
|
||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( theObject, list )):
|
if ( isinstance( theObject, list )):
|
||||||
theObject = self.editor.MakeIDSource(theObject,SMESH.ALL)
|
theObject = self.GetIDSource(theObject,SMESH.ALL)
|
||||||
|
|
||||||
mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact,
|
mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact,
|
||||||
MakeGroups, NewMeshName)
|
MakeGroups, NewMeshName)
|
||||||
@ -3811,7 +3842,7 @@ class Mesh:
|
|||||||
if not isinstance( ExceptSubMeshOrGroups, list):
|
if not isinstance( ExceptSubMeshOrGroups, list):
|
||||||
ExceptSubMeshOrGroups = [ ExceptSubMeshOrGroups ]
|
ExceptSubMeshOrGroups = [ ExceptSubMeshOrGroups ]
|
||||||
if ExceptSubMeshOrGroups and isinstance( ExceptSubMeshOrGroups[0], int):
|
if ExceptSubMeshOrGroups and isinstance( ExceptSubMeshOrGroups[0], int):
|
||||||
ExceptSubMeshOrGroups = [ self.editor.MakeIDSource( ExceptSubMeshOrGroups, SMESH.NODE)]
|
ExceptSubMeshOrGroups = [ self.GetIDSource( ExceptSubMeshOrGroups, SMESH.NODE)]
|
||||||
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,ExceptSubMeshOrGroups)
|
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,ExceptSubMeshOrGroups)
|
||||||
|
|
||||||
## Merges nodes
|
## Merges nodes
|
||||||
|
Loading…
Reference in New Issue
Block a user