Catch AUTO_SAVE before saving the document

Catch AUTO_SAVE before saving the document

joantopo
Mentor Mentor
748 Views
3 Replies
Message 1 of 4

Catch AUTO_SAVE before saving the document

joantopo
Mentor
Mentor

Hi.

 

I need a way to catch the AUTO_SAVE before saving the document to change a bool variable to false due to saving process fires the ObjectModified event always and I have some operations in this last event.

 

Note: CommandWillStart event doesn´t work with "AUTO_SAVE" command.

 

Thanks in advance.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Accepted solutions (1)
749 Views
3 Replies
Replies (3)
Message 2 of 4

Keith.Brown
Advisor
Advisor

Did you try the database.beginsave event?

0 Likes
Message 3 of 4

joantopo
Mentor
Mentor

Yes, right now  I have tried it:

 

   static void callback_BeginSave(object sender, DatabaseIOEventArgs e)
       {
           variables_globales.GuardadoDibujo = true;
       }
       static void callback_SaveComplete(object sender, DatabaseIOEventArgs e)
       {
           variables_globales.GuardadoDibujo = false;
       }

BeginSave event works fine, but the trouble is with SaveComplete event.

 

I have other events such as ObjectErased, ObjectModified and they are fired in the last moment after SaveComplete event, but then my global variable is false and it should be still true.

 

I don´t know where I should change it back in false value again.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

In both events handler, the DatabaseIOEventArgs e.Filename property contains the name of the file being saved, if it's an autosave, the extension should be .sv$

 

Given that, you always know if you're dealing with an autosave or a user save command.