[vtkusers] problems with vtKProgrammableSource

Bryan Cole bryan.cole at teraview.com
Fri Jan 15 12:08:55 EST 2016


I'm trying to use a vtkProgrammableSource to create a StructuredPoints output using python and VTK-6.0.0. My test script is below.

This fails with the error "ERROR: In /builddir/build/BUILD/VTK6.0.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx, line 815
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."

I.e. the programmable source is always giving a vtkPolyData output to the downstream filter (vtkClipVolume) instead of the desired
StructuredPoints dataset. What am I doing wrong?

Thanks,
BC

##############example#############
import vtk

src = vtk.vtkProgrammableSource()
def make_grid():
    sp = src.GetStructurePointsOutput()
    sp.SetDimensions(50,50,50)
    sp.SetOrigin(-10,-10,-10)
    sp.SetSpacing(0.4,0.4,0.4)

src.SetExecuteMethod(make_grid)

func = vtk.vtkSphere()
func.SetCenter(0,0,0)
func.SetRadius(5.0)

clip = vtk.vtkClipVolume()
clip.SetInputConnection(src.GetOutputPort())
clip.SetClipFunction(func)

map = vtk.vtkPolyDataMapper()
map.SetInputConnection(clip.GetOutputPort())
map.ScalarVisibilityOff()

surfaceActor = vtk.vtkActor()
surfaceActor.SetMapper(map)

# Create the RenderWindow, Renderer and both Actors
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

# Add the actors to the renderer, set the background and size
ren.AddActor(surfaceActor)

iren.Initialize()
renWin.Render()
iren.Start()



--
Group Leader, Technical Development Group - Teraview Ltd.
Platinum Building, St. John's Innovation Park, Cambridge CB4 0DS, UK.
tel: +44 (0)1223 435386, fax: +44 (0)1223 435382, web: www.teraview.com<http://www.teraview.com/> Registered Number: 04126946, VAT Number: 770 8883 84

...preferred document formats: ODF (ISO/IEC 26300:2006), PDF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160115/cc6ca023/attachment.html>


More information about the vtkusers mailing list