Author:Akos Somorjai
Posted: Fri Jan 05, 2018 2:11 pm (GMT+1)
Ralph is right, you can get the materials defined in GDL scripts that way, and right again that not all indexes are valid.
So going through the 3D materials is an option; here are a few 'buts':
- materials used in element default settings (do you consider these 'used' materials?)
- materials which depend on conditions in GDL scripts, view settings etc.
Best, Á kos
Posted: Fri Jan 05, 2018 2:11 pm (GMT+1)
Ralph Wessel wrote: | ||
I think the origin of the problem is the dynamic nature of these materials. They're defined by scripts, so are subject to sudden change from one view to another. There is a way you may be able to us the ModelerAPI to avoid iterating through the entire model, but I haven't tried it myself. If you have an instance of a Model object, you can find the highest material index by calling its GetMaterialNum method. You could iterator through every value from 1 to this value calling the GetMaterial method, but I doubt you could assume that every index would return a valid (current) material. Worth a try though – someone from GS might be able to confirm. |
Ralph is right, you can get the materials defined in GDL scripts that way, and right again that not all indexes are valid.
So going through the 3D materials is an option; here are a few 'buts':
- materials used in element default settings (do you consider these 'used' materials?)
- materials which depend on conditions in GDL scripts, view settings etc.
Best, Á kos