[Paraview] Set of 3DText sources?

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Feb 10 09:39:34 EST 2015


There isn't a preexisting filter that does this, bug you can  write a
new filter that does exactly that -- givens a list of coorinates and
labels, internally uses mulitple instances of vtkVectorText (which is
what the 3D Text is ParaView uses) and then append the polydata
returned by each of the vtkVectorText instances into a single polydata
to put out as the output.


Here's a simple Python script that you can use as the "Script" for a
"Programmable Source" to see how such a filter could be written.

# -------------------------------------------------------------------------------------------
# script for RequestData Script of the Programmable Source
# -------------------------------------------------------------------------------------------
from vtk.vtkRenderingFreeType import vtkVectorText
from vtk.vtkFiltersCore import vtkAppendPolyData
from vtk.vtkFiltersGeneral import vtkTransformPolyDataFilter
from vtk.vtkCommonTransforms import vtkTransform

coords = [(0, 0, 0), (0, 10, 0)]
labels = ["One", "Two"]

def getText(pos, text):
  source = vtkVectorText()
  source.SetText(text)

  transform = vtkTransform()
  transform.Translate(pos)

  transformPD = vtkTransformPolyDataFilter()
  transformPD.SetTransform(transform)
  transformPD.SetInputConnection(source.GetOutputPort())

  transformPD.Update()
  return transformPD.GetOutput()

appender = vtkAppendPolyData()

for coord, label in zip(coords, labels):
  pd = getText(coord, label)
  appender.AddInputDataObject(pd)
appender.Update()
output.ShallowCopy(appender.GetOutput())
-------------------------------------------------------------------------------------------

On Mon, Feb 9, 2015 at 9:58 AM,  <Anton.Piccardo-Selg at tessella.com> wrote:
> Hi,
>
> I am currently working on a customization of ParaView. We plot
> crystallographic data and would like to annotate some of the data points
> directly in the view.
>
> I can see that the 3DText source can do this for a single data point.
> Ideally, we don't want to create one 3DText source per data point though.
> Hence my question: Is there a filter or technique for which we can supply a
> set of coordinates and annotation labels to be able to print text next to
> several data points at once in a convenient way?
>
> Many thanks and best regards,
>
> Anton
>
> This message is commercial in confidence and may be privileged. It is
> intended for the
> addressee(s) only. Access to this message by anyone else is unauthorized and
> strictly prohibited.
> If you have received this message in error, please inform the sender
> immediately. Please note that
> messages sent or received by the Tessella e-mail system may be monitored and
> stored in an
> information retrieval system.
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>


More information about the ParaView mailing list