TheSwamp

Code Red => .NET => Topic started by: MarioR on June 10, 2022, 03:59:57 AM

Title: howto catch error message requester on 'database.saveas'?
Post by: MarioR on June 10, 2022, 03:59:57 AM
Hello,

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
Title: Re: howto catch error message requester on 'database.saveas'?
Post by: Bryco 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);
                }
            }