.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Close & Save

3 REPLIES 3
Reply
Message 1 of 4
Babak
298 Views, 3 Replies

Close & Save

Is there any way to close all opened files (drawing files)?
How can I save a drawing file programmatically?

Thank you,
Babak
3 REPLIES 3
Message 2 of 4
Matt S
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);

}
}
Message 3 of 4
Babak
in reply to: Babak

Thank you very much for your reply.
But what other better way? 😉 I need to save drawing automatically after each changes.

Thank you again,
Babak
Message 4 of 4
NathTay
in reply to: Babak

Using the CloseAndSave method of Autodesk.AutoCAD.ApplicationServices.Document instead of resorting to SendStringToExecute.

Regards - Nathan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost