cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

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