Quantcast
Channel: ArchiCAD-Talk - Developer Forum
Viewing all articles
Browse latest Browse all 564

Getting list materials used in project missed a few "GDLM"

$
0
0
Author:Akos Somorjai
Posted: Fri Jan 05, 2018 2:11 pm (GMT+1)


Ralph Wessel wrote:
IanTr wrote:

I'm trying to get a list of all materials used in the project. The following code catches most materials, however there seems to be some type of material which isn't caught [...]
Is there a way for me to get all the materials including GDLM materials without looping through all the meshes?

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


Viewing all articles
Browse latest Browse all 564

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>