Still away on holiday in Andalusia, here is another little item that I am posting ahead of time.
We looked at various aspects of materials in the past, such as the materials assigned to an element and its solid faces and to a family instance, material quantity extraction, creating a new material, and the fact that in the general case, there is no solid material. There are exceptions to the last statement, though, as we see from the answer to the following question:
Question: I created a single wall and assigned different materials to several of its faces. I have no problem determining the different materials based on the face, but I can't get the material that is initially assigned to the wall itself.
If I do nothing to change the material of the wall, it appears as the first material item at the object. If I do change it, though, it appears at the end of the list. So I cannot rely on the position in the list.
Is there some way to get the material from the entire wall, based on the solid? We want to assign the material to the solid, and create additional surfaces for materials which differ from the material of the wall itself. To do this, we need to determine the material of the wall itself.
Answer: You can obtain the material of the entire wall from its compound structure, which includes material information for each of its layers. We also looked at the issue of calculating the compound wall layer volumes.
By the way, it might be interesting to compare the results of the GetMaterialArea and GetMaterialVolume methods with the face-based area calculation mentioned above and the volume calculation based on the compound layer structure volumes.
Many thanks to Steffen Rabe of RIB Software AG for this solution!