I have modified the VTK/Examples/Annotation/Python/cubeAxes.py example.<br />
I have introduced the SetAutoAdjustCameraClippingRange(1) function of vtkInteractorStyleSwitch class.<br />
But the camera view is not reset along the current view direction.<br />
Can someone please take a look at the example and point what am I doing wrong ?<br />
<br />
import vtk<br />
from vtk.util.misc import vtkGetDataRoot<br />
VTK_DATA_ROOT = vtkGetDataRoot()<br />
<br />
fohe = vtk.vtkBYUReader()<br />
fohe.SetGeometryFileName(VTK_DATA_ROOT + "/Data/teapot.g")<br />
<br />
foheMapper = vtk.vtkPolyDataMapper()<br />
foheMapper.SetInputConnection(fohe.GetOutputPort())<br />
foheActor = vtk.vtkLODActor()<br />
foheActor.SetMapper(foheMapper)<br />
<br />
outline = vtk.vtkOutlineFilter()<br />
outline.SetInputConnection(fohe.GetOutputPort())<br />
mapOutline = vtk.vtkPolyDataMapper()<br />
mapOutline.SetInputConnection(outline.GetOutputPort())<br />
outlineActor = vtk.vtkActor()<br />
outlineActor.SetMapper(mapOutline)<br />
outlineActor.GetProperty().SetColor(0, 0, 0)<br />
<br />
ren2 = vtk.vtkRenderer()<br />
ren2.AddViewProp(foheActor)<br />
ren2.AddViewProp(outlineActor)<br />
ren2.SetBackground(0.1, 0.2, 0.4)<br />
<br />
renWin = vtk.vtkRenderWindow()<br />
renWin.AddRenderer(ren2)<br />
renWin.SetWindowName("VTK - Cube Axes")<br />
renWin.SetSize(600, 300)<br />
iren = vtk.vtkRenderWindowInteractor()<br />
iren.SetRenderWindow(renWin)<br />
<br />
istyle = vtk.vtkInteractorStyleSwitch()<br />
istyle.SetAutoAdjustCameraClippingRange(1)<br />
iren.SetInteractorStyle(istyle)<br />
<br />
axes2 = vtk.vtkCubeAxesActor2D()<br />
axes2.SetViewProp(foheActor)<br />
axes2.SetCamera(ren2.GetActiveCamera())<br />
axes2.SetLabelFormat("%6.4g")<br />
axes2.SetFlyModeToClosestTriad()<br />
axes2.SetFontFactor(0.8)<br />
axes2.ScalingOff()<br />
ren2.AddViewProp(axes2)<br />
<br />
iren.Initialize()<br />
renWin.Render()<br />
iren.Start()<br />
<br />
<br />
Thanks in advance.<br />
Raashid<br><Table border=0 Width=644 Height=57 cellspacing=0 cellpadding=0 style="font-family:Verdana;font-size:11px;line-height:15px;"><TR><td><A HREF="http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline.htm@Middle?" target="_blank"><IMG SRC="http://sigads.rediff.com/RealMedia/ads/adstream_nx.ads/www.rediffmail.com/signatureline.htm@Middle"></A></td></TR></Table>