is it possible to trigger an Autosave before executing my vb.net-code? I'm rather new to vb.netcode and in case of an unexpexted error AutoCad sometimes crashes. If I Could trigger an auto-save before the code is run, no information in the drawing is lost, but can be obtained in an autosave-file.
I cannot trigger a Save of SaveAs, because i don't know if the user wanted to save the drawing, for examples if the user reads an older drawing, removes/deletes objects etc, but is unaware of the drawing being saved, it could result in problems.
kind regards Wouter
Solved! Go to Solution.
Thanks for you reply,
if I use saveas with a prefix, the active drawing is saved in that location, if the user will save afterwards, thinking that it is saved in the original location, it will actually be saved in de new autosave-directory, which is not an option.
If it is possible to do a save-as with a prefix, and then reset the drawing-name and path to the original drawing & location, it is a solution, but I don't know how to do that,
If you use the SaveAs of the Database ( and not of the document), then the Database is saved without changing the name of the drawing. So the drawing will still be saved under it's old name, if the user pushes the save button.
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.D
ocumentManager.MdiActiveDocument; Autodesk.AutoCAD.DatabaseServices.Database db = doc.Database; string f1 = doc.Name; string f2 = db.Filename; // should be the same then f1 db.SaveAs("D:\\Test.dwg", DwgVersion.Current); //now: // doc.Name is still f1 // but db.Filename is "D:\\Test.dwg"
A save Command from the user will use the doc.Name, not the filename of the db.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register