AnsweredAssumed Answered

How to get the component from a selected face (to set a color right in an assembly)?

Question asked by Andreas Killer on Jun 24, 2016
Latest reply on Feb 12, 2020 by Al Khatib Nader


I'm working on a tool to set colors in an assembly. I've looked around before, found some tools for that (e.g. from Leonard Kikstra which are really nice), but none of them works correctly.

The issue of all that tools (resp. code) is that they work with the faces and/or the bodies. I've figured out that I have to set the color of the component (see red marker)

I was able to write a code to apply (and remove) the color but only if the component is selected in the feature tree (see green marker).


The attached zip file contains my code the assembly and the parts.

So far so good, now my question:

When I work with an assembly, I'd like to select a face in the graphics area and run a code to color the component as the picture shows.

How can I get the component from a selected face/edge/point/body?

BTW, I can get the body from anything what is selected inside the graphics area, but at this point I'm stuck. I can't find the way to the component.