Author Topic: howto catch error message requester on 'database.saveas'?  (Read 1655 times)

0 Members and 1 Guest are viewing this topic.


  • Newt
  • Posts: 66
howto catch error message requester on 'database.saveas'?
« on: June 10, 2022, 03:59:57 AM »

i have a function that collect dwg entyties by crossing window and create a new document.
On end of function write the file with
Code: [Select]
newDoc.Database.SaveAs(filePathName, DwgVersion.Newest);
This display the "AutoCAD-Message"-box with Message:
"Warning: An error occurred while saving. It is recommended to execute the command RECOVER on the drawing"
(attach the screenshot of requester, sorry is in german ;-))
This same message thows the manuel selection and write with command WBLOCK.

How can i catch this Message on code?

regards Mario
« Last Edit: June 10, 2022, 07:35:08 AM by MarioR »


  • Water Moccasin
  • Posts: 1883
Re: howto catch error message requester on 'database.saveas'?
« Reply #1 on: June 21, 2022, 08:29:09 PM »
I use the following to do that
Code: [Select]
using (doc.LockDocument())
                using (Database dbase = new Database(true, false))
                    dbase.WblockCloneObjects(ids, dbase.CurrentSpaceId, new IdMapping(), DuplicateRecordCloning.Replace, false);
                    dbase.SaveAs(cncDwg, DwgVersion.Current);