I have a little problem, I am working with visual studio 2010 and autocad 2013, when I make a new command that save the current work(.dwg), I must use Save.As(....) because the Save() function doesnt work. When I use the SaveAs(..) method, the file is saved correcty in the path(C:\temp, for example),but (here is the problem) the current .dwg that I have in autocad is named "drawing1.dwg",and I will that when I "SaveAs()" a file, the file that shows autocad is the saved file(the new name of the file must appear in the title of the autocad document)... I know its hard to explain...
I have attached 3 picture to try to explain it better
Thank you very much.
Solved! Go to Solution.
Instead of doing a "SaveAs", you could do a "WBlock":
Database newDB = HostApplicationServices.WorkingDatabase.Wblock();
"drawing1.dwg" is still the active document, in order to work with newly created "c:/temp/test.dwg" you can open it with:
Can you show us part of your code, what's the reason that Document.Save() method does not work?
The save method is only for use in RealDWG applications - it will not work in AutoCAD.
There are three Database.SaveAs() methods. If you use this one:
and pass in true for the bool second argument, then it should change the name of the document in the Acad titlebar.
Thanks for the answears!, but it doesnt works... if I try to open the saved file it throws an exception (attached picture). When I try the saveAs method with the 4 parameters the compiler says that is an obsolete method. I am working with autocad 2013 and visual studio 2010.
Guardar guardar;[CommandMethod("SaveAsEsquema", CommandFlags.Session)]
public void SaveActiveDrawing()
guardar =new Guardar();
privatevoid bt_Click(object sender, EventArgs e)
Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.D
Database db = acDoc.Database;
string path = "C:\\Trabajo\\DWG\\TEST.dwg";
object obj = Autodesk.AutoCAD.ApplicationServices.Application.G
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register