Sample–Using Numbering Schemes in Data Standard Dialogs

Leverage Vault numbering schemes to enforce file names when a user creates a new Data Standard file.

Filtering Numbering Schemes

In the installed sample, the Number Scheme combo box shows all activated numbering schemes. In the XAML file, the combo box is bound to a PowerShell function called GetNumSchms.

The GetNumSchms function makes it easy to control which schemes should be shown to the user.

Filtering Numbering Schemes in Inventor Based on File Type

Customize the File Name

Data Standard for Vault

Data Standard for CAD

The property DocNumber contains the generated number, because it is defined in attribute GeneratedNumberProperty="DocNumber" in the DSNumSchemeCtrl control of the Inventor.xaml file.

Use Vault Numbering without Showing the Number Scheme Control in the Dialog

By removing the DSNumSchemeCtrl and the NumSchms combo box from the default File.xaml file, the user cannot select a numbering scheme anymore.

Data Standard for Vault

    The following sample implementation of GetNewFileName uses the numbering scheme TestScheme from above and the value entered in the Title as a parameter for the numbering scheme.

    C:\ProgramData\Autodesk\<Vault Version>\Extensions\DataStandard\Vault\addinVault\Default.ps1

    ...
    function GetNewFileName
    {
        $numSchemes = $vault.DocumentService.GetNumberingSchemesByType([Autodesk.Connectivity.WebServices.NumSchmType]::Activated)
        $testNumScheme = $numSchemes | Where-Object { $_.Name.Equals("TestScheme") }
        $NumGenArgs = @()
        $NumGenArgs += $Prop["Title"].Value
        $genNum = $vault.DocumentService.GenerateFileNumber($testNumScheme.SchmID, $NumGenArgs)
        return $genNum + $Prop["_FileExt"].Value
    }
    ...

Data Standard for CAD

    For Inventor and AutoCAD, the implementation is similar to the sample above. But instead of returning a filename, the property DocNumber has to be filled with a generated number. This property is then used to set the name for the current file:

    C:\ProgramData\Autodesk\<Vault Version>\Extensions\DataStandard\CAD\addinVault\Default.ps1

    ...
    function OnPostCloseDialog
    {
        if ($DSParam -eq "Create")
        {
            $numSchemes = $vault.DocumentService.GetNumberingSchemesByType([Autodesk.Connectivity.WebServices.NumSchmType]::Activated)
            $testNumScheme = $numSchemes | Where-Object { $_.Name.Equals("TestScheme") }
            $NumGenArgs = @()
            $NumGenArgs += $Prop["Title"].Value
            $genNum = $vault.DocumentService.GenerateFileNumber($testNumScheme.SchmID, $NumGenArgs)
            $Prop["DocNumber"].Value = $genNum
        }
    }
    ...