How to plot result on cut mesh using PyDPF

Hi
I would like to plot a one side of a volume geometry, for which I have nodal results, and would like to cut the geometry with specific plane.
I have tried the mesh_plan_clip operator but as soon as I use it, the output mesh is cannot really plot the results.
I have tried to create a possible solution with the PyVista and clipping tool, without any success.
Can you please let me know how I can plot it outside of mechanical and still use sections.
or is it a limitation of PyDPF at the moment?
Answers
-
@Ayush Kumar, any comments on this?
clipping volumes and plotting with PyDPF pr PyVista?
0 -
@kanchan_cadfem I have never tried with PyVista, but the example below looks promising. You need to convert the DPF data to PyVista format:
If you are facing issues with
mesh_plan_clip
please file an issue on GitHub. The operator is supposed to do exactly this.0 -
I just used it with PYDPF. The hack for now is that you need to plot the mesh with field before you use section cut.
import pyvista from ansys.dpf import core as dpf rFile = "/path_to_rst/file.rst" pyvista.set_plot_theme("document") pyvista.global_theme.cmap = 'jet' my_data_sources = dpf.DataSources(rFile) my_data_sources.result_files model = dpf.Model(my_data_sources) results = model.results displacements = results.displacement() fields = displacements.outputs.fields_container() mesh = model.metadata.meshed_region mesh.plot(fields,off_screen=True) normal = (1, 1, 1) plane = pyvista.Plane(i_size=30, j_size=30, direction=normal) pv_mesh = mesh.grid clipped = pv_mesh.clip(normal=normal) p = pyvista.Plotter() p.add_mesh(clipped, show_edges=True) p.show()
1