BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.

How to Set "Undo/Redo" by API code?

Anonymous
Not applicable
How to Set Undo/Redo by API code?....Thank u.
3 REPLIES 3
Ralph Wessel
Mentor
Traro wrote:
How to Set Undo/Redo by API code?....Thank u.
Call ACAPI_OpenUndoableSession to start the session and ACAPI_CloseUndoableSession to end it. These functions are mandatory if you need to make changes to the project data.
Ralph Wessel BArch
Anonymous
Not applicable
Ralph wrote:
Traro wrote:
How to Set Undo/Redo by API code?....Thank u.
Call ACAPI_OpenUndoableSession to start the session and ACAPI_CloseUndoableSession to end it. These functions are mandatory if you need to make changes to the project data.

thank u., but After I call

GSErrCode err;

err = ACAPI_OpenUndoableSession ("Element Test1");
//to make changes to the project data
ACAPI_CloseUndoableSession();

err = ACAPI_OpenUndoableSession ("Element Test2");
//to make changes to the project data
ACAPI_CloseUndoableSession();

err = ACAPI_OpenUndoableSession ("Element Test3");
//to make changes to the project data
ACAPI_CloseUndoableSession();



and, while I want to run back to session("Element Test2").
What can I do with API Function?
Ralph Wessel
Mentor
Traro wrote:
thank u., but After I call
err = ACAPI_OpenUndoableSession ("Element Test1");
err = ACAPI_OpenUndoableSession ("Element Test2");
err = ACAPI_OpenUndoableSession ("Element Test3");
and, while I want to run back to session("Element Test2").
What can I do with API Function?
The 'undo' mechanisms are purely for the user's benefit, so the user could roll back 'test 2' by selecting Edit > Undo twice. I'm not aware of any way to do this through the API (other than keeping your own transaction log and rolling back as required).
Ralph Wessel BArch
Learn and get certified!