[Paraview] Re: vtkPolyData

Alessandro Bellina bellina at uiuc.edu
Tue Jan 29 17:51:52 EST 2008


*bump* I am hoping this email doesn't get buried in the list... anybody got
ideas?

On Jan 25, 2008 8:39 PM, Alessandro Bellina <bellina at uiuc.edu> wrote:

> Hello again,
> I am trying now to display some data that is not structured in cells and
> points as a mesh would. This is a vector cloud in 3-D. Reading some of the
> other threads I have found this could be done with Programmable Sources, or
> vtp files. My only problem is that I am having trouble creating the actual
> vectors... so I can assign points but am having issues assigning those
> points, end points, to create vectors.
>
> Here is some code, posted in this list before, that I have been using. I
> think I need to add the end points as vtkPoints, is that right? Then
> populate them in the loop. If anybody could point to how to do this in .vtp
> xml file format that would help me even more. Like what structure should the
> file have?
>
> Thank you in advance,
>
> Alessandro
>
> ---------------------------------------------------------------
>
>
> #!/usr/bin/env python
>
> from paraview import vtk
> import csv
>
> output = self.GetOutput()
>
> points = vtk.vtkPoints()
> data = vtk.vtkPoints() #? Is this what I need to be using?
> cells = vtk.vtkCellArray()
> vectors = vtk.vtkCellArray()
>
> file = open("/home/bellina/workspace/Data/CSphere/test.vtp")
>
> header = csv.reader(file).next() #get the header line
> csvReader = csv.DictReader(file, header) #make a dict reader with the
> header
> counter = 0 #need to keep track of the amount of cells
> for line in csvReader:
>   points.InsertNextPoint(float(line['x']), float(line['y']),
> float(line['z']))   #add a point change the 'x' etc to what you have in your
> header
>   cells.InsertNextCell(1) #each point has its own cell
>   cells.InsertCellPoint(counter)
>   counter += 1
>
> output.SetPoints(points) #need to set points
> output.SetVerts(cells) #need to set cells as verts
>
>
> ----------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20080129/f13ba012/attachment.htm


More information about the ParaView mailing list