Choose your top Archicad wishes!

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

How to select elements of a particular ElementID or Classification




ACAPI_Element_GetElemList() allows selection of all elements of a particular type.


How do we select elements of a particular ElementID or Classification?




Hi dushyant,

Element ID Property
You mean the Element ID property right? Unfortunately in that case, I don't think there's a single command to do that. My approach would be to make a candidate list of element GUIDs and then filter the matching ones yourself by accessing the property value similar to this:


API_Property prop;
ACAPI_Element_GetPropertyValue (elemGuid, elemIdGuid, prop);

auto value = prop.value.singleVariant.variant.uniStringValue;


where "elemGuid" is the GUID of the current element to test and "elemIdGuid" is the GUID of the "Element ID" property itself. I think that property GUID never changes and even is the same for different AC installs, but I'm not 100% sure. That's why I wrote myself the following function which you are free to copy:


GSErrCode GetElemIdPropertyGuid (API_Guid& elemIdGuid)
	GSErrCode err = NoError;

	// This is our initial guess.
	elemIdGuid = GSGuid2APIGuid (GS::Guid ("B1B54D45-C951-42C9-9AF8-898F0BF212AB"));

	API_PropertyDefinition elemIdPropDef;
	elemIdPropDef.guid = elemIdGuid;
	err = ACAPI_Property_GetPropertyDefinition (elemIdPropDef);
	if (err != NoError) { return err; }

    // We check if it gives us the correct property.
	if ( == "Element ID") { return NoError; }
	// Otherwise we have to search for it
	GS::Array<API_PropertyGroup> groups;
	err = ACAPI_Property_GetPropertyGroups (groups);
	if (err != NoError) { return err; }

	for (GS::USize i = 0; i < groups.GetSize(); ++i) {
		if (groups[i].name == "ID and Categories") {
			GS::Array<API_PropertyDefinition> definitions;
			err = ACAPI_Property_GetPropertyDefinitions (groups[i].guid, definitions);
			if (err != NoError) { return err; }

			for (GS::USize j = 0; j < definitions.GetSize (); ++j) {
				if (definitions[j].name == "Element ID") {
					elemIdGuid = definitions[j].guid;
					return NoError;




I didn't manipulate classifications yet with the AC API so I can only give rough guesses from what I gathered from the documentation. It seems like the function ACAPI_Element_GetElementsWithClassification might do exactly what you want. Again there's the problem of figuring out what the GUID of the classification item is. My first idea was to use ACAPI_Classification_GetClassificationSystem then ACAPI_Classification_GetClassificationSystemRootItems and recursively iterate on the child items ACAPI_Classification_GetClassificationItemChildren until you get the desired classification item. In case you find an easier way let us know 🙂

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website:

Hi Bernd,

Yes, I had been following the method of getting a set of elements and filter them based on the criteria. I was only curious if I there was any single command available to select elements using a classification-item ID or element ID, like ACAPI_Element_GetElemList() which takes an element-typeID (API_ElemTypeID) as the filter.

So looks like there isn't any.


Thanks for sharing that info!!