Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VDS 2025 Numbering scheme

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Paula.N
189 Views, 5 Replies

VDS 2025 Numbering scheme

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

 

5 REPLIES 5
Message 2 of 6
Nick_Hall
in reply to: Paula.N

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

Message 3 of 6
Markus.Koechl
in reply to: Paula.N

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
in reply to: Paula.N

Hi Markus,

 

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

Message 5 of 6
Nick_Hall
in reply to: Paula.N

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

Message 6 of 6
Nick_Hall
in reply to: Paula.N

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report