Temporarily ChangeColor of Item/Product

Hello,

I was wondering if it is possible to change the color of a product temporarily, so that if the simulation resets the product changes the color back to its original material/color. The solution I could find online work and like the tutorial in the academy change the color, but if the simulation is reset the color does not change back to the original.

Does someone know the magical line in python to automatically reset the appearence by resetting the simulation?

best
maru

Hello,
With product, do you refer to a component? Product objects are dynamic components that are removed when simulation is reseted.
Anyways, for a static component you can use OnReset event in the component’s script:

comp = getComponent()
app = getApplication()

def OnReset():
  comp.Material = app.findMaterial("steel")

Note that this doesn’t override the materials set to geometries of the component, if they are non-null.

ah yes, that works thank you :slight_smile: