Concatenating Combo Box Selectedvaluepath value to data standard property!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello All, I have in my inventor.xaml file some combo boxes which are defined via a notepad that has the data structure of the properties. Within the data structure I have also included an associated ID to each type of data. For example Machine 1> Code:M1->Model A->Code MA. What I want is the codes to be concatendated such that after the series of combo boxes it would come to a code which is UD to be Code: M1MA. However the code I have set to do this concatenation is not working.
Here is the code for the default.ps1 file :
function InitializeWindow
{
$dsWindow.Width = 600
$dsWindow.Height = 400
$Prop["Machine"].add_PropertyChanged({param( $parameter, $source) if($source.PropertyName -eq "Value") { Category_OnPropertyChanged }})
$Prop["Model"].add_PropertyChanged({param( $parameter, $source) if($source.PropertyName -eq "Value") { AddDesc_OnPropertyChanged }})
$mWindowName = $dsWindow.Name
switch($mWindowName)
{
"InventorWindow"
{
#rules applying for Inventor
}
"AutoCADWindow"
{
#rules applying for AutoCAD
}
default
{
#rules applying commonly
}
}
if ($Prop["_CreateMode"].Value)
{
$mappedRootPath = $Prop["_VaultVirtualPath"].Value + $Prop["_WorkspacePath"].Value
$mappedRootPath = $mappedRootPath -replace "\\", "/" -replace "//", "/"
if ($mappedRootPath -eq '')
{
$mappedRootPath = '$'
}
$rootFolder = $vault.DocumentService.GetFolderByPath($mappedRootPath)
$root = New-Object PSObject -Property @{ Name = $rootFolder.Name; ID=$rootFolder.Id }
AddCombo -data $root
}
}
function AddinLoaded
{
#Executed when DataStandard is loaded in Inventor
}
function AddinUnloaded
{
#Executed when DataStandard is unloaded in Inventor
}
function GetNumSchms
{
try
{
$numSchems = $vault.DocumentService.GetNumberingSchemesByType('Activated')
if ($numSchems.Count -gt 0)
{
$list = New-Object 'System.Collections.Generic.List[System.Object]'
foreach ($item in $numSchems)
{
if ($item.IsDflt)
{
$list.Insert(0,$item)
}
else
{
$list.Add($item)
}
}
return $list
}
}
catch [System.Exception]
{
#[System.Windows.MessageBox]::Show($error)
}
}
function GetCategories
{
if ($Prop["_CreateMode"].Value)
{
$cats = $vault.CategoryService.GetCategoriesByEntityClassId("FILE", $true)
if ($cats.Count -gt 0)
{
$list = New-Object 'System.Collections.Generic.List[System.Object]'
foreach ($item in $cats)
{
if ($item.Name -eq 'Engineering')
{
$list.Insert(0,$item)
}
else
{
$list.Add($item)
}
}
return $list
}
}
if ($Prop["_EditMode"].Value)
{
return GetCategoryByFileName $Prop["_FileName"].Value
}
}
function OnPostCloseDialog
{
$mWindowName = $dsWindow.Name
switch($mWindowName)
{
"InventorWindow"
{
#rules applying for Inventor
}
"AutoCADWindow"
{
#rules applying for AutoCAD
}
default
{
#rules applying commonly
}
}
}
function Category_OnPropertyChanged
{
$dsWindow.FindName("code").Content = $Prop['Machine'].Value + " " + $Prop['Model'].Value
}
Highlighted in Red is where the code is present to do the concatenation!!!!!
Here is the invetor.xaml file where the properties are binded and defined:
Could someone please help me populate Code UD property in data standard. Right now the code is not being generated !! Kudos and a lot of thanks is given in advanced! p.s. I tried a lot of different ways to accomplish this: