[vtkusers] vtkPolyData with text embedded.

David Doria daviddoria at gmail.com
Tue Feb 26 13:18:17 EST 2013


On Tue, Feb 26, 2013 at 1:09 PM, matheus_viana <vianamp at gmail.com> wrote:

> Hi guys. Does anyone know if it is possible to save a polydata file with
> text
> embedded? Basically, I have a graph in 3D and I'd like to save also the
> label of each node. I know that there exist the vtkTextActor that is very
> useful to display texts in the scene, but I'm not sure if it might be
> useful
> for my purpose.
>
> Many thanks,
> Matheus
>

A PolyData (.vtp) file simply stores a list of coordinates/points and their
connectivity, along with any other information you want to store with each
point/cell. So you cannot store the text as it would be seen with a
vtkTextActor, but you can store the label in the PointData associated with
the points in the PolyData. Something like this:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/VTKConcepts/Scalars where you
would use some kind of a string array instead of the numeric arrays in that
example. You would then be responsible for displaying those values yourself
when you open the vtp file at a later time.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130226/628b96bb/attachment.htm>


More information about the vtkusers mailing list