VDS custom numbering


With Data Standard 2015 the number generation has been integrated within the VDS dialog. That is great! So, just configure the numbering schemes and you can use them right away in the VDS dialog. In case you like to offer just some numbering schemes for certain file type or category, you can just customize the GetNumSchms in the Default.ps1 in order to filter the numbering schemes according to your needs.

But in the case you need something more custom, you can go even beyond. In this post I’d like to show you how you can manage a more complex numbering scheme. We will have a number made of several components, where the values comes from properties of the VDS dialog. Additionally, we want to either generate the number for the combination of properties, or generate a new sheet for the given number.

In the standard dialog you have the list of numbering schemes, the preview for the selected numbering scheme, which also allows you to enter the data to generate the number, and the file name text-box. The numbering scheme preview control provides the ability to capture the users input, but in our case we like to have independent properties on the dialog for this.

Therefore, we will remove the selection of the numbering scheme, the preview and also the file name text-box and handle the number generation completely our self. The resulting dialog looks like this:


Now that all the controls are removed, when a new file is created, no number is generated at all. We will generate the number when the user hits the OK button. The appropriate function ist the OnPostCloseDialog. Here we can set the property DocNumber to our value. In order to do this, we will call the Vault number generator with our custom arguments and so generate a number the way we want.

Now, in our example the number looks like this: [Site]-[Discipline]-[Area]-xxxx-yy, where xxxx is the number and yy is the sheet number. So, a number could be IT-SK-01-1234-01. We will either generate the number (with sheet 01), or increase the sheet number on file copy.

For getting this working we need two numbering schemes, one for generating the number with sheet 01 and one for generating incremental sheets. Here are my two numbering scheme definitions.

2016-04-08_10-19-46 2016-04-08_09-51-11

Then we also need some properties where the user can select the values. In my case with Inventor, i just added further properties to the Inventor.cfg file. Such properties does not necessarily exist in Vault, unless you want this behavior also in Vault. This is how my Inventor.cfg looks like:

<PropertyDefinition PropertyName="Site" DataType="Text" />
<PropertyDefinition PropertyName="Discipline" DataType="Text" />
<PropertyDefinition PropertyName="Area" DataType="Text" />
<PropertyDefinition PropertyName="Dwg No" DataType="Text" />
<PropertyDefinition PropertyName="Sheet" DataType="Text" />
<PropertyDefinition PropertyName="NewSheet" DataType="Boolean" />

In the XAML dialog I’ve removed/commented the numbering scheme selection and the numbering scheme preview.


Instead of the file name text-box, I’ve added the 3 comboboxes for the Site, Discipline and Area, and also a check box which tells me wether just the sheet number should be increased.

<Label Content="{Binding UIString[LBL6], FallbackValue=File Name}" Grid.Row="14" Grid.Column="0" />
<!--<TextBox Grid.Row="14" Grid.Column="1" x:Name="FILENAME" Style="{StaticResource FileNameStyle}" Margin="0,2" />-->
<StackPanel Grid.Row="14" Grid.Column="1" Orientation="Horizontal">
   <ComboBox Text="{Binding Prop[Site].Value}">
      <ComboBoxItem Content="IT"/>
      <ComboBoxItem Content="UK"/>
      <ComboBoxItem Content="DE"/>
   <ComboBox Text="{Binding Prop[Discipline].Value}">
      <ComboBoxItem Content="SK"/>
      <ComboBoxItem Content="XR"/>
   <ComboBox Text="{Binding Prop[Area].Value}">
     <ComboBoxItem Content="01" />
     <ComboBoxItem Content="02" />
   <Label Content="####"/>
   <Label Content="##"/>
   <CheckBox Content="new sheet" VerticalAlignment="Center" IsChecked="{Binding Prop[NewSheet].Value}" Margin="20,0,0,0"/>

Now we need a function that will do the work. I’ve created this function, which could be placed in a custom PS1 file (recommended) or for testing purpose in the default.ps1 (not recommended)

function GenerateNumber
  $numSchems = $vault.DocumentService.GetNumberingSchemesByType('Activated')
  $DrawingSchm = $numSchems | Where-Object { $_.Name -eq "DrawingNo" }
  $SheetSchm = $numSchems | Where-Object { $_.Name -eq "SheetNo" }
  $prefix = $Prop["Site"].Value +"-"+ $Prop["Discipline"].Value +"-"+ $Prop["Area"].Value
    $prefix += "-"+ $Prop["Dwg No"].Value
    $newNumber = $vault.DocumentService.GenerateFileNumber($SheetSchm.SchmID, @($prefix))
    $Prop["Sheet"].Value = $newNumber.Substring($prefix.Length+1)
    $newNumber = $vault.DocumentService.GenerateFileNumber($DrawingSchm.SchmID, @($prefix))
    $Prop["Dwg No"].Value = $newNumber.Substring($prefix.Length+1,4)
  $Prop["DocNumber"].Value = $newNumber

In the OnPostCloseDialog i then call the GenerateNumber function, like this:

function OnPostCloseDialog
  $mWindowName = $dsWindow.Name

When you restart Inventor, you should be able to see the result. Create a new file and save it. The number should be generated with sheet 01. Make a copy via the Data Standard Ribbon and check the „new sheet“ checkbox, and the number remains the same, but the sheet number gets incremented.

In summary, we removed/replaced the VDS numbering with a custom numbering generation. Here we can feed the number generator with properties from the dialog and have all the freedom.

I hope you enjoy!

This entry was posted in Data Standard. Bookmark the permalink.

One Response to VDS custom numbering

  1. I’ve played around with both custom numbering and numbering schemes from Vault and it seems to work great. However I have a case where I need to create a custom number for a drawing based on the filename of the model placed on the drawing. Is there a way to get that information through VDS or do I need to write a separate API code?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s