smesh/doc/examples/modifying_meshes_ex11.py

31 lines
884 B
Python
Raw Normal View History

2022-04-11 18:28:01 +05:00
# Removing Nodes
import salome
salome.salome_init_without_session()
from salome.geom import geomBuilder
from salome.smesh import smeshBuilder
geom_builder = geomBuilder.New()
smesh_builder = smeshBuilder.New()
# create and mesh two boxes
box = geom_builder.MakeBoxDXDYDZ(10.0, 10.0, 10.0)
mesh = smesh_builder.Mesh(box, 'box')
mesh.Segment().NumberOfSegments(10)
mesh.Triangle().MaxElementArea(5)
if not mesh.Compute(): raise Exception("Error when computing Mesh")
2022-04-11 18:28:01 +05:00
print("After Compute(): %s nodes, %s faces" % ( mesh.NbNodes(), mesh.NbFaces()))
# remove nodes #246 and #255
res = mesh.RemoveNodes([246, 255])
print("After RemoveNodes(): %s nodes, %s faces" % ( mesh.NbNodes(), mesh.NbFaces()))
# removing node #100 with reconnection
mesh.RemoveNodeWithReconnection( 100 )
print("After RemoveNodeWithReconnection(): %s nodes, %s faces" % ( mesh.NbNodes(), mesh.NbFaces()))