© 2010 Autodesk
Introduction to Revit 2011 API
Events
What’s new in 2011
§No longer automatic open transactions with events
§
§Deprecated the Pre-Revit 2010 events
§Application.OnDocumentSaved
§Application.OnDocumentSavedAs
§Application.OnDocumentOpened
§Application.OnDocumentClosed
§Application.OnDocumentNewed
§Application.OnDialogBox
§Document.OnSaveAs
§Document.OnSave
§Document.OnClose
§
§
§
§
All events have been changed to no longer automatically open transactions like they originally did in earlier releases. As a result of this new policy, the document will not be modified during an event unless one of the event’s handlers modifies it by making changes inside a transaction. A transaction may be opened by either the event handler if there is no transaction already opened (sometimes when the event is invoked, there is already a transaction open). If an event handler opens a transaction it is required that it will also close it (commit it or roll it back), otherwise all eventual changes will be discarded.
Please be aware that modifying the active document is not permitted during some events (e.g. the DocumentClosing event). If an event handler attempts to make modifications during such an event, an exception will be thrown. The event documentation indicates whether or not the event is read-only.