Author Topic: How to correctly use mesh_display or SurfaceMeshDisplay in the python script?  (Read 190 times)

qqlovekerry

  • Newbie
  • *
  • Posts: 17
Hi all,
I am trying to use ConstructSurfaceMeshModifiers and then render movies with ovitos python script. After reading the doc page, I am still confused with how to use `mesh_display` or `SurfaceMeshDisplay` to control the `cap_color` or `cap_transparency` in the python script. It seems the script runs well to use the line `surfacemesh = SurfaceMeshDisplay(show_cap = False, surface_color = (1,1,0.5))`in the script, but it takes no effect with the appearance of the cap or the surface color.
I am sorry, I did not fully understand the doc page of `class ovito.modifiers.ConstructSurfaceModifier` or `class ovito.vis.SurfaceMeshDisplay`. Could you please guide me?
Any help would be much appreciated!

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 638
Hi,

The ConstructSurfaceMeshModifier manages the SurfaceMeshDisplay object (so there is no need to create a new one) and you can access it through the modifier's mesh_display field. For example:

Code: [Select]
modifier = ConstructSurfaceModifier(radius = 2.9)
modifier.mesh_display.surface_color = (1,1,0.5)
modifier.mesh_display.show_cap = False

-Alex

qqlovekerry

  • Newbie
  • *
  • Posts: 17
Dear Dr. Alexander Stukowski
Thanks very much for your quick reply! It helps a lot.

Best Regards,
Liu