Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

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.

Hide elements and very slow ACAPI_Element_ChangeParameters

Not applicable
Hello there!

My goal is hiding some elements on floor plan and in 3D-model too. As far is i know Archicad have not any special functions for change visibility of separate element(s).
I tried implement it by changing elements layer index. (Moving elements to new hidden layer with storing original layer index in user data. And restoring original layer index when i need to set elements visible.

// not real code, just for example

	API_Elem_Head** headers = (API_Elem_Head **)BMAllocateHandle(sizeof(API_Elem_Head) * arraySize, ALLOCATE_CLEAR, 0);
	ACAPI_ELEMENT_MASK_SET(mask, API_Elem_Head, layer);
	BNZeroMemory(&element, sizeof(API_Element));
	element.header.typeID = API_WallID;
	element.header.layer = newLayerIndex;

	//... fill headers types and guids

	ACAPI_Element_ChangeParameters(headers, arraySize, &element, nullptr, &mask);

It works OK but function ACAPI_Element_ChangeParameters works very very slow!
For example: for 10 000 elements it takes ~12 minutes! (Intel Core i5 750, 8Gb RAM, NVIDIA 750Ti)
After that result i tried select all walls via Archicad user interface, clicked RBM and change layer there. It took about 8 minutes. Slightly better but still unusable slow.

So i have a question: is there any other way to change visibility (in 2D and 3D) for some elements?

P.S. I had use highlight with turning elements in wireframe form (ACAPI_Interface(APIIo_HighlightElementsID, &hlElems, &wireframe3D) ) - it works very fast and probably can replace layer changing but i need inverse action - turning to wireframe array of elements.
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Andrey,

thank you for reporting this performance issue, we will investigate it.

By using APIIo_HighlightElementsID without passing further parameters you can remove the highlight.
Is that the inverse action are you looking for?
bool wire3D = true;
// Highlight elements:
ACAPI_Interface (APIIo_HighlightElementsID, &hlElems1, &wire3D);
// Remove the highlight:
ACAPI_Interface (APIIo_HighlightElementsID);
// Highlight other elements:
ACAPI_Interface (APIIo_HighlightElementsID, &hlElems2, &wire3D);
Not applicable
What i need:
1) With my addon user can write new special property into any element. The property stores in UserData and particulary in Properies of element.
In one step user can add the property to few elements (from one and up to few thousands).
Usualy user must process all architectural elements in the project.

2) After adding the property to array of elements we need to hide them, becuase user needs to see wich elements remaind for further processing. And processed elements should not obstruct to select unprocessed elements.

3) In any time user must have possibility to show and to hide processed elements. (If their number is few thousands, hiding through changing layer (see first post) takes a lot of time.)

Variant with highlight not convenient, because in that case i need add in array "hlElems" ALL elements of project except processed elements to show processed elements as transparent wireframe.