[vtkusers] polyhedron in python

George george.gerber at gmail.com
Sun Nov 2 16:33:09 EST 2014


Good day,

I have translated the example of Bill into the best Python I know. I get the
following error:
Traceback (most recent call last):
  File "C:\Users\george limited\Desktop\unstructuredgrid.py", line 19, in
<module>
    ug.InsertNextCell(vtk.VTK_POLYHEDRON,4,pointids,1,faces)
TypeError: InsertNextCell argument 5: expected a sequence of 0 values, got
vtkobject

Any advice will be very much appreciated.
Best regards,
George

The code is:
import vtk 

points = vtk.vtkPoints()
pointids = [0,1,2,3]

points.InsertNextPoint(0,0,0)
points.InsertNextPoint(1,0,0)
points.InsertNextPoint(1,1,0)
points.InsertNextPoint(0,1,0)

faces = vtk.vtkCellArray()

face0 = [0,1,2,3]

faces.InsertNextCell(4,face0)

ug = vtk.vtkUnstructuredGrid()
ug.SetPoints(points)
ug.InsertNextCell(vtk.VTK_POLYHEDRON,4,pointids,1,faces.GetPointer())

writer = vtk.vtkUnstructuredGridWriter()
writer.SetFileName("polyhedron.vtu")
writer.SetInputData(ug)
writer.Write() 



--
View this message in context: http://vtk.1045678.n5.nabble.com/polyhedron-in-python-tp5728643p5729319.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list