After a couple days of R&D I did figure out how to achieve this on the Inventor side but not on the Vault side.
On the Inventor side I customized Default.ps1 to replace the ListValues of the three properties during the InitializeWindow function:
$Prop["ETO_Category"].ListValues = @("Fabrication", "Purchased - Mechanical", "Purchased - Controls/Electrical", "Pump & Valves: Dept. 26")
$Prop["UOM"].ListValues = @("AS", "PC", "FT", "SA")
$Prop["BOMAssemblyReleaseId"].ListValues = @("Contents of Assembly Only", "Assembly Only", "Both Assembly and Contents")
During the InitializeCategory function for each property I tried looking in the custom iProperties of the file to see if there's an already existing value and update the property in the datasheet if found:
try {
switch ($Document.PropertySets.Item("Inventor User Defined Properties").Item("ETO_Category").Value) {
400 { $Prop["ETO_Category"].Value = "Fabrication" }
100 { $Prop["ETO_Category"].Value = "Purchased - Mechanical" }
110 { $Prop["ETO_Category"].Value = "Purchased - Controls/Electrical" }
200 { $Prop["ETO_Category"].Value = "Pump & Valves: Dept. 26" }
}
}
catch {}
try {
switch ($Document.PropertySets.Item("Inventor User Defined Properties").Item("UOM").Value) {
1 { $Prop["UOM"].Value = "AS" }
2 { $Prop["UOM"].Value = "PC" }
11 { $Prop["UOM"].Value = "FT" }
-1 { $Prop["UOM"].Value = "SA" }
}
}
catch {}
try {
switch ($Document.PropertySets.Item("Inventor User Defined Properties").Item("BOMAssemblyReleaseId").Value) {
1 { $Prop["BOMAssemblyReleaseId"].Value = "Contents of Assembly Only" }
2 { $Prop["BOMAssemblyReleaseId"].Value = "Assembly Only" }
3 { $Prop["BOMAssemblyReleaseId"].Value = "Both Assembly and Contents" }
}
}
catch {}
This will present those properties in the datasheet with the translated values.
If there are any automations that require updating the selected value of the translated properties then check for and update with the translated values, not the original.
For example, use:
if ($Prop["BOMAssemblyReleaseId"].Value -ne "Assembly Only") { $Prop["BOMAssemblyReleaseId"].Value = "Assembly Only" }
Not:
if ($Prop["BOMAssemblyReleaseId"].Value -ne 2) { $Prop["BOMAssemblyReleaseId"].Value = 2 }
If those properties have a required set of ListValues in Vault, then you will need to add custom validation scripts just the same as adding a custom PartNumberValidation script just like in the VDS Tutorials adding the InitializeValidation function to the InitializeWindow function of Default.ps1
function InitializeETOValidation {
try {
if ($dsWindow.Name -eq 'InventorWindow') {
$global:mETOProperty = "ETO_Category"
$global:mUOMProperty = "UOM"
$global:mBOMProperty = "BOMAssemblyReleaseId"
}
$Prop["$($global:mETOProperty)"].CustomValidation = { ValidateETONumber }
$Prop["$($global:mUOMProperty)"].CustomValidation = { ValidateUOMNumber }
$Prop["$($global:mBOMProperty)"].CustomValidation = { ValidateBOMNumber }
}
catch {}
}
function ValidateETONumber {
switch ($Prop["ETO_Category"].Value) { { $_ -in "Fabrication", "Purchased - Mechanical", "Purchased - Controls/Electrical", "Pump & Valves: Dept. 26" } { return $true } }
}
function ValidateUOMNumber { switch ($Prop["UOM"].Value) { { $_ -in "AS", "PC", "FT", "SA" } { return $true } } }
function ValidateBOMNumber {
switch ($Prop["BOMAssemblyReleaseId"].Value) { { $_ -in "Contents of Assembly Only", "Assembly Only", "Both Assembly and Contents" } { return $true } }
}
Finally, in the OnPostCloseDialog function you translate the text values back to the required integer values:
switch ($Prop["ETO_Category"].Value) {
"Fabrication" { $Prop["ETO_Category"].Value = 400 }
"Purchased - Mechanical" { $Prop["ETO_Category"].Value = 100 }
"Purchased - Controls/Electrical" { $Prop["ETO_Category"].Value = 110 }
"Pump & Valves: Dept. 26" { $Prop["ETO_Category"].Value = 200 }
}
switch ($Prop["UOM"].Value) {
"AS" { $Prop["UOM"].Value = 1 }
"PC" { $Prop["UOM"].Value = 2 }
"FT" { $Prop["UOM"].Value = 11 }
"SA" { $Prop["UOM"].Value = -1 }
}
switch ($Prop["BOMAssemblyReleaseId"].Value) {
"Contents of Assembly Only" { $Prop["BOMAssemblyReleaseId"].Value = 1 }
"Assembly Only" { $Prop["BOMAssemblyReleaseId"].Value = 2 }
"Both Assembly and Contents" { $Prop["BOMAssemblyReleaseId"].Value = 3 }
}
However, I am now getting stuck on how to do this on the Vault side. I've figured out how to replace the ListValues and the currently selected value with the translated text values but I cannot figure out how to translate them back to the integer value when the OK button is pressed. In fact, clicking OK doesn't update any property changes at all so there's an error somewhere that's preventing value updates to get pushed back into the vault file.
Default.ps1:
function InitializeWindow {
#begin rules applying commonly
InitializeWindowTitle
InitializeNumSchm
InitializeCategory
InitializeNameValidation
#end rules applying commonly
$mWindowName = $dsWindow.Name
switch ($mWindowName) {
"FileWindow" {
#rules applying for File
$dsWindow.FindName("TemplateCB").add_SelectionChanged({ OnTemplateChanged })
#enable custom validation for Part Number property
InitializePartNumberValidation
InitializeETOValidation
$Prop["ETO_Category"].ListValues = @("Fabrication", "Purchased - Mechanical", "Purchased - Controls/Electrical", "Pump & Valves: Dept. 26")
$Prop["UOM"].ListValues = @("AS", "PC", "FT", "SA")
$Prop["BOMAssemblyReleaseId"].ListValues = @("Contents of Assembly Only", "Assembly Only", "Both Assembly and Contents")
switch ($Prop["ETO_Category"].Value) {
400 { $Prop["ETO_Category"].Value = "Fabrication" }
100 { $Prop["ETO_Category"].Value = "Purchased - Mechanical" }
110 { $Prop["ETO_Category"].Value = "Purchased - Controls/Electrical" }
200 { $Prop["ETO_Category"].Value = "Pump & Valves: Dept. 26" }
}
switch ($Prop["UOM"].Value) {
1 { $Prop["UOM"].Value = "AS" }
2 { $Prop["UOM"].Value = "PC" }
11 { $Prop["UOM"].Value = "FT" }
-1 { $Prop["UOM"].Value = "SA" }
}
switch ($Prop["BOMAssemblyReleaseId"].Value) {
1 { $Prop["BOMAssemblyReleaseId"].Value = "Contents of Assembly Only" }
2 { $Prop["BOMAssemblyReleaseId"].Value = "Assembly Only" }
3 { $Prop["BOMAssemblyReleaseId"].Value = "Both Assembly and Contents" }
}
}
#rules applying for Folder
"FolderWindow" {}
#rules applying for Custom Object
"CustomObjectWindow" {}
}
}
ETOValidation.ps1:
function InitializeETOValidation {
try {
if ($dsWindow.Name -eq 'FileWindow') {
$global:mETOProperty = "ETO_Category"
$global:mUOMProperty = "UOM"
$global:mBOMProperty = "BOMAssemblyReleaseId"
}
$Prop["$($global:mETOProperty)"].CustomValidation = { ValidateETONumber }
$Prop["$($global:mUOMProperty)"].CustomValidation = { ValidateUOMNumber }
$Prop["$($global:mBOMProperty)"].CustomValidation = { ValidateBOMNumber }
}
catch {}
}
function ValidateETONumber {
switch ($Prop["ETO_Category"].Value) { { $_ -in "Fabrication", "Purchased - Mechanical", "Purchased - Controls/Electrical", "Pump & Valves: Dept. 26" } { return $true } }
}
function ValidateUOMNumber { switch ($Prop["UOM"].Value) { { $_ -in "AS", "PC", "FT", "SA" } { return $true } } }
function ValidateBOMNumber {
switch ($Prop["BOMAssemblyReleaseId"].Value) { { $_ -in "Contents of Assembly Only", "Assembly Only", "Both Assembly and Contents" } { return $true } }
}
There is no OnPostCloseDialog function in the Default.ps1 file where this could be useful. According to the tutorial I'm supposed to copy "DataStandard\Vault\addinVault\Menus\EditFile.ps1" over to the matching location in the Vault.Custom folder and make edits but I'm having trouble finding any examples on how or where to make edits to property values after the OK button is clicked.