SOLVED!
Problems retrieving 3D objects
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-18
07:43 AM
- last edited on
2022-10-04
04:39 PM
by
Daniel Kassai
2019-02-18
07:43 AM
Hey everyone,
i implemented a KD-Tree structure in an Archicad 21 Addon to sort all the 3D elements in the 3D-model. But im having a little trouble feeding the right information to it:
As far as i have seen from the example there are basically two ways i could do it.
1. via ACAPI_Element_GetElemList and using the ACAPI_Element_Get3DInfo which is nice since it allready provides bounding box information for example.
Problems: The APIFilt_In3D doesn't work for API_ZombieElemID elements. So i used all the relevant types like API_WallID and so on. But even there the APIFilt_In3D seemes to not work correctly since when i use it instead of the normal APIFilt_None no elements are returned. With the APIFilt_None i get the elements i want plus some additional elements that don't appear in 3D in the test scene so i guess they aren't in 3D. Am i using APIFilt_In3D wrong?
example code:
2. via the body IDs as descibed in the 3D_Test example and the ACAPI_3D_GetComponent
Problem: I don't know how to get the get the link back to the Archicad elements (for example API_GUID objects) from the 3D components.
So my question baiscally is how to link the information from the API_Element to the 3D components in both ways. From API_Element to the 3D_component seems to work over the ACAPI_Element_Get3DInfo since it has the first and last component stored but is there a way to do it the other way arround too?
I would very much appreciate any help with this!
Edit: The additional elements of type API_ObjectID describe in 1. seem to be labels of the windows.
i implemented a KD-Tree structure in an Archicad 21 Addon to sort all the 3D elements in the 3D-model. But im having a little trouble feeding the right information to it:
As far as i have seen from the example there are basically two ways i could do it.
1. via ACAPI_Element_GetElemList and using the ACAPI_Element_Get3DInfo which is nice since it allready provides bounding box information for example.
Problems: The APIFilt_In3D doesn't work for API_ZombieElemID elements. So i used all the relevant types like API_WallID and so on. But even there the APIFilt_In3D seemes to not work correctly since when i use it instead of the normal APIFilt_None no elements are returned. With the APIFilt_None i get the elements i want plus some additional elements that don't appear in 3D in the test scene so i guess they aren't in 3D. Am i using APIFilt_In3D wrong?
example code:
GS::Array<API_Guid> elemGuids; // store all the 3D element types in an array GS::Array<API_ElemTypeID> types = {API_WallID, API_ColumnID, API_BeamID, API_WindowID, API_DoorID, API_ObjectID, API_LampID, API_SlabID, API_RoofID, API_MeshID, API_ShellID, API_CurtainWallID, API_MorphID}; //push all 3d elements from all types to elemGuids array for (int i=0; i<types.GetSize();i++){ WriteReport("Type %i", types); GS::Array<API_Guid> temp_elems; ACAPI_Element_GetElemList(types, &temp_elems, APIFilt_In3D); WriteReport("Number of objects %i" , temp_elems.GetSize()); for (int j=0; j<temp_elems.GetSize();j++){ elemGuids.Push(temp_elems); } }
2. via the body IDs as descibed in the 3D_Test example and the ACAPI_3D_GetComponent
Problem: I don't know how to get the get the link back to the Archicad elements (for example API_GUID objects) from the 3D components.
So my question baiscally is how to link the information from the API_Element to the 3D components in both ways. From API_Element to the 3D_component seems to work over the ACAPI_Element_Get3DInfo since it has the first and last component stored but is there a way to do it the other way arround too?
I would very much appreciate any help with this!
Edit: The additional elements of type API_ObjectID describe in 1. seem to be labels of the windows.
Solved! Go to Solution.
Labels:
- Labels:
-
Add-On (C++)
1 ACCEPTED SOLUTION
Accepted Solutions
Solution

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-18 12:09 PM
2019-02-18
12:09 PM
Hello,
I recommend using your first choice.
I've managed to reproduce the issue you have. Currently, you need to have an open 3D tab, where the elements you want to work with are visible. In my case, with only the floor plan opened, I also got zero results, but after opening the general perspective view, the function managed to find all visible 3D elements.
Beware, elements on a hidden layer are not considered visible.
I'll file a ticket with this issue right away.
Best regards,
Dénes
I recommend using your first choice.
I've managed to reproduce the issue you have. Currently, you need to have an open 3D tab, where the elements you want to work with are visible. In my case, with only the floor plan opened, I also got zero results, but after opening the general perspective view, the function managed to find all visible 3D elements.
Beware, elements on a hidden layer are not considered visible.
I'll file a ticket with this issue right away.
Best regards,
Dénes
3 REPLIES 3
Solution

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-18 12:09 PM
2019-02-18
12:09 PM
Hello,
I recommend using your first choice.
I've managed to reproduce the issue you have. Currently, you need to have an open 3D tab, where the elements you want to work with are visible. In my case, with only the floor plan opened, I also got zero results, but after opening the general perspective view, the function managed to find all visible 3D elements.
Beware, elements on a hidden layer are not considered visible.
I'll file a ticket with this issue right away.
Best regards,
Dénes
I recommend using your first choice.
I've managed to reproduce the issue you have. Currently, you need to have an open 3D tab, where the elements you want to work with are visible. In my case, with only the floor plan opened, I also got zero results, but after opening the general perspective view, the function managed to find all visible 3D elements.
Beware, elements on a hidden layer are not considered visible.
I'll file a ticket with this issue right away.
Best regards,
Dénes
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-18 04:57 PM
2019-02-18
04:57 PM
Hey Dénes, thanks for the information on the topic! This helped me solve my issues.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-02-18 05:00 PM
2019-02-18
05:00 PM
We use one of 2 paths depending on the context:
1)ACAPI_Element_Get3DInfo : When we're iterating through elements that aren't necessarily already in a 3D view but need 3D body info.
2)ModelerAPI : When we're iterating through elements in a 3D scene using, for example, ModelerAPI::Model::GetElement . This gets also gets all the relevant body info and appears to have a method to get the original element guid, i.e. ModelerAPI::Element::GetElemGuid (but we don't currently use it).
1)
2)
Ralph Wessel BArch
Central Innovation
Central Innovation