AnsweredAssumed Answered

How to properly read out Appearances of an Assembly?

Question asked by Max Nachname on Jun 29, 2019

Hallo awesome Forum,

 

I`m having trouble with the appearances. I only want to read the materials that are actually shown in an assembly. 

 

Obviously a part can have couple of materials assigned on different levels (face, feature, body, component, part). If the part is in an assembly the assembly materials trumps every other appearance that is assigned to the part.

 

I now want to read the appearances of an assembly in the following way: (Pseudo-Code:)

 

Check if assembly has an appearance that trumps all others, if yes, write info somewhere, if not traverse assembly:

 

Check if Sub-Assembly has material, if yes, write info somewhere, if not traverse assembly...

 

 

I can get the appearances of a MODELDOC with the following line:

 

       var Appearances = swModel.Extension.GetRenderMaterials2(1, null);

 

This give me an array of appearances that are in the MODELDOC. 

 

Problem: I want only the material of the ASSEMBLY-root-component. I could take the first one (appearances[0], but this is not the actual material of the assembly, but could be a material of a part in the assembly).

 

I hope I could make myself understood. Its rater complicated to get the right appearance...

 

Thanks for all the help.

Outcomes