We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2021-09-15 01:03 PM - last edited on 2024-09-26 12:22 PM by Doreena Deng
Hi,
i got a hint to ask in this forum for a solution to store selection sets as .mod files using some sort of code.
Unfortunatly with the Python API it is not possible to do that. But the Idea of a Design Forum memver was to use some sort of C++ Add-on or code to do the trick. But i have no clue of programming in C++ so i would be very greatful for hint where i can start.
Deas anyone have an idea where to start on how i can store several selection sets as seperate .mod files?
Thanks a lot in advance
vr
2021-09-18 02:39 AM
Hi ACAPI_Automate Function can help you.
This's example code
/* save all elements in the current zoom as module file */
IO::Location location ("C:\\temp\\CurrentView.mod");
API_SelectionInfo selectionInfo;
GSErrCode err = NoError;
if (location.GetStatus () == NoError) {
BNZeroMemory (&selectionInfo, sizeof (API_SelectionInfo));
selectionInfo.typeID = API_MarqueeHorBox;
ACAPI_Database (APIDb_GetZoomID, &selectionInfo.marquee.box, nullptr);
err = ACAPI_Selection_SetMarquee (&selectionInfo); /* set the marquee rect to the current zoom */
}
if (err == NoError) {
err = ACAPI_Automate (APIDo_SaveAsModuleFileID, &location, nullptr);
BNZeroMemory (&selectionInfo, sizeof (API_SelectionInfo));
ACAPI_Selection_SetMarquee (&selectionInfo); /* remove the marquee */
}