Set trace material

Hi there!

Does anyone know a way to set the material of a robot’s trace using Python?

Thanks!

Rainbow

This sample code is for default trace setting, when line set is stored in robot root.

from vcScript import *
from vcHelpers.Selection import *
import random

app = getApplication()
comp = getComponent()

def OnRun():
  
  materials = app.Materials
  materialCount = len(materials)
  
  while True:    
    lines = filterGeosets(comp.UserGeometry.GeometrySets, VC_COMPACTLINESET)
    if len(lines) > 0:
      line = lines[0]
      line.Material = materials[random.randint(0, materialCount - 1)]
    delay(0.1)
2 Likes

Thanks! This didn’t work initially, but then I set the Node (in the Actions Configuration → Trace On menu), because it was blank, and then it worked.

1 Like