We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-11-08 11:09 AM - last edited on 2024-09-16 02:38 PM by Doreena Deng
Hello
I create several elements using the ACAPI_Element_Create function in a "for" loop. After that, I'm trying to undo it (using ctrl+z) and right now it undo each element one by one (For example, if I create ten elements in my function and I want to undo it, I have to press ctrl+z ten times).
I'm wondering if there is a way so I can ctrl+z all the elements that I just created all together by using ctrl+z ONE time?
I did try to use the ACAPI_Database_StartClippingSession() function before the "for" loop and then use the ACAPI_Database_StopClippingSession() function at the end of the "for" loop, but it didn't work for me
Windows 11, Visual Studio 2022, ArchiCAD 27, C++
Solved! Go to Solution.
2023-11-08 11:18 AM - edited 2023-11-08 11:20 AM
When you do modifications in Archicad you always need to wrap your changes in a ACAPI_CallUndoableCommand call. Everything happens inside the call will be undo-ed in one step.
The code should be something like this:
ACAPI_CallUndoableCommand ("Create Walls", [&] () -> GSErrCode {
// create as many walls as you need
return NoError;
});
2023-11-08 11:18 AM - edited 2023-11-08 11:20 AM
When you do modifications in Archicad you always need to wrap your changes in a ACAPI_CallUndoableCommand call. Everything happens inside the call will be undo-ed in one step.
The code should be something like this:
ACAPI_CallUndoableCommand ("Create Walls", [&] () -> GSErrCode {
// create as many walls as you need
return NoError;
});