[Paraview] Re: vtkPolyData

Robert Maynard RobertJMaynard at gmail.com
Wed Jan 30 10:14:33 EST 2008


Could you give some more information on what the file looks like, and what
you want to see inside of paraview.

The example you included is designed to show single points as individual
cells. If you are trying to show random triangles in space, you will have to
modify the code to accept 3 points per cell and set the output type of the
cells from Verts to Polys.

On Jan 29, 2008 5:51 PM, Alessandro Bellina <bellina at uiuc.edu> wrote:

> *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
> >
> >
> > ----------------------------------
> >
>
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20080130/51a206ab/attachment.htm


More information about the ParaView mailing list