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

Layout ID, bug?

ReignBough
Enthusiast
I created a subset with the following ID settings (using API):
subset.customNumbering = true;
subset.useUpperPrefix = false;
subset.addOwnPrefix = false;
subset.numberingStyle = API_NS_noID;
Then, I created a layout with API_DatabaseInfo->ref set to "Cust002".
db_info.typeID = APIWind_LayoutID;
swprintf(db_info.ref, L"Cust002");
swprintf(db_info.name, L"Test Layout");
db_info.masterLayoutUnId = iMasterLayout;
err = ACAPI_Database(APIDb_NewDatabaseID, &db_info, &parent);
But when the layout was created, the ID is empty. Also in Layout Settings dialog, 'Use Automatic Book and Subset ID assignment' is checked and 'Custom ID' is unchecked.

Is this a bug? If not, is there another way to set the ID (custom ID) without going to navigator item?

Thanks.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
1 REPLY 1
ReignBough
Enthusiast
I did the following while waiting for a reply:
API_NavigatorItem new_item;
BNZeroMemory(&new_item, sizeof(API_NavigatorItem));
new_item.mapId = mItemData.mapId;
API_Guid guid = item.guid;
mErr = ACAPI_Environment(APIEnv_GetNavigatorItemID, &guid, &new_item); errln = __LINE__;
if (mErr != NoError) { /* error handle */ }

API_DatabaseUnId db_unid = item.db.databaseUnId;
API_LayoutInfo layout_info;
mErr = ACAPI_Environment(APIEnv_GetLayoutSetsID, &layout_info, &db_unid);
if (mErr != NoError) { /* error handle */ }
layout_info.customLayoutNumbering = true;
sprintf(layout_info.customLayoutNumber, iUiid);

mErr = ACAPI_Environment(APIEnv_ChangeLayoutSetsID, &layout_info, &db_unid); errln = __LINE__;
if (mErr != NoError) { /* error handle */ }
This will modify the uiid of the layout.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS