We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-08-10 01:31 PM - last edited on 2023-08-10 03:07 PM by Laszlo Nagy
I am try to compare the element guids get from below 2 difference methods, wondering why it is not the same.
GS::Array<API_Guid> elevationMask{};
GSErrCode err = ACAPI_Element_GetElemList(API_ElevationID, &elevationMask);
GS::Array<API_NavigatorItem> items;
API_NavigatorItem item = {};
item.guid = NavigatorSet.rootGuid;
item.mapId = NavigatorPaletteTestGlobals::GetInstance().GetNavigatorMapID();
GSErrCode err = ACAPI_Navigator(APINavigator_GetNavigatorChildrenItemsID, &item, nullptr, &items);
for (API_NavigatorItem& childItem : items) {
ACAPI_WriteReport(APIGuidToString(childItem.guid).ToCStr().Get(),false);
}
2023-08-14 07:18 AM
ACAPI_Element_*** APIs refer to the specific element instances in the model, in this case the elevation marker. Marker elements also have a corresponding database which refers to its view.
While ACAPI_Navigator APIs exclusively refer to the navigator items in the treeview Navigator palette.
If you want to see which navigator item corresponds your element instance then you compare the element's DatabaseUnId to the navigator DatabaseUnId (API_NavigatorItem.db.databaseUnId)
Or you check the "linkedElement" in the Navigator item (API_NavigatorItem.db.linkedElement)
If its empty/null try getting the database first (APIDb_GetDatabaseInfoID), getting the API_NavigatorItem usually doesn't fill up the whole database structure, only the unId
2023-08-30 10:37 AM
Hi Erenford,
As you've mentioned to compare element's DatabaseUnId to the navigator DatabaseUnId (API_NavigatorItem.db.databaseUnId), I'm having trouble getting DatabaseUnId of an element. It is not a listed property.
Could you please explain how to get the DatabaseUnId of an element?
Thanks
2023-08-30 11:05 AM
the variable name is databaseID, on elevation/section its in
API_Element -> cutPlane / elevation -> segment -> databaseID
If its a detail/worksheet marker its
API_Element -> detail / worksheet -> databaseID
If its an interior elevation then its also on API_SectionSegment but on element memo, as the one on the element is only the default settings of the child segments
// first get the array count
API_Element -> interiorElevation -> nLineCoords
// access the memo
API_ElementMemo -> *intElevSegments (pointer array) -> databaseID
I'm assuming you already know this only works on marker elements, since those are the only elements with views and databases, and will appear on the navigator. If there's any other element I forgot, just try to find something that is of type API_DatabaseUnID or named databaseID.
Regards,
2023-08-31 07:25 AM
Hi,
Thanks for the reply. I understand now how this works but still have issues if all items give out DatabaseUnId info or not.