[vtkusers] vtkUnstructuredGrid::InsertNextCell
Lise Angell
lise.angell at gmail.com
Wed Oct 19 08:07:35 EDT 2005
I would like to use
vtkUnstructuredGrid::InsertNextCell( int type,vtkIdType npts,vtkIdType *pts),
not vtkUnstructuredGrid::InsertNextCell( int type,vtkIdList * ptIds)
But then I get the error:
File "readxdr.py", line 456, in mount_vtk_structures
vtk_u_grid.InsertNextCell(vtk_cell_type, npt, pt_list)
TypeError: function takes exactly 2 arguments (3 given)
vtk_cell_type: int, npt: int, pt_list: list of ints
Any ideas how I can reach this method (assuming it's not deprecated)?
Lise
System:
Python2.3
VTK from cvs (Oct.11 2005)
Mac OSX Tiger (iBookG4)
snip:
#------------------------------------------------------------------------------------------------------
nsd = grid.nsd; nno = grid.nno; nel = grid.nel # grid: GridFE class
# allocate VTK structures
vtk_u_grid = vtk.vtkUnstructuredGrid()
pts = vtk.vtkPoints()
pts.SetNumberOfPoints(nno)
data = vtk.vtkDoubleArray()
data.SetNumberOfValues(nno)
for i in range (0,nno):
x = grid.coords[i]
s = [... get value from file...]
data.SetValue(i,s) # put
field value in VTK object
pts.SetPoint(i,x) # put
points in VTK object
vtk_u_grid.Allocate(nel, 0)
vtk_u_grid.SetPoints(pts)
vtk_u_grid.GetPointData().SetScalars(data)
# tell the VTK grid structure about the element topology
for e in range (1, nel):
< getting cell type (int), npt (int) and point list
(array of ints)>
vtk_u_grid.InsertNextCell(vtk_cell_type, npt, pt_list)
#------------------------------------------------------------------------------------------------------
--
"Je forme une entreprise qui n'eut jamais d'exemple,
et dont l'exécution n'aura point d'imitateur." J-J Rousseau
More information about the vtkusers
mailing list