CloseDocument
The CloseDocument event notifies the client when a document is closed. _Pre fires before and _Post after the document is closed.
The event is only triggered when the document is really closed. A document that is still referenced by another open document (for example a part of an open assembly) is not closed and therefore does not trigger the event.
EventNames:
CloseDocument_Pre
CloseDocument_Post
Parameters
Type |
Name |
Description |
|---|---|---|
document |
Object that is being closed. The document being closed is provided before and after. The document is still available after it’s closed, although in a limited sense. |
Remarks:
This event can be aborted by throwing an exception inside the action, but only if it is registered with the _Pre suffix.
Throwing an OperationCanceledException aborts the operation without any message.
Throwing any other exception aborts the operation and displays the thrown exception in an Error Message Box.
Examples:
CloseDocument_Pre:
Register-InventorEvent -EventName CloseDocument_Pre -Action 'PreCloseDocument'
function PreCloseDocument($document) {
#Write event code here
}
CloseDocument_Post:
Register-InventorEvent -EventName CloseDocument_Post -Action 'PostCloseDocument'
function PostCloseDocument($document) {
#Write event code here
}