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:
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.