private void closeAndDiscard() { Database dbCurrent = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; DocumentCollection acDocMgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; Document acDoc = acDocMgr.GetDocument(dbCurrent); //acDoc.CloseAndDiscard(); //acDoc.CommandEnded += new CommandEventHandler (AcDoc_CommandEnded); acDoc.SendStringToExecute(@"_close ", true, false, false); //object acadObject = Application.AcadApplication; //object ActiveDocument = acadObject.GetType().InvokeMember("ActiveDocument" // , BindingFlags.GetProperty // , null // , acadObject // , null //); //ActiveDocument.GetType().InvokeMember("close" // , BindingFlags.InvokeMethod // , null // , ActiveDocument // , new object[] { false, string.Empty } //); }
public static void AcEditorWriteMessage(string msg) { Database dbCurrent = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; DocumentCollection acDocMgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; Document acDoc = acDocMgr.GetDocument(dbCurrent); acDoc.Editor.WriteMessage(string.Format(@"{0}{1}", Environment.NewLine, msg)); }
public static void AcEditorDebugCaller(MethodBase methodBase, string message) { Database dbCurrent = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; DocumentCollection acDocMgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; Document acDoc = acDocMgr.GetDocument(dbCurrent); String documentName = acDoc.Name; writeln(String.Format("{0}: Класс.Метод: {1}.{2}; Документ: {3}: {4}", DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss") , methodBase.ReflectedType.Name, methodBase.Name , documentName , message)); }
protected virtual void reinitialize() { Logging.AcEditorDebugCaller(MethodBase.GetCurrentMethod()); Database dbCurrent = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; DocumentCollection acDocMgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; Document acDoc = acDocMgr.GetDocument(dbCurrent); _acCurrentDocumentName = acDoc.Name; iScallingCounter = -1; //AppDomain.CurrentDomain.UnhandledException += ProgramBase.CurrentDomain_UnhandledException; }