[vtkusers] VTK Model not shown correctly

Chris Turner cturnercomplex at googlemail.com
Wed May 19 14:40:09 EDT 2010


Hi,

I use the following python script to display a vtk model:


renderer = vtk.vtkRenderer()
window = vtk.vtkRenderWindow()
window.AddRenderer(renderer)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(window)
window.SetSize(500,500)
renderer.SetBackground(1,1,1)

reader = vtk.vtkPolyDataReader()
cam=renderer.GetActiveCamera()
writer=vtk.vtkPNGWriter()

reader.SetFileName("/tmp/balblub.vtk")
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(reader.GetOutput())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetColor(1,0,0)
renderer.AddActor(actor)

renderer.ResetCamera()		
cam.SetPosition(0,-120,222)
cam.SetViewUp (0, 0.7, 0.7)
window.Render()
iren.Start()


You can see the resulting image in half.jpg. If I use the mouse wheel
to zoom in and out again I get the correct model seen in full.jpg.

So obviously I'm missing some update function or so. But I don't know
which..... So can somebody help me?


Thanks
Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: full.jpg
Type: image/jpeg
Size: 71761 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100519/7415e6f8/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: half.jpg
Type: image/jpeg
Size: 50665 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100519/7415e6f8/attachment-0001.jpg>


More information about the vtkusers mailing list