Configure creation dialogs and tabs to display custom object data.
Requirements
Three components are required for custom object support:
Create CustomObject
Modify the mymenu.mnu File
There are two sections in the mymenu.mnu file where you can configure menu options. One section is for the menu option New. The other section is for the menu option Edit.
New Menu Option
item newCustomObject { ..... ... NavigationTypes = [{CustomObject}]; ToolbarPaintStyle = TextAndGlyph; PSFile = "CreateCustomObject.ps1"; Image="NewCustomObject.ico"; }
Edit Menu Option
item editCustomObject { .... ..... NavigationTypes = [{CustomObject}]; ToolbarPaintStyle = TextAndGlyph; PSFile = "EditCustomObject.ps1"; Image="EditCustomObject.ico"; }
The syntax for both sections is the same as other menu items. However, the attribute NavigationTypes contains the name of the custom object that you want to support with specified menu option. The name of the custom object must be entered in curly brackets (e.g., {CustomObjectName}).
By default, {CustomObject} is used. However, if you create a custom object with a different name, for instance MyCustomObject, then the NavigationTypes attribute value must match the name of that custom object {MyCustomObject}.
Modify the Create and Edit Custom Object Script Files
The menu definitions in the mymenu.mnu file point to a PowerShell file called CreateCustomObject.ps1 or EditCustomObject.ps1, depending on the section. The script file for creating and editing custom objects is similar to scripts for creating and editing other objects, such as files and folders. However, the script for creating and editing custom objects contains two unique commands: GetCreateCustomObjectDialog and GetEditCustomObjectDialog.
Similar to other scripts, the create and edit custom object scripts point to a related .xaml file. These scripts can be edited to point to other .xaml files.
Here is an excerpt from the NewCustomObject.ps1 script.
.... $dialog = $dsCommands.GetCreateCustomObjectDialog($id) $xamlFile = New-Object CreateObject.WPF.XamlFile "CustomEntityXaml", "%ProgramData%\Autodesk\Vault 2015\Extensions\DataStandard\Vault\Configuration\CustomObject.xaml" ....
Use the XAML Template to Create Custom Object Dialogs and Tabs
The syntax for .xaml dialogs is the same as for other dialogs and tabs. For the create and edit dialog, a XAML template is provided with the CustomObject.xaml. You can use this dialog template to create your own custom objects.
When Vault is restarted, the Data Standard dialog tabs will show the custom object name based on the XAML file in the custom object folder. By default, a XAML file called Datasheet.xml already exists. Use this file as a template for creating your custom object tabs.