No way to set vector for vertical direction in show(..., viewup=...)
Hi,
Thanks for all your work. I'm trying to capture both side of a model using the plotter, but the viewup attribute only accept ['x','y','z']. I'm writing here because the docs says: either [‘x’, ‘y’, ‘z’] or a vector to set vertical direction.
Thank you again, Mousjad
You're right ! I will fix the docs. To do that you can take control of the camera with e.g.
from vtkplotter import *
msh = load(datadir+"apple.ply").lw(0.1)
show(msh, axes=1, camera=dict(viewup=[1,1,0]))
Check documentation for the show() command:
https://vtkplotter.embl.es/content/vtkplotter/plotter.html#vtkplotter.plotter.show
I am also having this issue.
Currently, the documentation still states that we can pass a direction vector as show(msh,viewup=direction), but passing it a direction vector does nothing. I am currently also struggling to automatically generate pictures directly from each side along each axis. Passing camera=dict(viewup=(0,1,0)) etc. to vedo.show() yields a blank image (probably one also needs to set all the other parameters). Is there not an easy way to do this? I've literally spent hours on trying to get it to work. It seems like there is something obvious that I'm missing.
I've tried:
pl = vedo.Plotter(offscreen=True,interactive=False)
for axis in ['x','y','z']:
pl.show(actors, viewup=axis)
pl.screenshot(f"{filename}-{axis}.png")
(Generates images from uncontrollable angles, doesn't show both sides)
vedoaxes = {'x':(1.,0,0), 'y':(0,1.,0), 'z':(0,0,1.)}
pl = vedo.Plotter(offscreen=True,interactive=False)
for axis in ['x','y','z']:
for sign in [-1,1]
pl.show(actors, viewup=sign*vedoaxes[axis])
pl.screenshot(f"{filename}-{sign}{axis}.png")
(Generates the same picture 6 times: viewup has no effect)
vedoaxes = {'x':(1.,0,0), 'y':(0,1.,0), 'z':(0,0,1.)}
pl = vedo.Plotter(offscreen=True,interactive=False)
for axis in ['x','y','z']:
for sign in [-1,1]
pl.show(actors, camera=dict(viewup=sign*vedoaxes[axis]))
pl.screenshot(f"{filename}-{sign}{axis}.png")
(As suggested above: generates 6 blank images)
Perhaps an example for how to do this in the simplest way could be added to the docs? I think "viewing an object from both sides directly along each axis' is a pretty common usecase for scientific visualization, to check that everything is properly aligned, and for generating figures for papers.
Sorry, I have overlooked this issue. Did you solve it in the meanwhile?
I guess a safer way to do this sort of things is to use the show(camera=...) command.
You can get a template input by pressing shift-c in a scene.