Revit 2025 API
ApplicationDocument |
Subscribe to the DocumentCreating event to be notified when Revit is just about to create a new document.
Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public event EventHandler<DocumentCreatingEventArgs> DocumentCreating
Public Event DocumentCreating As EventHandler(Of DocumentCreatingEventArgs)
public: event EventHandler<DocumentCreatingEventArgs^>^ DocumentCreating { void add (EventHandler<DocumentCreatingEventArgs^>^ value); void remove (EventHandler<DocumentCreatingEventArgs^>^ value); }
member DocumentCreating : IEvent<EventHandler<DocumentCreatingEventArgs>, DocumentCreatingEventArgs>
Value
EventHandlerDocumentCreatingEventArgs
This event is raised when Revit is just about to create a new document.
Event is cancellable. To cancel it, call the 'Cancel()' method of event's argument to True. Your application is responsible for providing feedback to the user about the reason for the cancellation.
The document cannot be modified, for it is not created yet at the time of the event.
The following API functions are not available for the current document during this event:
- [!:Autodesk::Revit::ApplicationServices::Application::NewProjectDocument()]
- NewFamilyDocument(String)
- NewProjectTemplateDocument(String)
- OpenDocumentFile(String) and similar overloads.
Exception InvalidOperationException will be thrown if any of the above methods is called during this event.
Another DocumentCreated event will be raised immediately after document creation is finished.
See Also