pyvista / pyvista

3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)
https://docs.pyvista.org
MIT License
2.63k stars 482 forks source link

unstructured grid data boundary smoothing #2369

Open gokceay opened 2 years ago

gokceay commented 2 years ago

Discussed in https://github.com/pyvista/pyvista/discussions/2367

Originally posted by **gokceay** March 20, 2022 Hi, I would like to smooth my mesh boundaries, I get the error bellow: AttributeError: 'UnstructuredGrid' object has no attribute 'smooth' I used another object's boundaries to cut another mesh and then I split my mesh to many different bodies to select one of them. multibody = body_mesh_2.connectivity(largest=False) bodies = multibody.split_bodies() ..... (selecting the specific body which I called again body_mesh_2) body_mesh_2.smooth(boundary_smoothing= True, n_iter=1000) I wanted to cast it to polydata, I couldn't find the function or solution. Any help would be greatly appreciated. Thanks in advance
gokceay commented 2 years ago

ok, I solved like this by adding:

    surf = body_mesh_2.extract_geometry()
    body_mesh_2 = surf.smooth(boundary_smoothing=True, feature_smoothing=False, n_iter=100,  relaxation_factor=0.1, edge_angle=120)

I still have a question about smoothing, I just want to smooth the boundaries, I closed feature_smoothing but I am not sure about whether I am smoothing the surface as well along the boundaries.