FileInsertNewDialog

The FileInsertNewDialog event notifies the client whenever the user executes the Create Component command within an assembly. The event fires immediately after the command is executed, but before Inventor displays the standard Create In-Place Component dialog.

EventNames:

  • FileInsertNewDialog_Pre

Parameters

Type

Name

Description

String

templateDirectory

The default template directory as defined in the File tab of the Application Options dialog

ResultParameters

result

Object used to supply the result of the operation. See below.

Document

document

The document object the new component will be created within

Result properties:

Type

Name

Description

String

FileName

The file name to use.

String

DirectoryPath

The directory where the file that should be inserted is in.

String

FullFileName

The full file name of the file, can be used to check that the fileName set is correct.

String

TemplateFileName

The filename of the file to use as the template when creating the new component.

String

TemplateDirectoryPath

The directory of the file to use as the template when creating the new component.

String

TemplateFullFileName

The full file name of the template file, can be used to check that the fileName set is correct

Remarks:

To change the default behavior of Inventor you need to set both the FileName and DirectoryPath to the result variable, if none are set, the behavior will stay the same.
If the TemplateFileName is not set the default template will be used. To set the Template file name you will need to set both the TemplateFileName and TemplateDirectoryPath properties.

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:

FileInsertNewDialog_Pre:

Register-InventorEvent -EventName FileInsertNewDialog_Pre -Action 'PreFileInsertNewDialog'

function PreFileInsertNewDialog($templateDirectory, $result, $document) {
	#Write event code here
	$result.FileName = "12345.ipt"
	$result.DirectoryPath = "C:\Vault"
	$result.FullFileName #Returns the FullFileName e.g "C:\Vault\12345.ipt", cannot be set.
	$result.TemplateFileName = "template.ipt"
	$result.TemplateDirectoryPath = "C:\Templates"
	$result.TemplateFullFileName #Returns the TemplateFullFileName e.g "C:\Templates\template.ipt", cannot be set.
}