Hi,
I would like to change material of component on “component level” - i want to change material of all features - I have in my component lot of features with lot of kind of materials and i need set one material to all component.
I tried to use script like this:
from vcScript import *
app = getApplication()
definition of function
def setMaterial(part, material_name):
# find the materialname matching the given name
material = app.findMaterial(material_name)
# this will force even feature materials to be over-written
part.MaterialInheritance = VC_MATERIAL_FORCE_INHERIT
# assigning material as node material doesn’t force rebuild
# => more efficient coz dynamic components still share geometry representation
part.NodeMaterial = material
def OnRun():
comp = getComponent()
setMaterial(comp, ‘arctic_hite’)
comp.rebuild()
app.render()
Source of this code was Help of Visual Components.
It is works. But when i saved component into My Models, and reload it into Works space , materials was the origin - no change of material was saved.
How to change material of component by right way?
layout_wheel.vcmx (1.39 MB)