[vtkusers] Polydata cell connectivity list

Wesley Brooks wesbrooks at gmail.com
Tue Feb 8 06:37:09 EST 2005


I'm using BuildLinks(0) because BuildLinks() doesn't seem to work
giving the error BuildLinks expects two arguments got one. I found the
(0) from here:

http://public.kitware.com/pipermail/vtkusers/2003-April/066746.html

I've just tried putting the updata before, after the BuildLinks and it
still does not see any connections. I tried putting self.polydata
inside the brackets and got an error message 'TypeError: an integer is
required'.

I've also tried putting BuildCells() before and after with and without
update calls between them to no effect. The program doesn't even raise
an error messege when the build links and updates are commented out.

This is the bit that creates the polydata item from a list of
co-ordinates and a list of ids describing lines. Is this where my
problem lies? self.links is a list where each entry within the list is
two ids describing a line and self.gpnts is a list of the co-ordinates
relating to the ids.

################################

    def VTKObjector(self):
	self.lattice = vtk.vtkPolyData()

	points = vtk.vtkPoints()
	lines = vtk.vtkCellArray()

	for line in self.links:
            
	    p0id = line[0]
	    p1id = line[1]

	    p0 = self.gpnts[p0id]
	    p1 = self.gpnts[p1id]

	    lines.InsertNextCell(2)
	    vtkp0 = points.InsertNextPoint(p0[0], p0[1], p0[2])
	    lines.InsertCellPoint(vtkp0)
	    vtkp1 = points.InsertNextPoint(p1[0], p1[1], p1[2])
	    lines.InsertCellPoint(vtkp1)

	self.lattice.SetLines(lines)
	self.lattice.SetPoints(points)

################################

When this problem is sorted I will reply as I feel it may be hit apon again.

Cheers,

Wesley.



More information about the vtkusers mailing list