BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

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

how to get the all elements in a hotlink?

Anonymous
Not applicable
Hi.
In Archicad API,is there a function that gets all element of a hotlink?
I can't seem to find that in the API (sorry, perhaps I'm not looking hard enough)
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

There isn't a function like that, but it's easy to write one:
GS::Array<API_Guid> GetElementsInHotlink (const API_Guid& hotlinkGuid) {
	GS::Array<API_Guid> elementsInHotlink;

	GS::Array<API_Guid> elemList;
	ACAPI_Element_GetElemList (API_ZombieElemID, &elemList);
	for (const API_Guid& elemGuid : elemList) {
		API_Elem_Head elemHead = {};
		elemHead.guid = elemGuid;
		ACAPI_Element_GetHeader (&elemHead);
		if (elemHead.hotlinkGuid == hotlinkGuid)
			elementsInHotlink.Push (elemGuid);
	}

	return elementsInHotlink;
}

View solution in original post

1 REPLY 1
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

There isn't a function like that, but it's easy to write one:
GS::Array<API_Guid> GetElementsInHotlink (const API_Guid& hotlinkGuid) {
	GS::Array<API_Guid> elementsInHotlink;

	GS::Array<API_Guid> elemList;
	ACAPI_Element_GetElemList (API_ZombieElemID, &elemList);
	for (const API_Guid& elemGuid : elemList) {
		API_Elem_Head elemHead = {};
		elemHead.guid = elemGuid;
		ACAPI_Element_GetHeader (&elemHead);
		if (elemHead.hotlinkGuid == hotlinkGuid)
			elementsInHotlink.Push (elemGuid);
	}

	return elementsInHotlink;
}
Learn and get certified!