[vtkusers] VTK Model not shown correctly

Chris Turner cturnercomplex at googlemail.com
Wed May 19 16:03:54 EDT 2010


Hi Eric,

thanks that did the trick! But I don't quiet understand why? Why do I
have to call the method manualy?

Regards,
Chris

On Wed, May 19, 2010 at 3:31 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hey Chris,
>
> I don't  know if this will do it, but you might want to try calling
>
> renderer.ResetCameraClippingRange()
>
> after those camera position and view calls.
>
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On May 19, 2010, at 2:40 PM, Chris Turner wrote:
>
>> 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
>> <full.jpg><half.jpg>_______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list