Generating File Names

The Vault API is sometimes redundant, and it can also repeat itself.  One place were this is painfully obvious is with file name generation.  If you want to generate a file name, there are two completely separate mechanisms to choose from.  Each has its own set of API functions with their own sets of pros and cons.  You have to choose which is best for your needs.  There is no one mechanism to rule them all.

To make matters worse, they have similar names.  Once engine is for file naming schemes and the other is for file numbering schemes.  If you are not paying attention, you may mistake one word for the other.  It’s annoying, I know.  It’s like reading a three volume fantasy epic where one villain is called Sauron and the other is called Saruman.


File Naming Schemes:

This is a pretty basic mechanism, so it's good if you want something quick and simple.  It consists of an auto-increment number with a string prefix and suffix.  I believe that Copy Design uses this feature.

One nice feature is that you can “rollback” a name if you decide not to use it.   For example, the user hits Cancel on your dialog. 

Functions for generating names:

  • GetAllFileNamingSchemes
  • ReserveFileNamingDescriptions
  • RollbackFileNamingDescriptions

Admin functions:

  • AddFileNamingScheme
  • DeleteFileNamingScheme
  • SetDefaultFileNamingScheme
  • UpdateFileNamingScheme

File Numbering Schemes:

This is much more complex.  You chain together different field types to create your naming pattern.  It’s more powerful, but it’s also more difficult to work with.  Items and Change Orders use this engine too. 

Unfortunately, there is no way to “rollback” a number.  Once it’s generated, it’s reserved forever.

Functions for generating names:

  • GenerateFileNumber
  • GenerateFileNumbers
  • GetNumberingSchemesByType

Admin functions:

  • ActivateNumberingSchemes
  • DeactivateNumberingSchemes
  • DeleteNumberingScheme
  • DeleteNumberingSchemeUnconditional
  • SetDefaultNumberingScheme
  • UpdateNumberingScheme

Here are some screenshots from Vault Explorer that illustrate how fields are hooked together to form the numbering scheme.


Comments

4 responses to “Generating File Names”

  1. Hello Doug,
    is it possible to get the code for it?
    Thank you Georg

  2. Hello, in Vault 2015 R2,
    If you have a custom numbering scheme(Fixed Text, Free text and Pre-defined list) where one of his Fields is a Pre-defined list, is possible to get the “description” from each “item” from this pre-defined list?
    Pre-defined list:
    Code – Description
    X – Stand
    B – Blue
    G – Green
    I will get the Description of each item of the list.
    Is it possible with C#?
    Thank you!

  3. DocumentService.GetNumberingSchemesByType() returns an array of NumSchm objects. Each one of those objects has a full description of a numbering scheme, including the fields involved.
    Keep in mind that NumSchmField can be subclassed into objects that are specialized to each field type (FreeTxtField, AutogenField, and so on).

  4. Hello, in Vault Pro 2016,
    I want to get user defined properties and a datum in the “FileNaming Schemes”. Maby with mapping for File schemes?
    Is it possible?

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading