File Access Events

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
}

The FileResolution event notifies the client whenever Inventor needs to find the location of a file on disk (file resolution), for example for each referenced document when an assembly is opened. The event is sent before Inventor starts its standard resolution, so a custom full file name can be supplied instead. Only _Pre is available.

EventNames:

  • FileResolution_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.

String

relativeFileName

The relative filename of the document. This is typically just the filename but may also include relative path information. Inventor uses this in combination with the paths defined by the active project to resolve the location of the file.

Examples:

FileResolution_Pre:

Register-InventorEvent -EventName FileResolution_Pre -Action 'PreFileResolution'

function PreFileResolution($libraryName, $relativeFileName) {
	#Write event code here
}