SaveDocument
The SaveDocument event notifies the client whenever a document is saved with the Save or the Save Copy As command. _Pre fires before and _Post after the document is saved.
When an assembly is saved, its dependent documents can be saved as well; the event is also triggered for each of them.
EventNames:
SaveDocument_Pre
SaveDocument_Post
Parameters
Type |
Name |
Description |
|---|---|---|
document |
Object that is being saved. |
Remarks:
The notification is made when the standard Save and the Save Copy As commands are invoked. When assemblies are saved this can also cause the dependent documents to be saved and this event is also fired in those cases.
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:
SaveDocument_Pre:
Register-InventorEvent -EventName SaveDocument_Pre -Action 'PreSaveDocument'
function PreSaveDocument($document) {
#Write event code here
}
SaveDocument_Post:
Register-InventorEvent -EventName SaveDocument_Post -Action 'PostSaveDocument'
function PostSaveDocument($document) {
#Write event code here
}