2022-04-11 18:28:01 +05:00
|
|
|
# Smoothing
|
|
|
|
|
|
|
|
from mechanic import *
|
|
|
|
|
|
|
|
# select the top face
|
|
|
|
faces = geom_builder.SubShapeAllSorted(mechanic, geom_builder.ShapeType["FACE"])
|
|
|
|
|
|
|
|
# create a group of faces to be smoothed
|
|
|
|
group_smooth = mesh.GroupOnGeom(faces[3], "Group of faces (smooth)", SMESH.FACE)
|
|
|
|
|
|
|
|
# perform smoothing
|
|
|
|
|
|
|
|
# boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)
|
2023-11-16 22:33:59 +05:00
|
|
|
res0 = mesh.SmoothObject(group_smooth, [], 20, 2., smesh_builder.CENTROIDAL_SMOOTH)
|
|
|
|
res1 = mesh.SmoothObject(group_smooth, [], 20, 2., smesh_builder.LAPLACIAN_SMOOTH)
|
2022-04-11 18:28:01 +05:00
|
|
|
print("\nSmoothing ... ", end=' ')
|
2023-11-16 22:33:59 +05:00
|
|
|
if not (res0 and res1): print("failed!")
|
2022-04-11 18:28:01 +05:00
|
|
|
else: print("done.")
|