cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

Why the element guid get from two APIs does not the same?

Newbie
Participant

I am try to compare the element guids get from below 2 difference methods, wondering why it is not the same.

 

method1:
GS::Array<API_Guid> elevationMask{};
GSErrCode err = ACAPI_Element_GetElemList(API_ElevationID, &elevationMask);
 
method2:
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);
}
 
Is there anyone could help?
 
4 REPLIES 4
Erenford
Booster

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

Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
Anonymous
Not applicable

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

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,

Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
Anonymous
Not applicable

Hi,

 

Thanks for the reply. I understand now how this works but still have issues if all items give out DatabaseUnId info or not.