Hi,
I need to close drawing file which is inactive. Please guide me how i can achive same.
Regards,
Raman
Yes, you can close drawing which is not current active drawing (not Application.DocumentManager.MdiActiveDocument) easily.
Here is sample code:
public class MyCommands { [CommandMethod("CloseTest")] public static void CloseNonActiveDrawing() { Document dwg = Application.DocumentManager.MdiActiveDocument; Editor ed = dwg.Editor; foreach (Document doc in Application.DocumentManager) { if (doc.Name != dwg.Name) { string fName=System.IO.Path.GetFileName(doc.Name); doc.CloseAndDiscard(); ed.WriteMessage("\nDrawing \"{0}\" has been closed!", fName); break; } } } }
Hi,
Thanks for your respose on this issue.
If i use above code to close the drawing file, all changes are going away.
I want to save the changes with close.
Please guide me
Regards,
Raman
Try to change:
doc.CloseAndDiscard();
with:
doc.CloseAndSave(doc.Name);
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn