-
Notifications
You must be signed in to change notification settings - Fork 6
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
Problem with non interactive visualization? #2
Comments
Hmm, that should open a window but not start the event loop (i.e. the window won't respond to being clicked on). So, yes those lines should be enough (and do the job on my machine). Can I have some specs?
|
Hi!,
A student told me that it successfully runs on Windows 10 with the same version of Python and using a wheel for VTK downloaded from https://download.lfd.uci.edu/pythonlibs/z4tqcw5k/VTK-9.0.1-cp39-cp39-win_amd64.whl |
Ahh, perfect timing. I just happen to have access to a Big Sur right now (normally I have to test macOS on a mac mini from 2008) and I can reproduce using with macOS 11.0 and Python 3.7.9 and VTK from PyPI. I also see no window although a blank icon appears on the bar at the bottom (the dock?). I also notice that, after calling I tried a minimal hello world VTK example and I get the same behaviour so it looks like this issue is VTK's. (Commenting out the |
I have not the problem with block=True, I mean, I don't need to kill Python in that case. If I close the window, the program continues / ends normally. I will use a virtualized Windows 10 and I will check this from time to time to see if this problem is eventually fixed. |
I notice the PyQt5 figure behaves itself. Not only that but recent versions of PyQt5 have moved the event loop into a continuously running background thread so that it's interactive even without using the blocking pip install PyQt5 Then inject the line: vpl.QtFigure() before any kind of
You're welcome! |
Oh wow! That's much cooler than what I do with vtkplotlib. I just make teeth go funny colours. I keep meaning to document showing/hiding/removing but still haven't. Here's something I wrote when someone else asked me the same question: There’s several ways. You generally need to retain references to everything you wish to alter. So you may need to change your setup to something like the following if you’re not already doing this:
Once you have these references you can use any of: # To hide it
mesh.visible = False
# To make it fully transparent (effectively hiding it).
mesh.opacity = 0 Or if you’re unlikely to want to reshow that mesh again then you can remove it from the figure (and save some RAM). fig.remove_plot(mesh) # also accepts iterables of plots.
# Or by the shorthand:
fig -= mesh
# Optionally, release the `mesh` reference so Python can have its RAM
# back.
del mesh The figure does keep its contents in fig.plots. So if you’re feeling lazy you could just use:
which will remove everything. (You may need to call |
Zoom does not seem to work properly. Maybe I am doing something wrong, I don't know. Anyway, as I can do zoom with the mouse, it is not so important. Removing objects works, great!!. Being this an exercise for students in the first year of an industrial engineering degree, it's perfect 😄. Example: grua.movAgain, thanks a lot for you library! |
That video is really cool. I've just pushed a fix for pip install -U https://github.com/bwoodsend/vtkplotlib/archive/fix-zoom.zip If it works, I'll merge it into the master branch and run a patch release 1.4.1 to PyPI. |
Hi! Now, "padding" works :-) Nevertheless, I observe some things a little weird:
def paint(meshes, dock):
"""
Paint everything.
'meshes' include the crane and the load.
'dock' is added outside because it doesn't change.
"""
vpl_meshes = []
for mesh in meshes:
vpl_meshes.append(vpl.mesh_plot(mesh))
vpl.zoom_to_contents(plots_to_exclude=[dock])
figure = vpl.gcf()
figure.update()
figure.show(block=False)
for mesh in vpl_meshes:
figure.remove_plot(mesh) test.mov |
Ughh, that flickering is not pretty. Well there's two problems here. Firstly The second problem is that: vpl.zoom_to_contents(plots_to_exclude=[dock]) performs a render with |
Hello, when I try to remove figures, I get an error saying "Unhashable type mesh" is there any known fix to this? |
You're not giving me much to go on here but I'm guessing that you're passing the original mesh instead of the output of mesh = Mesh.from_file("some-file.stl")
vpl.mesh_plot(mesh)
...
fig.remove_plot(mesh) You should instead be doing: mesh = Mesh.from_file("some-file.stl")
mesh_plot = vpl.mesh_plot(mesh)
...
fig.remove_plot(mesh_plot) |
Hi!,
I am starting to use vtkplotlib for plotting STL files in a Programming subject in the first year of a Mechanical Engineering degree because it is super-simple and nice to use!!. But non interactive visualization seems to be not working (window never opens). Wouldn't these sentences be enough?
Regards,
Jose.
The text was updated successfully, but these errors were encountered: