Discussion:
[vtkusers] vtkProgressBar attached to an actor
Andrea Gavana
2018-12-03 16:09:38 UTC
Permalink
Hello everyone,

I’ve been googling around without much success until now, so I am
turning to this kind mailing list for suggestions.

I have a 3D scene with multiple unstructured grids and some STL actors at
defined positions (in 3D). I would like to be able to “attach” a progress
bar to each of these STL actors - as my scene in rendered in a time
dependent way, with the user able to go back and forth in time, it would
make a nice touch for what I’m showing.

Now, it seems to me vtkProgressBarWidget is a 2D animal, so I’m unclear how
I can place it below the STL actor and anche it there even if the user
zooms/pans the 3D window.

Maybe what I’m trying to accomplish is simply not possible, but I’m open to
all suggestions you may have.

Thank you in advance.

Andrea.
David Gobbi
2018-12-03 16:34:33 UTC
Permalink
Hi Andrea,

A generic way of doing this is to write a callback for vtkRenderer's
StartEvent. Then every time the renderer is preparing to render the scene,
it will call your callback, and your callback can set the position of the
2D actors. The vtkCoordinate class provides a convenient way of converting
from 3D to 2D coordinates.

Other than callbacks, I don't think there's any way to do it. The VTK
label actors can be used to automatically position text at 3D locations,
but there don't seem to be any classes for placing an arbitrary 2D actor at
a 3D location.

David
Post by Andrea Gavana
Hello everyone,
I’ve been googling around without much success until now, so I am
turning to this kind mailing list for suggestions.
I have a 3D scene with multiple unstructured grids and some STL actors at
defined positions (in 3D). I would like to be able to “attach” a progress
bar to each of these STL actors - as my scene in rendered in a time
dependent way, with the user able to go back and forth in time, it would
make a nice touch for what I’m showing.
Now, it seems to me vtkProgressBarWidget is a 2D animal, so I’m unclear
how I can place it below the STL actor and anche it there even if the user
zooms/pans the 3D window.
Maybe what I’m trying to accomplish is simply not possible, but I’m open
to all suggestions you may have.
Thank you in advance.
Andrea.
Andrea Gavana
2018-12-04 04:57:59 UTC
Permalink
Hi David,
Post by David Gobbi
Hi Andrea,
A generic way of doing this is to write a callback for vtkRenderer's
StartEvent. Then every time the renderer is preparing to render the scene,
it will call your callback, and your callback can set the position of the
2D actors. The vtkCoordinate class provides a convenient way of converting
from 3D to 2D coordinates.
Other than callbacks, I don't think there's any way to do it. The VTK
label actors can be used to automatically position text at 3D locations,
but there don't seem to be any classes for placing an arbitrary 2D actor at
a 3D location.
Thank you for your answer. I’ll give it a go and see if I can make it work.

Andrea.
Post by David Gobbi
David
Post by Andrea Gavana
Hello everyone,
I’ve been googling around without much success until now, so I am
turning to this kind mailing list for suggestions.
I have a 3D scene with multiple unstructured grids and some STL actors at
defined positions (in 3D). I would like to be able to “attach” a progress
bar to each of these STL actors - as my scene in rendered in a time
dependent way, with the user able to go back and forth in time, it would
make a nice touch for what I’m showing.
Now, it seems to me vtkProgressBarWidget is a 2D animal, so I’m unclear
how I can place it below the STL actor and anche it there even if the user
zooms/pans the 3D window.
Maybe what I’m trying to accomplish is simply not possible, but I’m open
to all suggestions you may have.
Thank you in advance.
Andrea.
Loading...