VDS 2025 Numbering scheme

VDS 2025 Numbering scheme

Paula.N
Enthusiast Enthusiast
1,097 Views
5 Replies
Message 1 of 6

VDS 2025 Numbering scheme

Paula.N
Enthusiast
Enthusiast

Hello,

 

Sorry, but I don't know anymore.
In the selection of numbering schemes in Vault and Inventor VDS, only the default scheme appears.
How do I get the default scheme to be the first selection but all other activated schemes are selectable?
I have this code from Vault 'GetNumSchms' from VDS-MFG-Sample 2025:

 

$_FilteredNumSchems = $numSchems | Where-Object { $_.IsDflt -eq $true }
$Prop["_NumSchm"].Value = $_FilteredNumSchems[0].Name
$dsWindow.FindName("NumSchms").IsEnabled = $false
return $_FilteredNumSchems

Many thanks

 

0 Likes
Accepted solutions (2)
1,098 Views
5 Replies
Replies (5)
Message 2 of 6

Nick_Hall
Collaborator
Collaborator

Hi Paula

 

It's probably not the most efficient way, but I'd do it like this:

 

$_FilteredNumSchems = New-Object System.Collections.ArrayList($null)
$defaultNumSchem = $numSchems | Where-Object { $_.IsDflt -eq $true }
$_FilteredNumSchems.Add($defaultNumSchem) | Out-Null
foreach($numSchem in $numSchems) {
  if ($numSchem.SchmID -ne $defaultNumSchem.SchmID) {
    $_FilteredNumSchems.Add($numSchem) | Out-Null
  }
}
return $_FilteredNumSchems

 

I've not tested the code, but it *should* move the default scheme to the top of the list. And it needs a bit of error trapping too.

 

Hope it helps

Nick

0 Likes
Message 3 of 6

Markus.Koechl
Autodesk
Autodesk
Accepted solution

You can activate the default scheme while returning all instead of the filtered ones:

$_default = $numSchems | Where-Object { $_.IsDflt -eq $true }

$Prop["_NumSchm"].Value = $_default.Name
return $numSchems



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
Message 4 of 6

Paula.N
Enthusiast
Enthusiast

Hi Markus,

 

thanks, that works. Is it possible to get the default NumSchm at first selection?

0 Likes
Message 5 of 6

Nick_Hall
Collaborator
Collaborator

Hi Paula

 

The approach I suggested in my original reply will put the default at the top of your list.

 

You should be able to combine it with Markus' code to select the default.

 

Nick

0 Likes
Message 6 of 6

Nick_Hall
Collaborator
Collaborator
Accepted solution

Hi again

 

I had to test my theory. This code will return the numbering schemes, in alphabetical order, but with the default moved to the top of the list

$numSchems = $numSchems | Sort-Object -Property Name
$_OrderedNumSchems = New-Object System.Collections.ArrayList($null)
$defaultNumSchem = $numSchems | Where-Object { $_.IsDflt -eq $true }
$_OrderedNumSchems.Add($defaultNumSchem) | Out-Null
foreach($numSchem in $numSchems) {
	if ($numSchem.SchmID -ne $defaultNumSchem.SchmID) {
		$_OrderedNumSchems.Add($numSchem) | Out-Null
	}
}
$numSchems = $_OrderedNumSchems

Like I said earlier, I'm sure it could be more efficient

 

Nick

0 Likes