Python Tracing Revisited
From ParaQ Wiki
Jump to navigationJump to search
Try this:
- Start ParaView (paraview -dr)
- Start Trace
- Create Wavelet, Apply
- Create Clip, Apply
- Stop Trace
Here's how the generated trace looks in various versions:
ParaView 4.0.1# ********** ParaView Version 4.0.1 *********************
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
Wavelet1 = Wavelet()
RenderView1 = GetRenderView()
DataRepresentation1 = Show()
DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]
DataRepresentation1.SelectionPointFieldDataArrayName = 'RTData'
DataRepresentation1.ScalarOpacityUnitDistance = 1.7320508075688779
DataRepresentation1.Representation = 'Outline'
DataRepresentation1.ScaleFactor = 2.0
Clip1 = Clip( ClipType="Plane" )
RenderView1.CameraPosition = [0.0, 0.0, 66.92130429902464]
RenderView1.CameraClippingRange = [46.35209125603439, 92.97512386351]
RenderView1.CameraParallelScale = 17.320508075688775
Clip1.Scalars = ['POINTS', 'RTData']
Clip1.ClipType = "Plane"
active_objects.source.SMProxy.InvokeEvent('UserEvent', 'ShowWidget')
a1_RTData_PVLookupTable = GetLookupTableForArray( "RTData", 1,
RGBPoints=[43.34006881713867, 0.23, 0.299, 0.754,
276.68310546875, 0.706, 0.016, 0.15],
VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0],
ColorSpace='Diverging', ScalarRangeInitialized=1.0,
AllowDuplicateScalars=1 )
a1_RTData_PiecewiseFunction = CreatePiecewiseFunction(\
Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] )
DataRepresentation2 = Show()
DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483]
DataRepresentation2.SelectionPointFieldDataArrayName = 'RTData'
DataRepresentation2.ScalarOpacityFunction = a1_RTData_PiecewiseFunction
DataRepresentation2.ColorArrayName = ('POINT_DATA', 'RTData')
DataRepresentation2.ScalarOpacityUnitDistance = 1.8307836667054274
DataRepresentation2.LookupTable = a1_RTData_PVLookupTable
DataRepresentation2.ScaleFactor = 2.0
RenderView1.CameraClippingRange = [42.19973957146408, 98.2020791247405]
a1_RTData_PVLookupTable.ScalarOpacityFunction = a1_RTData_PiecewiseFunction
Render()
|
ParaView >4.1.0 (development)# ******* ParaView Version 4.1.0-600 (After ParaView Pipeline Controller Changes) ****
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
Wavelet0 = Wavelet()
RenderView0 = GetRenderView()
UniformGridRepresentation0 = Show()
RTData_PiecewiseFunction = CreatePiecewiseFunction(\
Points=[0.0, 0.0, 0.5, 0.0, 276.8288269042969, 1.0, 0.5, 0.0] )
RTData_PVLookupTable = CreateLookupTable(\
RGBPoints=[37.35310363769531, 0.231373, 0.298039, 0.752941,
157.0909652709961, 0.865003, 0.865003, 0.865003,
276.8288269042969, 0.705882, 0.0156863, 0.14902],
ScalarRangeInitialized=1.0 )
ScalarBarWidgetRepresentation0 = CreateScalarBar( ComponentTitle='', Title='RTData' )
GetRenderView().Representations.append(ScalarBarWidgetRepresentation0)
UniformGridRepresentation0.ScalarOpacityFunction = RTData_PiecewiseFunction
UniformGridRepresentation0.LookupTable = RTData_PVLookupTable
RenderView0.CameraPosition = [0.0, 0.0, 66.92130429902464]
RenderView0.CameraParallelScale = 17.320508075688775
Clip0 = Clip()
# toggle the 3D widget visibility.
active_objects.source.SMProxy.InvokeEvent('UserEvent', 'ShowWidget')
UnstructuredGridRepresentation0 = Show()
UnstructuredGridRepresentation0.ScalarOpacityFunction = RTData_PiecewiseFunction
UnstructuredGridRepresentation0.LookupTable = RTData_PVLookupTable
Render()
|
The one major difference between this trace and the one generated by 4.0.1 is that we have scalar bar shown in this trace -- since ParaView now shows the scalar bar automatically.
Now, if I am to manually write the Python script to create the same visualization, I'd expect to write as follows:
# *** Not real code, illustration only
from paraview.simple import *
# Create Render View
renderView0 = CreateRenderView()
# Create Wavelet source
wavelet0 = Wavelet()
waveletDisplay0 = Show()
# Create Clip filter
clip0 = Clip()
clipDisplay0 = Show()
# Show the scalar bar
ShowScalarBar()