Update python script to generate documentation figures.

This commit is contained in:
Xavier Raynaud 2012-04-16 17:49:33 +02:00
parent 63a57ff03b
commit 9d8cb130c8

View File

@ -17,14 +17,14 @@ dp.AmbientColor = [1, 0, 0]
view = GetActiveView()
view.Background = [1, 1, 1]
camera = GetActiveCamera()
camera.SetPosition(20, 20, 110)
camera.SetViewUp(0.5,0.3,0.7)
camera.SetPosition(4, -6, 5)
camera.SetViewUp(-0.19, 0.4, 0.9)
camera.SetViewAngle(30)
camera.SetFocalPoint(1,1,0.5)
camera.SetFocalPoint(1.5, 1.5, 1)
Render()
WriteImage("Figure/tutorial1.png")
Hide(grid)
# remove("tutorial1.vtu")
remove("tutorial1.vtu")
# tutorial 2
call("tutorials/tutorial2")
@ -33,12 +33,10 @@ grid.UpdatePipeline()
Show(grid)
dp = GetDisplayProperties(grid)
dp.Representation = 'Surface'
data = grid.GetCellDataInformation()
pressure = data.GetArray('pressure')
pmin = pressure.GetRange()[0]
pmax = pressure.GetRange()[1]
dp.LookupTable = MakeBlueToRedLT(0.5*(pmin+pmax)-0.2*(pmax-pmin), 0.5*(pmin+pmax)-0.2*(pmax+pmin))
dp.ColorArrayName = 'pressure'
pres = grid.CellData.GetArray(0)
pres_lookuptable = GetLookupTableForArray( "pressure", 1, RGBPoints=[pres.GetRange()[0], 1, 0, 0, pres.GetRange()[1], 0, 0, 1] )
dp.LookupTable = pres_lookuptable
view = GetActiveView()
view.Background = [1, 1, 1]
camera = GetActiveCamera()
@ -48,4 +46,30 @@ camera.SetViewAngle(30)
camera.SetFocalPoint(20, 20, 0.5)
Render()
WriteImage("Figure/tutorial2.png")
Hide(grid)
# remove("tutorial2.vtu")
# # tutorial 3
call("tutorials/tutorial3")
cases = ["000", "005", "010", "015", "019"]
for case in cases:
grid = servermanager.sources.XMLUnstructuredGridReader(FileName="tutorial3-"+case+".vtu")
grid.UpdatePipeline()
Show(grid)
dp = GetDisplayProperties(grid)
dp.Representation = 'Surface'
dp.ColorArrayName = 'saturation'
sat = grid.CellData.GetArray(1)
sat_lookuptable = GetLookupTableForArray( "saturation", 1, RGBPoints=[0, 1, 0, 0, 1, 0, 0, 1])
dp.LookupTable = sat_lookuptable
view.Background = [1, 1, 1]
camera = GetActiveCamera()
camera.SetPosition(100, 100, 550)
camera.SetViewUp(0, 1, 0)
camera.SetViewAngle(30)
camera.SetFocalPoint(100, 100, 5)
Render()
WriteImage("Figure/tutorial3-"+case+".png")
Hide(grid)
# remove("tutorial3.vtu")