FileUI Events
The FileInsertDialog event notifies the client whenever the user executes a command for the selection and insertion of a document into another document.
Remarks
Three common commands are the Place Component command in assembly, the Derived Component command in part, and the Base View command in drawing.
By using this event and setting a fileName and directoryPath to the result variable, the user can replace the default inventor behavior, normally used to replace the Inventor dialog with their own dialog.
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.
EventNames:
FileInsertDialog_Pre
Parameters
Type |
Name |
Description |
|---|---|---|
ResultParameters |
result |
Object used to supply the result of the operation. See below. |
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 that will be used. Can be used to check that the set file name is correct. |
Examples:
FileInsertDialog_Pre:
Register-InventorEvent -EventName FileInsertDialog_Pre -Action 'PreFileInsertDialog'
function PreFileInsertDialog($result) {
#Write event code here
$result.FileName = "12345.ipt"
$result.DirectoryPath = "C:\\Vault"
$result.FullFileName # C:\\Vault\12345.ipt
}
The FileInsertNewDialog event notifies the client whenever the user executes the Create Component command within an assembly.
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.
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. |
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 |
Examples:
FileInsertNewDialog_Pre:
Register-InventorEvent -EventName FileInsertNewDialog_Pre -Action 'PreFileInsertNewDialog'
function PreFileInsertNewDialog($templateDirectory, $result) {
#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.
}
The FileNew fires before a File New from standard template is executed.
EventNames:
FileNew_Pre
Parameters
Type |
Name |
Description |
|---|---|---|
documentType |
DocumentTypeEnum indicating the document type |
Examples:
FileNew_Pre:
Register-InventorEvent -EventName FileNew_Pre -Action 'PreFileNew'
function PreFileNew($documentType) {
#Write event code here
}
The FileNewDialog event notifies the client when the end user executes the New or Create Drawing View command to create a new file.
Remarks
If the end-user uses the pop-up command list next to the New command to select an assembly, part, presentation, or drawing document, the Create New File dialog is bypassed and this notification is not sent in this case.
EventNames:
FileNewDialog_Pre
Parameters
Type |
Name |
Description |
|---|---|---|
String |
templateDirectory |
The default template diretory as defined in the File tab of the Application Options dialog. |
ResultParameters |
result |
Object used to supply the result of the operation. See below. |
Result properties:
Type |
Name |
Description |
|---|---|---|
String |
TemplateFileName |
The filename of the file to use as the template when creating the new file. |
String |
TemplateDirectoryPath |
The directory of the file to use as the template when creating the new file. |
String |
TemplateFullFileName |
The full file name of the template file, can be used to check that the fileName set is correct |
Examples:
FileNewDialog_Pre:
Register-InventorEvent -EventName FileNewDialog_Pre -Action 'PreFileNewDialog'
function PreFileNewDialog($templateDirectory, $result) {
#Write event code here
$result.TemplateFileName = "template.ipt"
$result.TemplateDirectoryPath = "C:\\Templates"
$result.TemplateFullFileName #Returns the TemplateFullFileName e.g "C:\\Templates\template.ipt", cannot be set.
}
The FileOpenDialog event notifies the client when the user executes the Open command to open an existing file.
Remarks
By using this event and setting a fileName and directoryPath to the result variable, the user can replace the default inventor behavior, normally used to replace the Inventor dialog with their own dialog.
EventNames:
FileOpenDialog_Pre
Parameters
Type |
Name |
Description |
|---|---|---|
ResultParameters |
result |
Object used to supply the result of the operation. See below. |
Result properties:
Type |
Name |
Description |
|---|---|---|
String |
FileName |
The file name to use. |
String |
DirectoryPath |
The directory where the file that should be opened is in. |
String |
FullFileName |
The full file name of the file that will be used. Can be used to check that the set file name is correct. |
Examples:
FileOpenDialog_Pre:
Register-InventorEvent -EventName FileOpenDialog_Pre -Action 'PreFileOpenDialog'
function PreFileOpenDialog($result) {
#Write event code here
$result.FileName = "12345.ipt"
$result.DirectoryPath = "C:\\Vault"
$result.FullFileName # C:\\Vault\12345.ipt
}
The FileOpenFromMRU event notifies the client when a file is selected from the MRU list to open.
EventNames:
FileOpenFromMRU_Pre
Examples:
FileOpenFromMRU_Pre:
Register-InventorEvent -EventName FileOpenFromMRU_Pre -Action 'PreFileOpenFromMRU'
function PreFileOpenFromMRU() {
#Write event code here
}
The FileSaveAsDialog event notifies the client when the user executes the SaveAs or trhe SaveCopyAs command to create a new file.
Remarks
This notification is also sent when the Save command is executed the first time for a file that has not been previously saved.
By using this event and setting a fileName and directoryPath to the result variable, the user can replace the default inventor behavior, normally used to replace the Inventor dialog with their own dialog.
EventNames:
FileSaveAsDialog_Pre
Parameters
Type |
Name |
Description |
|---|---|---|
bool |
isSaveCopyAs |
Indicates if the end-user is performing a Save As or Save Copy As operation. Returns True if it is a Save Copy As and False for Save As. |
ResultParameters |
result |
Object used to supply the result of the operation. See below. |
Result properties:
Type |
Name |
Description |
|---|---|---|
String |
FileName |
The file name to use. |
String |
DirectoryPath |
The directory where the file that should be saved is in. |
String |
FullFileName |
The full file name of the file that will be used. Can be used to check that the set file name is correct. |
Examples:
FileSaveAsDialog_Pre:
Register-InventorEvent -EventName FileSaveAsDialog_Pre -Action 'PreFileSaveAsDialog'
function PreFileSaveAsDialog($isSaveCopyAs, $result) {
#Write event code here
$result.FileName = "12345.ipt"
$result.DirectoryPath = "C:\\Vault"
$result.FullFileName # C:\\Vault\12345.ipt
}
Event that fires when file names and properties are being generated by a command.
EventNames:
PopulateFileMetadata_Pre
Examples:
PopulateFileMetadata_Pre:
Register-InventorEvent -EventName PopulateFileMetadata_Pre -Action 'PrePopulateFileMetadata'
function PrePopulateFileMetadata() {
#Write event code here
}