Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

[newbie] browsing through materials

stefan
Booster
When I step through all the materials, one at a time, I can get all info from them. However, when I step through the geometry from the 3D-Window, I get some "iumat" short that should be an index into the materials.

When I use this "iumat" I can reach materials, but not the ones I was expecting:
material  =	component.pgon.iumat;
API_Attribute    attrib;
BNZeroMemory (&attrib, sizeof (API_Attribute));
attrib.header.typeID = API_MaterialID;
attrib.header.index = material;
err = ACAPI_Attribute_Get (&attrib);
if (err == NoError)
{
	sprintf(matBuffer, "%s",  attrib.header.name);
}
--- stefan boeykens --- architect-engineer-musician ---
ARCHICAD25/Revit2022/Rhino6/Unity2020/Solibri
MBP2019:i9Octo2.4GHz32GBVega20/BigSur+Win11
ARCHICAD-user since 1998
4 REPLIES 4

stefan
Booster
And now the Radiance image (note that textures are ignored, but Sun Position, Camera Viewpoint and View Angle is fine).

The floor was using "Wood-Pine Shiny" and the rest is "Surface-Whitewash". In the export they are both wrong and turn to
"Brick Face" and "Surface Plaster Rough".
I don't think it's a coincidence that the last two materials have been the first two in the complete list of materials, which I generated as follows (based on the API-examples):
API_Attribute		attrib;
BNZeroMemory (&attrib, sizeof (API_Attribute));
err = ACAPI_Attribute_GetNum (API_MaterialID, &nAttr);
for (short i = 1; i <= nAttr && err == NoError; i++)
{
	attrib.header.typeID = API_MaterialID;
	attrib.header.index = i;
	err = ACAPI_Attribute_Get (&attrib);
	if (err == NoError)
	{
		char nameBuffer[64];
		sprintf(nameBuffer, "'%s'", attrib.header.name);
	}
}
--- stefan boeykens --- architect-engineer-musician ---
ARCHICAD25/Revit2022/Rhino6/Unity2020/Solibri
MBP2019:i9Octo2.4GHz32GBVega20/BigSur+Win11
ARCHICAD-user since 1998

Oleg
Advocate
stefan wrote:
When I step through all the materials, one at a time, I can get all info from them. However, when I step through the geometry from the 3D-Window, I get some "iumat" short that should be an index into the materials.
I did not try, but I think iumat isnot material attribute index, it is API_UmatType components index of API_Component3D.

stefan
Booster
And again a big thank you!
char matBuffer[64];
material = component.pgon.iumat;
API_Component3D component3D;
component3D.header.typeID = API_UmatID;
component3D.header.index = material;
err = ACAPI_3D_GetComponent(&component3D);
if (err == NoError)
{
	API_UmatType umatType = component3D.umat;
	sprintf(matBuffer, "%s",  umatType.mater.head.name);
}
Now I get the correct material from a 3D Polygon...
It seems the the "Attribute" Material and the "3DComponent" Material are reached in a complete different way!
rview2.jpg
--- stefan boeykens --- architect-engineer-musician ---
ARCHICAD25/Revit2022/Rhino6/Unity2020/Solibri
MBP2019:i9Octo2.4GHz32GBVega20/BigSur+Win11
ARCHICAD-user since 1998

Oleg
Advocate
stefan wrote:
It seems the the "Attribute" Material and the "3DComponent" Material are reached in a complete different way!
I can only assume about the reason. Materials for polugons can be defined inside GDL script or binary section of object. They will not have the appropriate material attributes. Probably therefore there is this umat components.

PS: By the way, I am not sure, but it is possible that names of Umat materials are not unique and can be duplicated, if some objects will have various definitions of materials with an identical name. Though I did not try.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!