[vtkusers] VTK Model not shown correctly

Eric E. Monson emonson at cs.duke.edu
Wed May 19 16:11:36 EDT 2010


Hey Chris,

I'm not really sure, but I get the feeling that with the manual repositioning of the camera the system just doesn't do any auto-calculation of the clipping range unless you ask it to. 

Glad it worked for you,
-Eric

On May 19, 2010, at 4:03 PM, Chris Turner wrote:

> 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
>> 
>> 
> _______________________________________________
> 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