As its name suggests, at the core of Vault Data Standard is standardisation including file names and directory structures. With some simple configuration VDS can apply complex directory structure and naming standards that are specific to your business needs. The basics of this are covered in the help documentation, in this post we will cover a practical example of achieving this. Whilst I will use AutoCAD for this post, the same can be achieved with Inventor.
Our Business Rules for File Naming and Folder Structure Standards
Before we get started configuring, here are the standards that we want to implement.
Let’s assume that work is project based and there different design offices in different regions that work on projects specific to their region. Regions are defined by country and state as follows:
- Australia (AUS)
- Victoria (VIC)
- New South Wales (NSW)
- Queensland (QLD)
- New Zealand (NZL)
- Aukland (AUK)
- Cantebury (CAN)
- Marlborough (MBH)
Each project is allocated a project name based on a short description.
Each document contains a title that describes the files contents.
File names should follow the standard
{ProjectName}-{Document Title}.xxx
e.g. GeelongBypassExtension-SchematicDesign.dwg
The folder structure should be standardised to the following format:
$\Designs\{Country}\{State}\{ProjectName}
e.g. $\Designs\AUS\VIC\GeelongBypassExtension
What We Get Out The Box
By default, VDS doesn’t attempt to apply any property based standards for file names or locations (it does allow the user to choose a folder from list of subfolders from the project explorer root – but this is not meant for real use). This makes sense as every organisation will differ in their requirements here and it is best to start from a fairly blank slate. What VDS does give us is a framework to operate in that makes it relatively easy to setup whatever standards are required. When Data Standard CAD addins for AutoCAD or Inventor are installed, the user is prompted with a dialog box when they first save the document. This “New File” form allows the user to enter information about the file – and some of this information can be used to drive our file naming and folder structure conventions. Again this form is just a starting point, it is expected that we’ll need to change it to suit our specific needs. Fortunately we can do so via configuration – no code compilation required!
Below shows the out of box “New File” window that acts as a starting point for implementing standards.
File Naming Convention
Before we can set the file name to be based on project name and title as defined in our standard, we need a way to enter the project name. For this we need 2 things, firstly we need to define the property, then we need to add a text box on the form for the user to enter value.
Define the property
We do this via the CAD configuration file here:
C:\ProgramData\Autodesk\Vault 2015\Extensions\DataStandard\CAD\Configuration\AutoCAD.cfg
This file contains a list of property definitions of which we add one:
<PropertyDefinition PropertyName="ProjectName" DataType="Text"/>
This gives the value that will be entered into the form somewhere to live, and also allows us to synchronise this property with title block attributes.
Add textbox to the form
The form definition is stored in a xaml file in location below… if you are not familiar with XAML or WPF there are plenty of online resources to get you up to speed.
Note: The “gotcha” to keep in mind here is that when rows are added to the layout grid, all the row/column indexes will be thrown out if you just use a text editor and not a smart editor like Visual Studio.
C:\ProgramData\Autodesk\Vault 2015\Extensions\DataStandard\CAD\Configuration\AutoCAD.xaml
To keep things simple, let’s just add a row to the top of the grid where the existing controls are laid out, then add the following lines just below where all the other controls are defined:
<Label Content="Project Name" Grid.Row="0" />
<TextBox Text="{Binding Prop[ProjectName].Value}" Grid.Row="0" Grid.Column="1" Name="ProjectName" VerticalAlignment="Stretch"></TextBox>
Note the “Binding” property needs to match the name of the property created in the AutoCAD.cfg file from previous step.
Finally we need to make the form a little taller to make room for our extra field. Change the MaxHeight and MinHeight properties of prop:DSWindow node to 550.
Clicking the save button on a new file in AutoCAD should show the following form which allows user to enter the project name:
Now we need the file name to be driven by the values entered into the Project Name and Title fields. There is a property back in the AutoCAD.cfg called “FileNameDefinition” that defines the template for the file name. Lets update that to:
<FileNameDefinition>{Prop[ProjectName].Value}-{Prop[GEN-TITLE-DES1].Value}</FileNameDefinition>
The property GEN-TITLE-DES1 is by default bound to the Title field on the form (you can change the name of this field to anything you want so long as it’s changed in the AutoCAD.cfg file as well as in the Binding for the title textbox in the AutoCAD.xaml file – you probably want it to match the name of the Title tag on your title block… but we’ll cover that another time)
Now filling the form out and saving should result in the file name following our intended convention.
You may have noticed that the File Name field still says Drawing2.dwg even though our actual file name has changed. Let’s fix that up before declaring victory.
In the AutoCAD.xaml file, find the FILENAME textbox and changes its binding by replacing the text Prop[GEN-TITLE-DWG].Value with PathAndFileNameHandler.FileName
What this does is bind the text of the File Name textbox to use the underlying file name VDS property, rather than referring to the drawing property that was being defaulted to the initial file name (Drawing2.dwg in this case). Now the File Name textbox should update as soon as you have entered values into project name and title fields.
Victory!
Well, sort of... that only covers file name conventions. I'll cover folder structures in Part 2.
Comments
You can follow this conversation by subscribing to the comment feed for this post.