Material/Color Change of Robot Link using Python

Is it possible to change the color of a link instead of the entire component of a Robot using Python Script?

It is possible but it depends also on how the robot was modelled. This is one way to do it:

comp = getComponent()
node = comp.findNode("Axis 1") # name of your link
node.MaterialInheritance = VC_MATERIAL_INHERIT_NODE
node.NodeMaterial = getApplication().findMaterial("red") # name the material

Thanks for the code. ccamilo.
I was able to extract the node using the above code.
However assigning the material had no effect on the robot link.
I am using the UR10 cobot from the library.


In that case, you can grab all geometry sets from the node and change their material.

mat = getApplication().findMaterial("red") # your material.
comp = getComponent()
node = comp.findNode("Link2") # name of your link
sets = node.Geometry.GeometrySets
for s in sets:
  s.Material = mat

However, If you rebuild your component the change is lost. If you want your change to be persistent you should do the same but taking the geometry sets from the features of that node.

Thanks for the quick response. ccamilo.
I have however found a way to make your first code work by changing the line

node.MaterialInheritance = VC_MATERIAL_INHERIT_NODE

node.MaterialInheritance = VC_MATERIAL_FORCE_INHERIT_NODE