Author Topic: VTK mesh transparency from python script  (Read 90 times)

marco.trofa

  • Newbie
  • *
  • Posts: 2
VTK mesh transparency from python script
« on: July 25, 2019, 08:26:22 AM »
Hi,

I would like to visualise a motion of a particle set (*.dump format) along with a *.vtk based geometry, through a python script.
I managed to load the data and show them in the GUI through the following script:

Code: [Select]
from ovito.io import import_file
node = import_file("DEM/post/dump*.out")
node.add_to_scene()
node2 = import_file("DEM/post/bar*.vtk")
node2.add_to_scene()

However, I'm not able to set the transparency of the Triangle mesh generated from the VTK.
How can I do that?

Thank you,
Marco

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 638
Re: VTK mesh transparency from python script
« Reply #1 on: July 25, 2019, 09:24:27 AM »
Hi Marco,

This requires a yet undocumented part of the Python API, but here you go:

Code: [Select]
# OVITO 2.9.0:
node2.source.objects[0].display.transparency = 0.5

# OVITO 3.0.0-dev:
node2.source.data.objects[0].vis.transparency = 0.5

-Alex

marco.trofa

  • Newbie
  • *
  • Posts: 2
Re: VTK mesh transparency from python script
« Reply #2 on: July 25, 2019, 10:15:50 AM »
Thank you very much.

Marco