We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

[SLVD]Automate Elements selection that are on specific layer

Anonymous
Not applicable
Hi to all AC developer community!
Have one little question - how I can through AC API select all specific Elements (for example: polylines) that are on specific layer (e.g.: Layer name: 2d - polylines).

Thank You in advance!
Dmytro Radomtsev.
2 REPLIES 2
Akos Somorjai
Graphisoft
Graphisoft
DimRad wrote:
Hi to all AC developer community!
Have one little question - how I can through AC API select all specific Elements (for example: polylines) that are on specific layer (e.g.: Layer name: 2d - polylines).

Thank You in advance!
Dmytro Radomtsev.
Hello Dmytro,

First get the attribute index of the "2d - polylines" layer with ACAPI_Attribute_Search().
You'll have to get all polyline elements with ACAPI_Element_GetElemList (), then iterate through the returned array, get each element's header with ACAPI_Element_GetHeader (), and check the 'layer' member of the header. Note that if the rgr_layer of that element is not 0, than the element is coming from a hotlinked module.

This will get you all the polylines on the floor plans; if you need polylines specific to the layouts or drawn directly onto elevations or details, then you have to switch to those databases, and repeat the same procedure.

Best, Akos
Anonymous
Not applicable
Thank You for help, that's work!