.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Event Monitor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Bit of a long shot here, but does anyone know of an application or piece of code which monitors AutoCAD and reports when events are triggered?
I'm looking to see when events are triggered in relation to each other and wonder if anyone else has attempted anything like this in the past?
Many thanks
Re: Event Monitor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Are you talking about watching events internally to AutoCAD or externally from a systems' standpoint?
Re: Event Monitor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Watching events internally to AutoCAD, although if the latter existed i'd have that too ![]()
Re: Event Monitor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Cool... I just didn't want to mention anything that doesn't apply. You can find some things on it here: http://adndevblog.typepad.com/autocad/
After doing a search I found these specifically:
http://adndevblog.typepad.com/autocad/2012/08/mana
http://adndevblog.typepad.com/autocad/2012/05/hand
(there was more so who knows there may be something more specific to what you're looking for. Also, I didn't look at these in any great detail so hopefully their accurate).
Here's something I did some time back in a project where I needed to track a few application-level events... specifically window moved and sized events as well as determining whether or not AutoCAD is quiescent before moving on to a specific process. I've modified it so that you can use it to illustrate in your own project (no command is necessary... just netload and try a few things out in AutoCAD).
using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.Internal.Reactors; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; [assembly: ExtensionApplication(typeof(AutoCADEvents.CADApplicationExtension))] namespace AutoCADEvents { public sealed class CADApplicationExtension : IExtensionApplication { #region IExtensionApplication Interface Implementation To Register/Deregister Events void IExtensionApplication.Initialize() { ApplicationEventManager appEventMgr = ApplicationEventManager.Instance(); appEventMgr.ApplicationMainWindowMoved += new ApplicationMainWindowMovedEventHandler(appEventMgr _ApplicationMainWindowMoved); appEventMgr.ApplicationMainWindowSized += new ApplicationMainWindowSizedEventHandler(appEventMgr _ApplicationMainWindowSized); Application.DocumentManager.DocumentBecameCurrent += new DocumentCollectionEventHandler(DocumentManager_Doc umentBecameCurrent); Application.DocumentManager.DocumentToBeDeactivate d += new DocumentCollectionEventHandler(DocumentManager_Doc umentToBeDeactivated); Application.DocumentManager.DocumentToBeDestroyed += new DocumentCollectionEventHandler(DocumentManager_Doc umentToBeDestroyed); Application.DocumentManager.DocumentDestroyed += new DocumentDestroyedEventHandler(DocumentManager_Docu mentDestroyed); Document activeDoc = Application.DocumentManager.MdiActiveDocument; activeDoc.Editor.EnteringQuiescentState += new EventHandler(ed_EnteringQuiescentState); activeDoc.Editor.LeavingQuiescentState += new EventHandler(ed_LeavingQuiescentState); activeDoc.CommandCancelled += new CommandEventHandler(Document_CommandCancelled); } void IExtensionApplication.Terminate() { Application.DocumentManager.DocumentBecameCurrent -= new DocumentCollectionEventHandler(DocumentManager_Doc umentBecameCurrent); Application.DocumentManager.DocumentToBeDeactivate d -= new DocumentCollectionEventHandler(DocumentManager_Doc umentToBeDeactivated); Application.DocumentManager.DocumentToBeDestroyed -= new DocumentCollectionEventHandler(DocumentManager_Doc umentToBeDestroyed); Application.DocumentManager.DocumentDestroyed -= new DocumentDestroyedEventHandler(DocumentManager_Docu mentDestroyed); } #endregion #region A Couple Window Events void appEventMgr_ApplicationMainWindowSized(object sender, EventArgs e) { try { Editor ed = Application.DocumentManager.MdiActiveDocument.Edit or; ed.WriteMessage("\nAutoCAD's window size just changed.\n"); } catch { } } void appEventMgr_ApplicationMainWindowMoved(object sender, EventArgs e) { try { Editor ed = Application.DocumentManager.MdiActiveDocument.Edit or; ed.WriteMessage("\nAutoCAD's window was just moved.\n"); } catch { } } #endregion #region Some Document Events Used to Determine Application Quiescence In This Example void DocumentManager_DocumentBecameCurrent(object sender, DocumentCollectionEventArgs e) { Editor ed = e.Document.Editor; ed.EnteringQuiescentState += new EventHandler(ed_EnteringQuiescentState); ed.LeavingQuiescentState += new EventHandler(ed_LeavingQuiescentState); e.Document.CommandCancelled += new CommandEventHandler(Document_CommandCancelled); } void DocumentManager_DocumentToBeDeactivated(object sender, DocumentCollectionEventArgs e) { Editor ed = e.Document.Editor; ed.EnteringQuiescentState -= new EventHandler(ed_EnteringQuiescentState); ed.LeavingQuiescentState -= new EventHandler(ed_LeavingQuiescentState); e.Document.CommandCancelled -= new CommandEventHandler(Document_CommandCancelled); } void DocumentManager_DocumentToBeDestroyed(object sender, DocumentCollectionEventArgs e) { Editor ed = e.Document.Editor; ed.EnteringQuiescentState -= new EventHandler(ed_EnteringQuiescentState); ed.LeavingQuiescentState -= new EventHandler(ed_LeavingQuiescentState); e.Document.CommandCancelled -= new CommandEventHandler(Document_CommandCancelled); } void DocumentManager_DocumentDestroyed(object sender, DocumentDestroyedEventArgs e) { //If in Zero-Document state, create new drawing to make active } #endregion #region Event Handlers public static void ed_EnteringQuiescentState(object sender, EventArgs e) { Editor ed = sender as Editor; ed.WriteMessage("\nEntering Quiescence"); } void ed_LeavingQuiescentState(object sender, EventArgs e) { Editor ed = sender as Editor; ed.WriteMessage("\nLeaving Quiescence"); } void Document_CommandCancelled(object sender, CommandEventArgs e) { Editor ed = Application.DocumentManager.MdiActiveDocument.Edit or; ed.WriteMessage("\nA command was just cancelled."); } #endregion } }
Re: Event Monitor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Mgddbg has functionality to print events and some details to command line if you have not looked at that.
