I'm designing a tiny application in order to manage assemblies by color of the parts.
As you know, a part color can be defined on multiple levels, from its own body to each of the assemblies and subassemblies in which the part is placed.
If a color is specified in one level, it will "visually override" all levels under it. Let's supose this situation.
So, for example, if color is specified in Assembly 1, it will override both Assembly 2 assignment and Body color definition.
My objective is to determine, from the top assembly, the real color (facestyle to be more polite) in which a part is shown. No matter if it's the own body color or it has been asigned in any level along the full hierarchy.
Currently, I know how to guess the color if it's defined in one of these 3 levels:
Bottom of the tree - Just analyzing Model/Body/Style
Top of the tree - I get it from Part_SubOccurrence.Reference.Style
The app searches for the top-most color, which will be the one assigned in order to work with the part.
The problem is that I have no idea how to access style information when it has been assigned under the top level but above penultimate level. In the previous scheme, for example, If the user assigned a style to Part from Assembly1, I have no clue of how to get that information from Assembly 0. I have tried to recursively use Reference this way: