3 Replies Latest reply on Jun 27, 2016 2:46 AM by Andreas Killer

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

    Andreas Killer

      Hi,

      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).

      Unbenannt.PNG

      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.

      Andreas.