FileDirty

The FileDirty event notifies the client just before a document becomes dirty, i.e. when a change is made to a clean document (a document that was just opened or just saved). Only _Pre is available.
Subsequent changes do not trigger the event, because the document is already dirty. Once the document is saved it is clean again and the next change triggers the event again.
Changing one document can dirty other documents as well (for example referenced documents or parts repositioned in other assemblies); the event is triggered for each of them. The Save tab of the Application Options dialog influences which actions make a document dirty.

EventNames:

  • FileDirty_Pre

Parameters

Type

Name

Description

String

libraryName

If the document is a library part, this argument provides the name of the library as defined in the active project. If it is not a library part this will be an empty string.

Document

document

Input object being dirtied

Remarks:

This event can be aborted by throwing an exception inside the action.
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:

FileDirty_Pre:

Register-InventorEvent -EventName FileDirty_Pre -Action 'PreFileDirty'

function PreFileDirty($libraryName, $document) {
	#Write event code here
}