ParaViewWeb Visualizer

python

(Barak) #1

Hello,
I Created project with visualizer to show vtk file.
I want show also some points on the screen, I want the round and focus of vtk will be effect also the points.
What the best way to do it?
Thanks,
O.Barak


(Sebastien Jourdain) #2

Is your Visualizer working?

What kind of points, round and focus are you talking about?


(Barak) #3

Yes, my visualizer working.
The points will be shown on the drawing, but the point data is x,y,z format and the drawing data is vtk file.
Thanks


(Sebastien Jourdain) #4

Create a vtkPolyData from those x,y,z and use the trivial producer to bring it into the ParaView pipeline.


(Barak) #5

How to to bring it into the ParaView pipeline?


(Sebastien Jourdain) #6
from vtkmodules.vtkCommonDataModel import vtkPolyData, vtkCellArray
from vtkmodules.vtkCommonCore import vtkPoints, vtkFloatArray

from paraview import simple

polyData = vtkPolyData()
polyData.SetPoints(vtkPoints())

polyData.SetLines(vtkCellArray())

points = polyData.GetPoints()
lines = polyData.GetLines()

points.InsertNextPoint(0, 1, 0) # id: 0
points.InsertNextPoint(0, 2, 0) # id: 1
points.InsertNextPoint(0, 3, 0) # id: 2
points.InsertNextPoint(0, 4, 0) # id: 3
points.InsertNextPoint(0, 5, 0) # id: 4

lines.InsertNextCell(points.GetNumberOfPoints())
lines.InsertCellPoint(0)
lines.InsertCellPoint(1)
lines.InsertCellPoint(2)
lines.InsertCellPoint(3)
lines.InsertCellPoint(4)


trivialProducer = simple.TrivialProducer()
trivialProducer.GetClientSideObject().SetOutput(polyData)

simple.Show(trivialProducer)
simple.Render()

(Igor) #7

Hello,

Thank you very much for this example. It’s very usefull.
Do you may to provide similar example, but with spheres. (With radius 1)
Thank you very much and best regards, Igor.