Filter out unnecessary categories in VDS dialog box

Filter out unnecessary categories in VDS dialog box

alex_hiis6PJP6
Contributor Contributor
372 Views
3 Replies
Message 1 of 4

Filter out unnecessary categories in VDS dialog box

alex_hiis6PJP6
Contributor
Contributor

Hey

 

I there a way to make changes to the Default.ps1 file to remove unnecessary Categories when VDS dialog box is triggered during an inital save in Inventor?

0 Likes
373 Views
3 Replies
Replies (3)
Message 2 of 4

Nick_Hall
Collaborator
Collaborator

Hi

 

The function you need to change is GetCategories

function GetCategories
{
  if ($dsWindow.Name -eq "FileWindow")
  {
    return $vault.CategoryService.GetCategoriesByEntityClassId("FILE", $true)
  }
  elseif ($dsWindow.Name -eq "FolderWindow")
  {
    return $vault.CategoryService.GetCategoriesByEntityClassId("FLDR", $true)
  }
  elseif ($dsWindow.Name -eq "CustomObjectWindow")
  {
    return $vault.CategoryService.GetCategoriesByEntityClassId("CUSTENT", $true)
  }
}

 

You need to change this part so that only the values you want are returned

if ($dsWindow.Name -eq "FileWindow")
{
  return $vault.CategoryService.GetCategoriesByEntityClassId("FILE", $true)
}

 

If you want a hand with the actual filtering code, let me know if 

  • You want to exclude the marked categories by name, and return everything else
    Or
  • You want to include specific categories and return only those

Hope that helps

Nick
 

0 Likes
Message 3 of 4

alex_hiis6PJP6
Contributor
Contributor

Yes, I would appreciate the help. I would like to return values "Engineering" "Purchased" "Reference".

0 Likes
Message 4 of 4

alex_hiis6PJP6
Contributor
Contributor

I think I got it.
I replaced your mentioned line with:

if ($dsWindow.Name -eq "FileWindow")
{
    $allCategories = $vault.CategoryService.GetCategoriesByEntityClassId("FILE", $true)
    $allowedCategoryNames = @("Engineering", "Purchased", "Reference")
    $filteredCategories = $allCategories | Where-Object { $allowedCategoryNames -contains $_.Name }
    return $filteredCategories
}


Can't seemed to get a similar solution to work in Inventor tho.

0 Likes