How to get the navigator main tree name?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2014-02-05
06:49 AM
- last edited on
2023-08-01
04:35 PM
by
Doreena Deng
2014-02-05
06:49 AM
[See attached file.]
I can get this name by calling ACAPI_Environment(APIEnv_GetProjectNotesID) and use the value of projectName. When this is empty, I call ACAPI_Environment(APIEnv_ProjectID) and check the untitled flag: if true, I set the tree name to 'Untitled'; if false, I use the project file name (proj_info.location->GetLastLocalName()). This is true for PLN file.
But when I started from an existing PLA file and follows the steps above the add-on fails. This is because the untitled flag is true and the tree name is set to the PLA file name. Also since it is flagged as untitled, the location value is empty.
Is there any other way on getting this name without calling/getting it from the navigator?
I can get this name by calling ACAPI_Environment(APIEnv_GetProjectNotesID) and use the value of projectName. When this is empty, I call ACAPI_Environment(APIEnv_ProjectID) and check the untitled flag: if true, I set the tree name to 'Untitled'; if false, I use the project file name (proj_info.location->GetLastLocalName()). This is true for PLN file.
But when I started from an existing PLA file and follows the steps above the add-on fails. This is because the untitled flag is true and the tree name is set to the PLA file name. Also since it is flagged as untitled, the location value is empty.
Is there any other way on getting this name without calling/getting it from the navigator?
~ReignBough~
ARCHICAD 27 INT (since AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
ARCHICAD 27 INT (since AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
Labels:
- Labels:
-
Add-On (C++)
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2014-02-05 10:35 AM
2014-02-05
10:35 AM
ReignBough wrote:
Is there any other way on getting this name without calling/getting it from the navigator?
Why don't you want to get it from the navigator?
I would use this code to get that:
API_NavigatorSet set; BNZeroMemory (&set, sizeof (API_NavigatorSet)); set.mapId = API_ProjectMap; GSErrCode err = ACAPI_Environment (APIEnv_GetNavigatorSetID, &set, NULL); if (err == NoError) { char buffer[256]; sprintf (buffer, "Project name: %s", set.name); ACAPI_WriteReport (buffer, true); // to check root item's name API_NavigatorItem navItem; BNZeroMemory (&navItem, sizeof (API_NavigatorItem)); navItem.mapId = API_ProjectMap; err = ACAPI_Environment (APIEnv_GetNavigatorItemID, &set.rootGuid, &navItem); if (err == NoError) { sprintf (buffer, "Root navigator item name: %s", navItem.name); ACAPI_WriteReport (buffer, true); } }
Regards,
Tibor