[Paraview] [EXTERNAL] Re: Trace recorder and presets (color table)

Scott, W Alan wascott at sandia.gov
Tue Mar 17 14:46:02 EDT 2015


Thanks Burlen!

Obviously, my ParaView Python fu is weak.  I tried to merge this code into Python created by the trace recorder, but couldn't.  Say a person does the following (which is sort of what my customer is doing) :

*         Trace recorder on.

*         Wavelet.  Apply.  Surface.  RTData.

*         Color Editor/ Presets/ Blue to Red Rainbow.

*         Trace Recorder off.

The line setting Blue to Red Rainbow doesn't get recorded.  What code would I paste in there?

Here is the incorrect trace:

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'Wavelet'
wavelet1 = Wavelet()

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [856, 797]

# show data in view
wavelet1Display = Show(wavelet1, renderView1)
# trace defaults for the display properties.
wavelet1Display.Representation = 'Outline'
wavelet1Display.ColorArrayName = ['POINTS', '']
wavelet1Display.ScalarOpacityUnitDistance = 1.7320508075688779
wavelet1Display.Slice = 10

# reset view to fit data
renderView1.ResetCamera()

# change representation type
wavelet1Display.SetRepresentationType('Surface')

# set scalar coloring
ColorBy(wavelet1Display, ('POINTS', 'RTData'))

# rescale color and/or opacity maps used to include current data range
wavelet1Display.RescaleTransferFunctionToDataRange(True)

# show color bar/color legend
wavelet1Display.SetScalarBarVisibility(renderView1, True)

# get color transfer function/color map for 'RTData'
rTDataLUT = GetColorTransferFunction('RTData')
rTDataLUT.RGBPoints = [37.35310363769531, 0.231373, 0.298039, 0.752941, 112.04112243652344, 0.865003, 0.865003, 0.865003, 186.72914123535156, 0.705882, 0.0156863, 0.14902]
rTDataLUT.ScalarRangeInitialized = 1.0

# get opacity transfer function/opacity map for 'RTData'
rTDataPWF = GetOpacityTransferFunction('RTData')
rTDataPWF.Points = [37.35310363769531, 0.0, 0.5, 0.0, 186.72914123535156, 1.0, 0.5, 0.0]
rTDataPWF.ScalarRangeInitialized = 1

#### saving camera placements for all active views

# current camera placement for renderView1
renderView1.CameraPosition = [0.0, 0.0, 66.92130429902464]
renderView1.CameraParallelScale = 17.320508075688775

#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).


From: Burlen Loring [mailto:bloring at lbl.gov]
Sent: Monday, March 16, 2015 4:45 PM
To: Scott, W Alan; paraview at paraview.org
Subject: [EXTERNAL] Re: [Paraview] Trace recorder and presets (color table)

Hi Alan,

You can use the AssignLookupTable function to reference builtin lookup tables by name. For example see code between # marks below. There are a few other conveniences for working with the builtin tables as well, see this recipe<http://www.paraview.org/Wiki/ParaView/Python/Lookup_tables>

w = Wavelet()
w_rep = Show(w)
w_rep.Representation = 'Surface'
#
w_rep.ColorArrayName = 'RTData'
w_arr = w.PointData.GetArray('RTData')
w_rep.LookupTable = AssignLookupTable(w_arr, 'Rainbow Blended White')
#
Render().ResetCamera()

Burlen
On 03/16/2015 03:14 PM, Scott, W Alan wrote:
I have a user that needs to change the ParaView preset from default (cool to warm) to another ParaView preset (Blue to Red Rainbow).  He wants to do this in a python trace.  So, he used the trace recorder to record his steps.  Unfortunately, changing presets is not recorded with the trace recorder.

I have written this issue up as bug number http://www.paraview.org/Bug/view.php?id=15116, but need to give the user the code that would have/ should have been produced.  Does anyone have the python code that changes presets?

Thanks all!

Alan







_______________________________________________

Powered by www.kitware.com<http://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



Search the list archives at: http://markmail.org/search/?q=ParaView



Follow this link to subscribe/unsubscribe:

http://public.kitware.com/mailman/listinfo/paraview

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150317/22f9254d/attachment.html>


More information about the ParaView mailing list