Salome HOME
[PY3] 2to3 results
[modules/smesh.git] / doc / salome / examples / modifying_meshes_ex21.py
1 # Smoothing
2
3
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh =  smeshBuilder.New(salome.myStudy)
13
14 import SMESH_mechanic
15
16 #smesh = SMESH_mechanic.smesh
17 mesh = SMESH_mechanic.mesh
18
19 # select the top face
20 faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
21 face = faces[3]
22 geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
23
24 # create a group of faces to be smoothed
25 GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", SMESH.FACE)
26
27 # perform smoothing
28
29 # boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)
30 res = mesh.SmoothObject(GroupSmooth, [], 20, 2., smesh.CENTROIDAL_SMOOTH)
31 print("\nSmoothing ... ", end=' ')
32 if not res: print("failed!")
33 else:       print("done.")
34
35 salome.sg.updateObjBrowser(True)