.NET

Reply
Active Member
Babak
Posts: 8
Registered: ‎10-12-2006
Message 1 of 4 (151 Views)

Close & Save

151 Views, 3 Replies
01-04-2007 04:02 AM
Is there any way to close all opened files (drawing files)?
How can I save a drawing file programmatically?

Thank you,
Babak
Valued Contributor
Matt S
Posts: 64
Registered: ‎05-05-2004
Message 2 of 4 (151 Views)

Re: Close & Save

01-05-2007 12:50 PM in reply to: Babak
Below is a way to iterate through all open drawings and save, close and do other things. There has to be a better way to do this, but this was the easiest at the time.

[CommandMethod("DwgScale10", CommandFlags.Session)]
public void sveDwgScale10()
{
int i = 0;
Document curDoc;
DocumentCollection docCol;
docCol = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;

foreach (Document doc in docCol)
{
docCol.MdiActiveDocument = doc;
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

doc.SendStringToExecute("scale all 0,0,0 10.0 ", false, false, true);
doc.SendStringToExecute("zoom e ", false, false, true);
doc.SendStringToExecute("qsave ", false, false, true);
doc.SendStringToExecute("close ", false, false, false);

}
}
Active Member
Babak
Posts: 8
Registered: ‎10-12-2006
Message 3 of 4 (151 Views)

Re: Close & Save

01-06-2007 08:22 AM in reply to: Babak
Thank you very much for your reply.
But what other better way? :smileywink: I need to save drawing automatically after each changes.

Thank you again,
Babak
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 4 of 4 (151 Views)

Re: Close & Save

01-07-2007 02:03 PM in reply to: Babak
Using the CloseAndSave method of Autodesk.AutoCAD.ApplicationServices.Document instead of resorting to SendStringToExecute.

Regards - Nathan
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.