Home > Uncategorized > Display point coordinates in Paraview (the return)

Display point coordinates in Paraview (the return)

The previous version was using the ProgrammableFilter of Paraview. This one is a macro that was tested with Paraview 4. Here are pros/cons compared to the previous version:

pros:

  • Automatic selection display mode configuration
  • Automatic selection of all points

cons: automatic selection of all points on large mesh is not what you want.

To install it go to Macros, Add new macro.

from paraview.simple import *

coord_prog_filter = ProgrammableFilter()
RenameSource("Coordinates", coord_prog_filter)
coord_prog_filter.Script = """
pdi = self.GetInput()
pdo = self.GetOutput()
coords = vtk.vtkDoubleArray()
coords.SetName("Coordinates")
coords.SetNumberOfComponents(3)
n = pdi.GetNumberOfPoints()
for i in xrange(n):
   p=pdi.GetPoint(i)
   coords.InsertNextTuple3(p[0], p[1], p[2])
pdo.GetPointData().AddArray(coords)
"""

sel = servermanager.sources.SelectionQuerySource()
sel.FieldType = "POINT"
sel.QueryString = "id >= 0"
coord_prog_filter.SMProxy.SetSelectionInput(coord_prog_filter.Port, sel.SMProxy, 0)

coord_repr = Show()
coord_repr.SelectionPointLabelColor = [0.0, 0.0, 0.0]
coord_repr.SelectionPointLabelFormat = '%g'
coord_repr.SelectionPointLabelVisibility = 1
coord_repr.SelectionPointFieldDataArrayName = 'Coordinates'
coord_repr.SelectionPointLabelVisibility = 1

Render()
Advertisements
Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: