[Paraview] camera commands hang in python script

Iain Bethune ibethune at epcc.ed.ac.uk
Thu Apr 3 04:51:53 EDT 2008


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().GetArrayInformation(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.

 




More information about the ParaView mailing list