See discussion: pyvista/pyvista#2133 (comment)
If you simply can't wait for the next release to play with the latest hot features, then you can easily
install the main
development branch from GitHub:
pip install git+https://github.com/pyvista/pvgmsh@main
import pyvista as pv
import pvgmsh as pm
We can define the surface using PyVista.
edge_source = pv.Polygon(n_sides=4, radius=8, fill=False)
We can then generate a 2D mesh.
mesh = pm.frontal_delaunay_2d(edge_source, target_sizes=2.0)
To visualize the model we can use PyVista.
๐
plotter = pv.Plotter()
_ = plotter.add_mesh(
mesh,
show_edges=True,
line_width=4,
color="white",
lighting=False,
edge_color=[153, 153, 153],
)
_ = plotter.add_mesh(edge_source, show_edges=True, line_width=4, color=[214, 39, 40])
_ = plotter.add_points(
edge_source.points, style="points", point_size=20, color=[214, 39, 40]
)
_ = plotter.add_legend(
[[" edge source", [214, 39, 40]], [" mesh ", [153, 153, 153]]],
bcolor="white",
face="r",
size=(0.3, 0.3),
)
plotter.show(cpos="xy")
We can also generate a 3D mesh.
edge_source = pv.Cube()
mesh = pm.delaunay_3d(edge_source, target_sizes=0.4)
๐
plotter = pv.Plotter()
_ = plotter.add_mesh(
mesh,
show_edges=True,
line_width=4,
color="white",
lighting=False,
edge_color=[153, 153, 153],
)
_ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=4, color=[214, 39, 40])
_ = plotter.add_points(
edge_source.points, style="points", point_size=20, color=[214, 39, 40]
)
plotter.enable_parallel_projection()
_ = plotter.add_axes(
box=True,
box_args={
"opacity": 0.5,
"color_box": True,
"x_face_color": "white",
"y_face_color": "white",
"z_face_color": "white",
},
)
plotter.show()
Made with contrib.rocks.
pvgmsh is distributed under the terms of the GNU General Public License v3.0 or later license.