2013-02-12 20:37:44 +06:00
|
|
|
# Smoothing
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
|
2013-02-12 20:37:44 +06:00
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2013-04-04 13:08:19 +06:00
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
2017-06-13 15:01:10 +05:00
|
|
|
geompy = geomBuilder.New()
|
2013-04-04 13:08:19 +06:00
|
|
|
|
|
|
|
import SMESH, SALOMEDS
|
|
|
|
from salome.smesh import smeshBuilder
|
2017-06-13 15:01:10 +05:00
|
|
|
smesh = smeshBuilder.New()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
import SMESH_mechanic
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
#smesh = SMESH_mechanic.smesh
|
2013-02-12 20:37:44 +06:00
|
|
|
mesh = SMESH_mechanic.mesh
|
|
|
|
|
|
|
|
# select the top face
|
|
|
|
faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
|
|
|
|
face = faces[3]
|
|
|
|
geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
|
|
|
|
|
|
|
|
# create a group of faces to be smoothed
|
2013-04-04 13:08:19 +06:00
|
|
|
GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", SMESH.FACE)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# perform smoothing
|
|
|
|
|
|
|
|
# boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)
|
|
|
|
res = mesh.SmoothObject(GroupSmooth, [], 20, 2., smesh.CENTROIDAL_SMOOTH)
|
2017-03-20 17:27:30 +05:00
|
|
|
print("\nSmoothing ... ", end=' ')
|
|
|
|
if not res: print("failed!")
|
|
|
|
else: print("done.")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2017-06-13 15:01:10 +05:00
|
|
|
salome.sg.updateObjBrowser()
|