[Paraview] Re: vtkPolyData
Alessandro Bellina
bellina at uiuc.edu
Wed Jan 30 10:25:52 EST 2008
Robert,
Since last time I posted this I was able to display something close to what
I want to do, but not quite exactly.
I have a 2-D vector field that changes in time. In each time step the vector
has six coordinates V = {(x1,y1,z1), (x2,y2,z2)}. What I was ble to do
yesterday was plot them as <Lines>. So I did 2 points per line and that
worked OK. What I am interested in doing with this field is to plot a stream
(stream tracer.) So at some timestep in the future I want to be able to see
some of the old features of the previous timeteps. I think the stream tracer
filter does this but I can't use it with lines. Any other filters that do
this?
The file then has <Points> <Lines>. And <Lines> have a connectivity and
offset table.
I've seen some great renderings of stream-like behavior in ParaView.
Ultimately I'd like to be able to color the stream to imply angle of
inclination of the vectors with respect to a normal, I think this is
secondary.
Thanks for your help,
Alessandro
On Jan 30, 2008 9:14 AM, Robert Maynard <RobertJMaynard at gmail.com> wrote:
> 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/01972810/attachment.html
More information about the ParaView
mailing list