MantisBT - ParaView
View Issue Details
0013942ParaView(No Category)public2013-03-14 10:192014-08-29 11:00
Alejandro Ribes 
Utkarsh Ayachit 
highminorhave not tried
closedfixed 
 
4.24.2 
ParaViS
feature
0013942: "FitAll" function in python scripting
Hello,

I have a request concerning the function that set the viewing position so that all visible datasets in the selected 3D view are within the viewing frustum. This function is the first icon in the Camera Control Toolbar. I would like to use this function when scripting in python. Can you expose this function via a "FitAll" method or something similar? I know there exists a ResetCamera function but it seems that does not correspond to what I want.

Exemple:

_RenderView = GetRenderView()
_RenderView.CenterAxesVisibility = 0
_RenderView.CenterOfRotation = [2.05, 2.05, 2.13]
_RenderView.CameraViewUp = [-0.1462842057166934, -0.63184311527201897, -0.76116700456679443] _RenderView.CameraPosition = [4.3574016706599696, 7.6016996854983274, -3.0256734058706636] _RenderView.CameraClippingRange = [2.9513133656308672, 13.226048282992661]
_RenderView.CameraFocalPoint = [2.9930930754568661, 1.7779227807543228, 2.0708298819357598]

The last 4 commands of this code are necessary to do the "FitAll" BUT they are dependent on the mesh and then not adapted to a pure scripting environment.
Thanks in advance,

Alejandro.
No tags attached.
Issue History
2013-03-14 10:19Alejandro RibesNew Issue
2013-04-03 07:10Utkarsh AyachitNote Added: 0030505
2014-05-07 03:50Vadim SANDLERNote Added: 0032623
2014-05-07 09:24Utkarsh AyachitNote Added: 0032624
2014-06-03 04:26Vadim SANDLERNote Added: 0032713
2014-06-05 11:30Joachim PouderouxResolutionopen => fixed
2014-06-05 11:30Joachim PouderouxDescription Updatedbug_revision_view_page.php?rev_id=767#r767
2014-06-08 12:11Utkarsh AyachitStatusbacklog => closed
2014-06-08 12:11Utkarsh AyachitAssigned To => Utkarsh Ayachit
2014-06-08 12:11Utkarsh AyachitFixed in Version => git-master
2014-06-17 09:21Utkarsh AyachitTarget Version => 4.2
2014-08-29 11:00Utkarsh AyachitFixed in Versiongit-master => 4.2

Notes
(0030505)
Utkarsh Ayachit   
2013-04-03 07:10   
Alejandro,

That's exactly what "ResetCamera()" should do. What is the problem you're seeing with ResetCamera()? The first icon in the Camera toolbar, indeed calls the same method as the ResetCamera() call.
(0032623)
Vadim SANDLER   
2014-05-07 03:50   
Hello Utkarsh,

As I understand a ResetCamera()method doesn’t change the camera position, in the result of the presented below actions a presentation is not visible:

v = GetActiveView()
c = Cone()
representation = Show()
Render()
v.CameraPosition = [0,0,0]
v.ResetCamera()
Render()

Required a method which sets the camera parameters so that all displayed presentations can be seen.

Regards,
Roman
(0032624)
Utkarsh Ayachit   
2014-05-07 09:24   
Roman,

The only reason the specific code fails is because when you change CameraPosition to [0, 0, 0], the CameraFocalPoint is by default [0, 0, 0] too and then VTK totally gets lost since it doesn't have any view direction to work with. ResetCamera will indeed update both, the CameraPosition and the CameraFocalPoint, however it does need a valid view direction to start with.

Utkarsh
(0032713)
Vadim SANDLER   
2014-06-03 04:26   
Utkarsh,

Thanks you for the detailed explanations.
This issue can be closed.

Roman.