Showing results for 
Search instead for 
Did you mean: 

Getting part Facestyle along assembly hierarchy madness


Hello all!


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. 



Assembly 0
    |_Assembly 1
           |_Assembly 2

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:


  1. Bottom of the tree - Just analyzing Model/Body/Style
  2. Top of the tree - I get it from Part_SubOccurrence.Reference.Style  
  3. Penultimate level - Part_SubOccurrence.ThisAsReference.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:


Reference1 = Assembly1_Document.CreateReference(Assembly2_Occurrence, Part_SubOccurrence.ThisAsOccurrence)
Reference2 = Assembly0_Document.CreateReference(Assembly1_Occurrence, Reference1)


But none of the reference objects created seems to hold any style information. Reference workflows are very poorly documented, so I'm just trying stuff without much foundation. It's quite frustrating.


In short, from the previous scheme, if I assign a facestyle to Part wihtin Assembly1, where can I read that info from Assembly0?

Much thanks in advance, my apologies for the extension.