2018-06-25
05:15 AM
- last edited on
2022-12-06
01:31 PM
by
Daniel Kassai
// it->first is the UUID string of the element
std::map<std::string, CrsElement*>::iterator it = MapOfElements.begin();
for (; it != MapOfElements.end(); ++it) {
API_Elem_Head element_head;
BNZeroMemory(&element_head, sizeof(API_Elem_Head));
element_head.guid = APIGuidFromString(it->first.c_str());
err = ACAPI_Element_GetHeader(&element_head);
API_Attribute layer;
BNZeroMemory(&layer, sizeof(API_Attribute));
layer.header.typeID = API_LayerID;
layer.header.index = element_head.layer;
ACAPI_Attribute_Get(&layer);
if (!(layer.header.flags & APILay_Locked)) {
ACAPI_Element_AttachObserver(&element_head, 0);
}
}
The problem is that it appears to take about 0.02 seconds to call ACAPI_Element_AttachObserver for each object. This becomes very problematic when we have 16,000 elements to observe (which is not uncommon) since it takes over 5 minutes to attach and Archicad is locked up during the process. I've verified that the time spent is inside ACAPI_Element_AttachObserver since if I lock every layer the process completes very quickly.2018-06-25 04:13 PM
2018-06-26 06:51 AM
2018-06-26 10:07 AM
2021-08-06 11:25 PM