2013-02-12 20:37:44 +06:00
|
|
|
# Free Nodes
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
|
2013-02-12 20:37:44 +06:00
|
|
|
import salome
|
2013-04-04 13:08:19 +06:00
|
|
|
salome.salome_init()
|
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
|
|
|
geompy = geomBuilder.New(salome.myStudy)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
import SMESH, SALOMEDS
|
|
|
|
from salome.smesh import smeshBuilder
|
|
|
|
smesh = smeshBuilder.New(salome.myStudy)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create box
|
|
|
|
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
|
|
|
|
idbox = geompy.addToStudy(box, "box")
|
|
|
|
|
|
|
|
# create a mesh
|
|
|
|
mesh = smesh.Mesh(box, "Mesh_free_nodes")
|
|
|
|
algo = mesh.Segment()
|
|
|
|
algo.NumberOfSegments(10)
|
2013-04-04 13:08:19 +06:00
|
|
|
algo = mesh.Triangle(smeshBuilder.MEFISTO)
|
2013-02-12 20:37:44 +06:00
|
|
|
algo.MaxElementArea(150.)
|
|
|
|
mesh.Compute()
|
|
|
|
|
|
|
|
# Remove some elements to obtain free nodes
|
|
|
|
# Criterion : AREA < 80.
|
|
|
|
area_margin = 80.
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, area_margin)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
|
|
|
mesh.RemoveElements(anIds)
|
|
|
|
|
|
|
|
# criterion : free nodes
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
|
2013-02-12 20:37:44 +06:00
|
|
|
anNodeIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
|
|
|
# create a group
|
2013-04-04 13:08:19 +06:00
|
|
|
aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes")
|
2013-02-12 20:37:44 +06:00
|
|
|
aGroup.Add(anNodeIds)
|
|
|
|
|
|
|
|
# print the result
|
|
|
|
print "Criterion: Free nodes Nb = ", len(anNodeIds)
|
|
|
|
j = 1
|
|
|
|
for i in range(len(anNodeIds)):
|
|
|
|
if j > 20: j = 1; print ""
|
|
|
|
print anNodeIds[i],
|
|
|
|
j = j + 1
|
|
|
|
pass
|
|
|
|
print ""
|
|
|
|
|
|
|
|
salome.sg.updateObjBrowser(1)
|