[Paraview] camera commands hang in python script

Sylvester Gerardson sylvester.gerardson at gmail.com
Fri Apr 4 05:00:35 EDT 2008


I'm experiencing the same problem, both on Windows and Linux. Has anyone
been able to use python scripting to manipulate the camera?

Thanks!
Sylvester

> -----Original Message-----
> From: paraview-bounces at paraview.org 
> [mailto:paraview-bounces at paraview.org] On Behalf Of Iain Bethune
> Sent: Thursday, April 03, 2008 10:52 AM
> To: paraview at paraview.org
> Subject: [Paraview] camera commands hang in python script
> 
> I've got a python script when runs OK, but hangs whenever I 
> do any camera
> manipulation commands e.g. camera.Roll(x) or camera.Elevation(x).  I'm
> running PV 3.2.1 (downloaded binary) on Windows.  Any ideas 
> what I'm doing
> wrong?
> 
> The script is:
> 
> import time
> 
> # Setup
> 
> if servermanager.ActiveConnection :
> 	connection = servermanager.ActiveConnection
> else:
> 	connection = servermanager.Connect()
> 
> # Get ready to read a file
> 
> reader = servermanager.sources.ImageReader()
> reader.FilePrefix = 
> "Z:\\hpcx\\tera\\visualisation\\test_data\\32x32x32"
> reader.DataExtent = [0, 31, 0, 31, 0, 31]
> reader.DataScalarType = 10
> 
> # Read the file
> 
> view = servermanager.CreateRenderView()
> rep = servermanager.CreateRepresentation(reader, view)
> 
> # Set up how to draw the data
> 
> ai =
> reader.GetDataInformation().GetPointDataInformation().GetArray
> Information(0)
> lt = servermanager.rendering.PVLookupTable()
> rep.LookupTable = lt
> rep.ColorAttributeType = 0
> rep.ColorArrayName = "ImageFile"
> lt.RGBPoints = [ai.GetComponentRange(0)[0], 0, 0, 1,
> ai.GetComponentRange(0)[1], 1, 0, 0]
> lt.ColorSpace = 1
> 
> # Draw
> 
> print "Setup, now rendering..."
> print time.clock()
> 
> 
> 
> view.StillRender()
> view.ResetCamera()
> camera = view.GetActiveCamera()
> camera.Elevation(45.0)   <--- HANGS HERE
> view.StillRender()
> 
> print time.clock()
> 
> print"Finished rendering"
> 
> # Save the file
> 
> view.WriteImage("Z:\\hpcx\\tera\\visualisation\\testimg.png",
> "vtkPNGWriter", 1)
> 
> print time.clock()
> print "Finished saving file"
> 
> Cheers
> 
> - Iain
> 
> --
> Iain Bethune
> Applications Consultant, EPCC
> 
> Email: ibethune at epcc.ed.ac.uk
> Tel/Fax: +44 (0)131 650 5201/6555
> Addr: 2404 JCMB, King's Buildings, Mayfield Road, Edinburgh, EH9 3JZ
> 
> The University of Edinburgh is a charitable body, registered 
> in Scotland,
> with registration number SC005336.
> 
>  
> 
> 
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list