2013-02-12 20:37:44 +06:00
|
|
|
# Merging Nodes
|
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
from mechanic import *
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2019-01-18 23:31:22 +05:00
|
|
|
# criterion of coincidence
|
2015-07-10 21:39:03 +05:00
|
|
|
Tolerance = 4.0
|
|
|
|
|
2019-01-18 23:31:22 +05:00
|
|
|
# find close nodes of triangle elements only
|
2022-04-11 18:28:01 +05:00
|
|
|
triangleFilter = smesh_builder.GetFilter( SMESH.FACE, SMESH.FT_ElemGeomType,'=', SMESH.Geom_TRIANGLE )
|
2019-01-18 23:31:22 +05:00
|
|
|
GroupsOfNodesOfTriangles = mesh.FindCoincidentNodesOnPart([triangleFilter],Tolerance)
|
|
|
|
|
2015-07-10 21:39:03 +05:00
|
|
|
# prevent nodes located on geom edges from removal during merge:
|
|
|
|
# create a group including all nodes on edges
|
|
|
|
allSegs = mesh.MakeGroup( "all segments", SMESH.EDGE, SMESH.FT_ElemGeomType,'=', SMESH.Geom_EDGE )
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2019-01-18 23:31:22 +05:00
|
|
|
mesh.MergeNodes(GroupsOfNodesOfTriangles, NodesToKeep=allSegs)
|
|
|
|
|
|
|
|
# find close nodes in the whole mesh
|
|
|
|
GroupsOfNodes = mesh.FindCoincidentNodes(Tolerance)
|
|
|
|
|
2015-07-10 21:39:03 +05:00
|
|
|
mesh.MergeNodes(GroupsOfNodes, NodesToKeep=allSegs)
|