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

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Archicad C++ API
About Archicad add-on development using the C++ API.

Wall Building Material Questions

Anonymous
Not applicable
Hey. I was exploring materials for walls, and found the short buildingMaterial.
However I failed to find any type of documentation regarding what value corresponds to what material, for example, 45 -> Glass.
I made a .txt containing all the materials I was able to find using different values for buildingMaterial.

I have two questions regarding this. First, is there an official mapping the short value to the material that I wasn't able to find.
Second, this values will never change in future updates, can I count on the number 45 always being Glass, for example.

I added as an attachment the .txt containing my mapping of short value to material.
EDIT: I wasn't able to get the attachement working, I will leave here a small portion of the .txt, if you want to see the full list, I will do another post with it.
0 = Brick
1 = Brick
2 = Brick - Structural
3 = Brick - Finish
4 = Masonry Block - Structural
5 = Masonry Block - Filler
...
2 REPLIES 2
ReignBough
Enthusiast
First, is there an official mapping the short value to the material that I wasn't able to find.
Yes. There is an example on ACAPI_Attribute_Get (Example II) for this.
Second, this values will never change in future updates, can I count on the number 45 always being Glass, for example.
No. Since you can modify the list on Options > Element Attributes > Building Materials... dialog.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
Anonymous
Not applicable
Hey, thank you for your answer it was very useful. Using the example you pointed out, I was able to create a file with the current names of the materials.

I will leave here the code:

	GSErrCode err;
	ofstream file;
	API_Attribute  attrib;
	short n;

	BNZeroMemory(&attrib, sizeof(API_Attribute));

	attrib.header.typeID = API_BuildingMaterialID;
	err = ACAPI_Attribute_GetNum(API_BuildingMaterialID, &n);
	
	file.open("ListOfMaterials.txt");
	for (int i = 1; i <= n && err == NoError; i++) {
		attrib.header.index = i;
		err = ACAPI_Attribute_Get(&attrib);
		if (err == NoError) {
			file << attrib.buildingMaterial.head.name << "\n";
		}
		if (err == APIERR_DELETED){
			err = NoError;
		}
	}
	file.close();