We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

How to create folder in View Map using ArchiCAD API?

Tran Thanh Lo
Booster

Hello everyone, 

Do you know how to create a folder in View Map ( like the picture below) in ArchiCAD API C++?

Can you help me do it?

Thanks in advance


received_152507851282543.png

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Akos Somorjai
Graphisoft
Graphisoft

Hello there,

 

Please use the partly misleading `ACAPI_Navigator_NewNavigatorView()` function to set the first parameter's `itemType` to `API_FolderNavItem`. In this case, the second parameter (`navigatorView`) is ignored.

 

Best, Akos

View solution in original post

3 REPLIES 3
Solution
Akos Somorjai
Graphisoft
Graphisoft

Hello there,

 

Please use the partly misleading `ACAPI_Navigator_NewNavigatorView()` function to set the first parameter's `itemType` to `API_FolderNavItem`. In this case, the second parameter (`navigatorView`) is ignored.

 

Best, Akos

Hi @Akos Somorjai ,

Thank you very much. I followed your advice and it worked. 

But now can you help me with this?
I have created a folder and also created a view, now I want that view to be in the folder created above.
I do like this but it doesn't work properly. Can you look at it and tell me where I'm wrong.

 

Code here: 

 

//Create Folder
API_NavigatorItem folderItem;
BNZeroMemory(&folderItem, sizeof(API_NavigatorItem));

folderItem.itemType = API_FolderNavItem;
folderItem.mapId = API_PublicViewMap;

GS::ucscpy(folderItem.uName, viewName.ToUStr());

ACAPI_Navigator(APINavigator_NewNavigatorViewID, &folderItem, NULL, NULL);

GS::Guid parentAndChild[2];
parentAndChild[0] = APIGuid2GSGuid(folderItem.guid);// Folder guid
parentAndChild[1] = APIGuid2GSGuid(APINULLGuid);


API_NavigatorItem saveItem;
BNZeroMemory(&saveItem, sizeof(API_NavigatorItem));

saveItem.itemType = API_StoryNavItem;
saveItem.mapId = API_PublicViewMap;
saveItem.floorNum = story.Id;


GS::ucscpy(saveItem.uName, viewName.ToUStr());

saveItem.customName = true;
API_NavigatorView saveView;
BNZeroMemory(&saveView, sizeof(API_NavigatorView));
ACAPI_Navigator(APINavigator_NewNavigatorViewID, &saveItem, &saveView, parentAndChild);//saveItem

Hi @Akos Somorjai ,

Can you help me, please?