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

Getting list of elements touching/covering an element

dushyant
Enthusiast

Hi, Is there a way to get a list of elements touching/covering an element? Like there's a wall which has a slab below it touching it - is it possible to know that for any given element?

Thanks.

5 REPLIES 5

Hi!

I haven't tested it but this might do what you want: https://archicadapi.Graphisoft.com/documentation/acapi_element_getcollisions

There's also https://archicadapi.Graphisoft.com/documentation/acapi_element_getrelations but that's mostly used for Zone <-> Element relations and "Element <-> Element of same type" of same type relations.

dushyant
Enthusiast

Hi Bernd, thanks. So with this we need to know both the groups - that is, what we want to check the collision with. And I don't know that in my case. I just have an element which I want to check if it is colliding with anything else. Does that mean all the rest of the elements in the model have to be provided as group no.2 and have it run the check for collision? I was wondering if the API had something more economical. Thanks for these references though!

Yes I think you would need to provide all other elements. Unfortunately I'm not aware of anything else. Maybe you could do some "pre-filtering" by e.g. story, layer, type, etc. depending on what you need. Also it might be that the collision detection is already implemented efficiently and passing "all ellements" isn't to time consuming. Let us know if you run it on a big example how efficient it is! 😉

dushyant
Enthusiast

I used ACAPI_Element_GetSurfaceQuantities() and for the covered parts, I provided all the elements. Yes it is slower.

I feel there should be a way for an element to detect which other elements are protruding into or touching its geometry..

Thanks for reporting back your findings! It's unfortunate that it's that slow. Did you also try it in release mode? Sometimes debug builds are a lot slower with certain operations.
Otherwise I'm out of ideas unfortunately.