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

Extract wall composite name with API (AC26)

YourQS
Booster

I would like to extract the composite name from walls, slabs, and roofs using the API.   I have got all the other information I need (dimensions, instance name, etc) but I am struggling to find where to get composite info.   I have attached 2 screenshots showing what I need to get.

 

Could someone point me to where this value is held?

 

Thanks in advance.

 

WallFill.PNG

 

SlabFill.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Joel Buehler
Enthusiast

The Composite is in element specific structs

JoelBuehler_0-1695374614967.png

 

 

here is a example of the wall:

 

https://archicadapi.graphisoft.com/documentation/api_walltype?s=API_WallType

 

you get the Attribute Index and with ACAPI_Attribute_Get you should be able to mangle to the name of the composite

 

 

 

 

View solution in original post

5 REPLIES 5
Solution
Joel Buehler
Enthusiast

The Composite is in element specific structs

JoelBuehler_0-1695374614967.png

 

 

here is a example of the wall:

 

https://archicadapi.graphisoft.com/documentation/api_walltype?s=API_WallType

 

you get the Attribute Index and with ACAPI_Attribute_Get you should be able to mangle to the name of the composite

 

 

 

 

Thanks very much

Apollos
Booster

Happy New year @YourQS and @Joel Buehler .

Please I need help. I am new to App Development using Archicad C++ API. I am trying to extract some basic information from the AC Database and specific Elements.

 

Please, I have tried to extract some Building Material Attribute information, particularly the ID, Manufacturer, and Description, but my code always returns empty. Please, I need help. I've attached the information I need and the snippet of the line of code I have been using.

API_Attribute attrib = {};
	GSErrCode err;

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

	err = ACAPI_Attribute_Get(&attrib);
	if (err == NoError) {

		 /*Extracting GS::UniString values*/
		const GS::UniString theGuid = APIGuid2GSGuid(attrib.buildingMaterial.head.guid).ToUniString().ToCStr().Get();

		const GS::UniString idString = attrib.buildingMaterial.id ?
			GS::UniString(*attrib.buildingMaterial.id).ToCStr().Get() : GS::UniString();

		const GS::UniString manufacturerString = attrib.buildingMaterial.manufacturer ? 
			GS::UniString(*attrib.buildingMaterial.manufacturer).ToCStr().Get() : GS::UniString();

		const GS::UniString descriptionString = attrib.buildingMaterial.description ? 
			GS::UniString(*attrib.buildingMaterial.description).ToCStr().Get() : GS::UniString();
		
		 /*Displaying extracted values*/
		ACAPI_WriteReport("Building Material Information:\nGuid: " + theGuid + 
			"\nID: " + idString + "\nManufacturer: " + manufacturerString + 
			"\nDescription: " + descriptionString, true);

Archicad api request.png

Hi Appolos,

Where do you get the index from in the line 

attrib.header.index = 4

Magic numbers like this are generally frowned upon, because others don't know what they mean.

Apollos
Booster

Hello @YourQS  thank you for your response. 

Pardon me for not adding comments to the line of code. NOTE: As I mentioned earlier I am new to using the Archicad C++ API.

 

The "attrib.header.index" specifies the index value of the attribute. I observed that in the Attribute Manager documentation (see the picture). 

 

I wanted to extract the attributes of all the Building Materials within the Archicad Database (as is) therefore I thought iterating through the index was the best way.

I got results (e.g. Guid, name, connPriority, cutFill, cutFillBackgroung, etc) but I could not access the ID and manufacturer.

 

If you have a better suggestion and advice I await your response.

 

attrib index pix.png