[Paraview] Mimicking the 'set view plane direction' GUI buttons in Python script

pat marion pat.marion at kitware.com
Wed Jul 8 11:07:58 EDT 2009


I'm not quite sure this is available in 3.5, but there is a new way to
set camera properties.  Instead of setting them on the camera, try
setting them on the view:

view = GetActiveView()
view.CameraPosition = [-15, 10, 0]
view.CameraFocalPoint = [0, 10, 0]
view.CameraViewUp = [0 ,0, 1]

All settable properties for the view can be printed:

for p in view.ListProperties():
    if not view.GetProperty(p).GetInformationOnly(): print p

Pat

On Wed, Jul 8, 2009 at 7:07 AM, Adriano Gagliardi<agagliardi at ara.co.uk> wrote:
> I am trying to write a simple few lines of Python code to mimick the view
> plane direction buttons available in the GUI, but I'm finding some of the
> commands don't seem to accept my input. The version of Paraview is 3.5.0 and
> I'm using paraview.simple. For example:
>
> cam = GetActiveCamera()
>
> cam.SetPosition(-15,10,0) #works
> cam.GetPosition()               #works
> ( -15.0, 10.0, 0.0)
> Render()
>
> cam.SetFocalPoint(0,10,0)       #works
> cam.GetFocalPoint()             #works
> ( 0.0, 10.0, 0.0)
> Render()
>
> cam.GetViewUp()
> (0.0, 1.0, 0.0)
> cam.SetViewUp(0,0,1)    #error
> Traceback (most recent call last):
>  File "<console>", line 1, in ?
> TypeError: 'list' object is not callable
> cam.SetViewUp = (0,0,1) #appears to have accepted it
> cam.GetViewUp()
> (0.0, 1.0, 0.0)         #does not update the view
>
> Do I need to update to the latest dev version to get this working? It
> appears to work fine with the old Paraview-python API.
>
> ===================================
>
> Adriano Gagliardi MEng PhD
> Project Scientist
> Computational Aerodynamics
> Aircraft Research Association Ltd.
> Manton Lane
> Bedford
>
> Tel: 01234 32 4644
> E-mail: agagliardi at ara.co.uk
> Url: www.ara.co.uk
>
>
> ---------------------------
> This email contains information that is private and confidential and is intended only for the addressee.  If you are not the intended recipient please delete it and notify us immediately by e-mailing the sender.
> Note: All email sent to or from this address may be accessed by someone other than the recipient, for system management and security reasons.
> Aircraft Research Association Ltd.  Registered in England, Registration No 503668 Registered Office: Manton Lane, Bedford MK41 7PF England VAT No GB 196351245
>
>
> _______________________________________________
> 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list