We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2021-09-08 06:22 PM - last edited on 2021-09-14 08:29 AM by Noemi Balogh
Hi
I am trying to modify a selection set, based on a list of guids, by looping through the guid-list and calling the following function for each guid:
void MyPalette::ModifySelection(const GS::UniString& elemGuidStr)
{
ACAPI_Element_Select({ API_Neig(APIGuidFromString(elemGuidStr.ToCStr().Get())) }, false);
}
It does work, but the problem is it is taking a substantially long time (around 2 min) for a large selection set (around 1900). The same no. of elements gets selected (mouse interaction) in just about a second and a list of selected elements gets generated (though not using ACAPI_Element_Select() , but ACAPI_Selection_Get() ).
Also the selection happens almost instantly for the same no. of elements with 'Find & Select' (filter: element type 'slab'). Why does it take so long to filter an existing selection set using ACAPI_Element_Select() ?
Which method should we use to select elements of, say, a particular type (slab, wall, etc.) ?
Solved! Go to Solution.
2021-09-09 12:06 PM
Hi, please try to collect the elements to be selected in an array and call ACAPI_Element_Select for multiple elements. The code may be rearranged somehow to achieve this.
Please see the docs/example here:
https://archicadapi.graphisoft.com/documentation/acapi_element_select
2021-09-09 12:06 PM
Hi, please try to collect the elements to be selected in an array and call ACAPI_Element_Select for multiple elements. The code may be rearranged somehow to achieve this.
Please see the docs/example here:
https://archicadapi.graphisoft.com/documentation/acapi_element_select
2021-09-09 12:38 PM
You were absolutely right @Miklos Vegh !!
It was the huge number of calls to ACAPI_Element_Select(). I was not aware that this function accepted an array of Neigs. I had seen an example which was taking a 'guid' and converting it to 'neig' .. and I kept using it without paying attention to the { } around it 🙂 ... My bad..
Thanks a lot again !!