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

Acapi_get_elemlist sometimes return 0 elements??

Anonymous
Not applicable
Hello

I have a really weird bug.
I am using acapi_element_getelemlist. I am trying to get all the elements that has 3D representation and that are on visible layers.
So the command is:
ACAPI_Element_GetElemList(API_ZombieElemID, APIFilt_In3D | API_Filt_OnVisLayer);

Sometimes my elemlist gets 0 items! When of course my scene is full of elements!
I didn’t yet realize why this is happening but I think it happens when calling this command after the user created a new layout, or calling this command after the file was opened (before doing anything to the scene)

This is really weird.

Thanks in advance!
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Ralph Wessel
Mentor
Try making the floor plan database active with APIDb_ChangeCurrentDatabaseID first, and then try ACAPI_Element_GetElemList.
Ralph Wessel BArch
Software Engineer Speckle Systems

View solution in original post

4 REPLIES 4
Ralph Wessel
Mentor
What kind of view is active when you call ACAPI_Element_GetElemList, e.g. floor plan, section, 3D?
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Ralph wrote:
What kind of view is active when you call ACAPI_Element_GetElemList, e.g. floor plan, section, 3D?
Hmm, on most tests I was on layout view.
Solution
Ralph Wessel
Mentor
Try making the floor plan database active with APIDb_ChangeCurrentDatabaseID first, and then try ACAPI_Element_GetElemList.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Ralph wrote:
Try making the floor plan database active with APIDb_ChangeCurrentDatabaseID first, and then try ACAPI_Element_GetElemList.
Thanks. It’s weird that this function works just in this type of active dB..
At least that solves it