Changing the material of a part-feature

Hi all,

I’m working on a project in which I have lots of identical parts on conveyors (brought in via feeders)

Whenever a part is triggered by signal to continue moving, a specific feature of that part should get a different color:

I have written the following python script for this, which is attached to each lane seperately:
image
It looks for the feature and geometry which I would like to give a different color, and then assigns it with the material.
In general it works well, but I’m running into two problems:

  1. After ± 3 parts have been removed and thus their color has changed, all the parts on all the conveyors get that specific color:


    But I would like these parts to retain their ‘neutral’ color.As you can see here, when I click one part and go to the modeling tab it selects all the parts:

    Somehow they are linked but I would like to only change the parts colors one by one.

  2. The 2nd problem has to do with the experience viewer. When I ‘record’ the simulation and run it with the experience viewer, there are no changes in color shown while these are present in the actual simulation.
    Is there a fix for this?

Unfortunately I’m not able to share the file here, but I can make a simplified model if it could help to solve the problem.

Add the red line
image

1 Like

Hi idkfa, thank you for your help!

Unfortunately that does not fix the problem, all the parts still get the same change in color after a couple of parts have passed:

The thing is, I’m not changing the product’s material, but I’m changing the material of a specific feature in the part.

I think I somehow need to discouple the parts from one another.

Need to check the component structure, it would be great if you could upload the simplified layout.

1 Like

Components in VC can share their feature tree which improves the performance of graphics rendering and component copying a lot as clones of even parametric components can use the same geometry mesh objects and such.

In practice this means that for two vcComponents the RootFeature and all its descendants can be the same object. Changing any of those features will then naturally affect both (all) components that share the feature trees.

Certain actions automatically break this sharing, but you can break the sharing using the makeUnique method in vcComponent. Another option is to use the clone method with the sharing parameter set to False.

https://help.visualcomponents.com/4.9/Premium/en/Python_API/vcComponent.htm?rhhlterm=makeunique&rhsearch=makeunique

1 Like

I think there are some known issues in the vcax animation recording. E.g. using scripting at simulation runtime to make changes in the feature trees and material assignments might not get recorded correctly as they are kind of “deep” in the object model.

You can report these as bugs to VC support, together with minimal example layouts.

1 Like

Thanks alot for the help and clear explanation TSy !!
It took me some changes but the makeUnique() command fixed the problem.

Regarding the experience viewer, thats unfortunate