License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Modifying selection-set using a list of guids

dushyant
Enthusiast

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.) ?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Miklos Vegh
Graphisoft
Graphisoft

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

View solution in original post

2 REPLIES 2
Solution
Miklos Vegh
Graphisoft
Graphisoft

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

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 !!