Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 
Developer forum
GDL coding questions, Python and add-on development using the API Dev Kit.

How to access manufacturer data in Building Material

Not applicable
I am currently trying to work with Building Materials.
First, I create a Building material and add it to the list. This works fine and all the information is there (including ID, manufacturer, description). However, when I try to access those, they are all NULL.

Here is how I access the Building Materials:
	err = ACAPI_Attribute_GetNum(API_BuildingMaterialID, &count);
	if (err != NoError)
		return materials;

	for (i = 1; i <= count; i++) {
		BNZeroMemory(&attrib, sizeof(API_Attribute));
		attrib.header.typeID = API_BuildingMaterialID;
		attrib.header.index = i;
		err = ACAPI_Attribute_Get(&attrib);
My question is what is the problem here? Why are those properties NULL?

Viktor Kovacs
Graphisoft Alumni
Graphisoft Alumni
In case of id, manufacturer and description parameters Archicad fills these values only if they are pointing to an existing GS::UniString object. In your code all of them are null pointers, so they don't filled.

You can use something like this to make it work (it accesses only the manufacturer data, but should work for the other two as well):

API_Attribute attrib;
BNZeroMemory (&attrib, sizeof (API_Attribute));
attrib.header.typeID = API_BuildingMaterialID;
attrib.header.index = attributeIndex;

GS::UniString manufacturer;
attrib.buildingMaterial.manufacturer = &manufacturer;
ACAPI_Attribute_Get (&attrib);

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!