I want change the material of suction cup on the gripper when it’s gripping the product.
The code is shown below, it was working fine on my laptop,but It did’t work on my desktop
from vcScript import *
from vcMaterial import *
app = getApplication()
comp = getComponent()
sim = app.getSimulation()
link = comp.findNode(“Link_0”)
link.MaterialInheritance = VC_MATERIAL_FORCE_INHERIT
red = app.findMaterial(“red”)
green = app.findMaterial(“green”)
def OnRun():
link1 = comp.findNode("Link_1")
while True:
while not (link1.J1 == 46.0):
link.NodeMaterial = green
app.render()
delay(0.1)
else:
link.NodeMaterial = red
app.render()
delay(0.1)