-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use switches? #7
Comments
It's the code's fault. It's not a frequently used module for us, so code coverage isn't a huge issue, but I'll clean it up a bit. The good news is this is a great demo for I'll comment back when the modules are updated. import numpy as np
import pyvista as pv
from pyvista import examples
import tetgen
import pymeshfix
cow_mesh = examples.download_cow().tri_filter()
cpos = [(13., 7.6, -13.85),
(0.44, -0.4, -0.37),
(-0.28, 0.9, 0.3)]
# cow_mesh.plot(cpos=cpos)
tet = tetgen.TetGen(cow_mesh)
tet.make_manifold()
tet.tetrahedralize()
cow_grid = tet.grid
# plot half the cow
mask = np.logical_or(cow_grid.points[:, 0] < 0, cow_grid.points[:, 0] > 4)
half_cow = cow_grid.extract_selection_points(mask)
plotter = pv.Plotter()
plotter.add_mesh(half_cow, color='w', show_edges=True)
plotter.add_mesh(cow_grid, color='r', style='wireframe', opacity=0.2)
plotter.camera_position = cpos
plotter.show()
# construct silly spinning cow
plotter = pv.Plotter(off_screen=True, window_size=[400, 400])
plotter.open_gif('/tmp/tmp.gif')
plotter.add_mesh(half_cow, color='w', show_edges=True)
plotter.add_mesh(cow_grid, color='r', style='wireframe', opacity=0.2)
plotter.camera_position = cpos
plotter.write_frame()
nframe = 36
deg = 360./(nframe + 1)
for i in range(nframe):
half_cow.rotate_y(deg)
cow_grid.rotate_y(deg)
plotter.update()
plotter.write_frame()
plotter.close() |
Woah awesome! Thanks, @akaszynski!
Oh yeah! This is an excellent demo for PyVista - which is why I started playing around with this toolset |
Use the latest modules and you'll be good to go. |
I can't complete the following example which is a hacked attempt to reproduce the example at the bottom of this page: http://wias-berlin.de/software/tetgen/features.html
Last line above throws error:
The text was updated successfully, but these errors were encountered: