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

Archicad Python API
About automating tasks in Archicad using the Python API.

store selection sets as .mod

vr
Participant

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

1 REPLY 1
leilei
Enthusiast

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 */
}

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!