<div dir="ltr">Hello all vtk users,<div><br></div><div style>I am trying to make a polyhedron cell (vtkUnstructuredGrid) from a polydata. Googling for information on how to do this I have found these C++ test and used the as a guide. </div>
<div style><br></div><div style>However when I run my code on Fedora 17 64bit, using python 2.7.3 and vtk 5.10.1 (self compiled), I get an error when using InsertNextCell call of the vtkUnstructuredGrid object. </div><div style>
<br></div><div style>Here is a example code I am using:</div><div style><div>import vtk</div><div><br></div><div># Read the polyData</div><div>cube = vtk.vtkCubeSource()</div><div>Poly = cube.GetOutput()</div><div><br></div>
<div># Extract the information needed from the poly data</div><div>numPts = vtk.vtkIdTypeArray()</div><div>numPts.InsertNextValue(Poly.GetNumberOfPoints())</div><div>ptsIds = vtk.vtkIdTypeArray()</div><div>for cP in range(numPts.GetValue(0)): ptsIds.InsertNextValue(cP)</div>
<div>numCellFaces = vtk.vtkIdTypeArray()</div><div>numCellFaces.InsertNextValue(Poly.GetNumberOfPolys())</div><div>faces = vtk.vtkIdTypeArray()</div><div>for cF in range(numCellFaces.GetValue(0)):</div><div>    numPtsInFace = vtk.vtkIdTypeArray() </div>
<div>    numPtsInFace.InsertNextValue( Poly.GetCell(cF).GetNumberOfPoints())</div><div>    faces.InsertNextValue(numPtsInFace)</div><div>    for cPF in range(numPtsInFace.GetValue(0)):</div><div>        faces.InsertNextValue(Poly.GetCell(cF).GetPointId(cPF))</div>
<div><br></div><div># Make the grid</div><div>UnstructPolyHed = vtk.vtkUnstructuredGrid()</div><div>UnstructPolyHed.SetPoints(Poly.GetPoints())</div><div>UnstructPolyHed.InsertNextCell(vtk.VTK_POLYHEDRON,numPts,ptsIds,numCellFaces,faces)</div>
<div>
<p style="margin:0px"><br></p></div><div style>But I always end with this error: InsertNextCell() takes exactly 2 arguments (5 given)</div><div style><br></div><div style>The example used 5 inputs as follows </div><div style>
InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds, vtkIdType nfaces, vtkIdType *faces)</div><div><br></div><div style><br></div><div style>What am I doing incorrectly?</div><div style><br></div><div style>Thanks in advance.</div>
<div style><br></div><div style>Cheers,</div><div style>Gudni Karl</div>
</div></div>