[vtkusers] Polydata cell connectivity list

Wesley Brooks wesbrooks at gmail.com
Fri Feb 4 07:59:08 EST 2005

Dear Users,

I'm presently trying to find out what other cells a cell is linked to
by one of its vertexes. And it's driving me slightly mad!

        for supid in self.nobad:

            supcell = self.polydata.GetCell(supid)
            supid1 = supcell.GetPointId(0)
            supid2 = supcell.GetPointId(1)
            checklist = [supid1, supid2]

            for id in checklist:
                cells = vtk.vtkIdList()
                self.polydata.GetCellPoints(id, cells)

                numofid = cells.GetNumberOfIds()

                for cell in range(numofid):
                    idcell = cells.GetId(cell)

                    if idcell != supid:
                        if idcell in self.lowbad:
                            if id not in self.supportlist:
                                print "S5"

Here's the section that is giving me the problem. In my program when
run there are 1900 cells in the list self.nobad which it has to check.
If the cell is connected to another cell in the lowbad list the shared
vertexes id is stored in the list self.supportlist only if it is not
already contained within this list.

Run as above it runs until cell 656 out of 1900 and closes python with
an error window without giving any error messages in the Python Shell
just "pythonw.exe has encountered a problem and needs to close. We are
sorry for the incovenience."

I've tried adding combinations of  self.polydata.Update(),
self.polydata.BuildCells(), and self.polydata.BuildLinks() to no
success. The last, BuildLinks() would only run if there were a 0 value
inside the brackets, this tip was found from a previous post. I've
also discovered through various print statements (since removed as
after two days of bug hunting the language can get 'colourful'!) that
the loop is crashing on the self.polydata.GetCellPoints(id, cells)
statement on the 656th pass and does not seem to be finding any cells
with more or less than 2 cells sharing a vertex when I expect most
vertexes to be shared by up to ten cells.

Any alternative, perhaps quicker approaches or feed back on the above
code would also be greatly appreciated; I'm a beginner to programming
and having to deal with datasets which have included up to 310000

Many thanks for your time.

Yours Faithfully,

Wesley Brooks

More information about the vtkusers mailing list