<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="GENERATOR" content="GtkHTML/4.6.6">
</head>
<body>
<br>
I'm trying to use a vtkProgrammableSource to create a StructuredPoints output using python and VTK-6.0.0. My test script is below.<br>
<br>
This fails with the error "ERROR: In /builddir/build/BUILD/VTK6.0.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx, line 815<br>
vtkCompositeDataPipeline (0x2253f50): Input for connection index 0 on input port index 0 for algorithm vtkClipVolume(0x224e050) is of type vtkPolyData, but a vtkImageData is required."<br>
<br>
I.e. the programmable source is always giving a vtkPolyData output to the downstream filter (vtkClipVolume) instead of the desired<br>
StructuredPoints dataset. What am I doing wrong?<br>
<br>
Thanks,<br>
BC<br>
<br>
##############example#############<br>
import vtk<br>
<br>
src = vtk.vtkProgrammableSource()<br>
def make_grid():<br>
sp = src.GetStructurePointsOutput()<br>
sp.SetDimensions(50,50,50)<br>
sp.SetOrigin(-10,-10,-10)<br>
sp.SetSpacing(0.4,0.4,0.4)<br>
<br>
src.SetExecuteMethod(make_grid)<br>
<br>
func = vtk.vtkSphere()<br>
func.SetCenter(0,0,0)<br>
func.SetRadius(5.0)<br>
<br>
clip = vtk.vtkClipVolume()<br>
clip.SetInputConnection(src.GetOutputPort())<br>
clip.SetClipFunction(func)<br>
<br>
map = vtk.vtkPolyDataMapper()<br>
map.SetInputConnection(clip.GetOutputPort())<br>
map.ScalarVisibilityOff()<br>
<br>
surfaceActor = vtk.vtkActor()<br>
surfaceActor.SetMapper(map)<br>
<br>
# Create the RenderWindow, Renderer and both Actors<br>
ren = vtk.vtkRenderer()<br>
renWin = vtk.vtkRenderWindow()<br>
renWin.AddRenderer(ren)<br>
iren = vtk.vtkRenderWindowInteractor()<br>
iren.SetRenderWindow(renWin)<br>
<br>
# Add the actors to the renderer, set the background and size<br>
ren.AddActor(surfaceActor)<br>
<br>
iren.Initialize()<br>
renWin.Render()<br>
iren.Start()<br>
<br>
<br>
<br>
<table cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>-- <br>
Group Leader, Technical Development Group - Teraview Ltd.<br>
Platinum Building, St. John's Innovation Park, Cambridge CB4 0DS, UK.<br>
tel: +44 (0)1223 435386, fax: +44 (0)1223 435382, web: <a href="http://www.teraview.com/">www.teraview.com</a> Registered Number: 04126946, VAT Number: 770 8883 84<br>
<br>
...preferred document formats: ODF (ISO/IEC 26300:2006), PDF </td>
</tr>
</tbody>
</table>
</body>
</html>