OpenDocument
The OpenDocument event notifies the client when a document is opened, either directly by the user (Open command) or indirectly because it is referenced by another document (for example all parts of an assembly are opened together with the assembly). _Pre fires before and _Post after the document is opened.
The event only fires when the document is initially opened. If a file is already loaded because it is referenced by an open assembly, opening it again does not trigger the event.
The order in which this event arrives relative to other events (for example [DocumentChange](<</code_reference/objects/inventor_event_mappings/application_events/documentchange>)) is not guaranteed.
EventNames:
OpenDocument_Pre
OpenDocument_Post
Parameters
Type |
Name |
Description |
|---|---|---|
String |
fullDocumentName |
Output string that specifies the fully qualified name of the document being opened. This is supplied both before and after. |
document |
The Document object being opened. This is only available in the Post event, as in the Pre, this object does not yet exist. |
Examples:
OpenDocument_Pre:
Register-InventorEvent -EventName OpenDocument_Pre -Action 'PreOpenDocument'
function PreOpenDocument($fullDocumentName) {
#Write event code here
}
OpenDocument_Post:
Register-InventorEvent -EventName OpenDocument_Post -Action 'PostOpenDocument'
function PostOpenDocument($fullDocumentName, $document) {
#Write event code here
}