From the document, I saw this function is supported in pvpython. Since the example in the document only set rgb value, I wonder if we can also manipulate the opacity mapping in python.
I noticed there are several applications (e.g. paraview-web, paraview-visualizer and paraview-lite) for using paraview. Is this function also implemented there? I saw for paraview-visualizer is not, how about the other two application?
Hi @mwestphal,
I am testing categorical colors in python through trame.
And I ran into this error: Uncaught TypeError: t.mapDataIndexed is not a function, here is my code:
from paraview import simple
view = simple.CreateRenderView()
source = simple.OpenVDBReader(FileName=r'testcase.vdb')
arrayName = source.PointData.GetArray(0).Name
displayProps = simple.Show(source, view)
displayProps.Representation = 'Surface'
simple.ColorBy(displayProps, ('POINTS', arrayName), True)
# everything works until here, showing the default color set "Cool to Warm"
categoricalColorMap = simple.GetColorTransferFunction(arrayName, displayProps)
categoricalColorMap.InterpretValuesAsCategories = 1
# error happens when I set this
And also, when I ran displayProps.SetScalarBarVisibility(view, True), a warning came out [paraview] Failed to determine the LookupTable being used and the scalar bar was not shown.
I am affraid trame has issue to choose look up table, or did I miss something?
Thank you for your time!
That issue has nothing to do with trame. Just make sure your script is valid for ParaView.
You can use the “python trace” to get the code from your GUI interaction.
Hi @jourdain,
I think my script is fine, it works with the Run Script under python shell in Paraview GUI.
And the same error still exist when I copy & paste the whole code directly from the output of python trace.
I think so. Here is the file cate.py I tested with previous vdb file.
The paraview code part works in paraview python shell (update: also works by using pvpython cate.py by a little modification), but it fails when I launch it through trame.
And here is the file I paste all output from python trace and still failed rendering through trame. detail.py
Hope the information is clear, thank you for your time.