Written by Bryce Hooper, Application Engineer
The power of PDM templates has the potential to radically change how files are created. We’ll see here how we can use them to create folder structures, files from existing templates inside of PDM as well as through SolidWorks using inputs to create a semi-intelligent part number system. All done while gathering information one time to reduce the number of clicks and keystrokes to create the same things manually.
PDM Templates take input through various means. The most efficient method would be through a data card. We design these data cards as we do any other data card in the admin tool. Quite often, if we are going to capture data for a SOLIDWORKS file we can borrow and save the existing data card as a Template card. In the example below, we’ll walk through using an existing data card for SOLIDWORKS parts to capture data and intelligently name the file.
We start by deciding what we are going to use as a template. In my vault, I have a set of SOLIDWORKS files with my custom properties and units defined as I like to use them. I store them in the vault, as this is a requirement for PDM templates. Here I have a SOLIDWORKS Part and a SOLIDWORKS Assembly as well as some other things. We’ll need the part going forward for the example.
We then also need to determine what information about this file we want to capture and place into its data card. We’ll start by looking at the data card for SOLIDWORKS files.
We can see that a few of these fields will be driven by the model (Weight) or PDM (revision). We can also trim out the status information as this will be a new part and so won’t need this information collected. Taking some of these fields out leaves us with a cleaner card that is only the inputs that we’d like to consider for a new file.
We’ll also make an addition to this card to capture some new information the build a file name and part number. We start this by creating some new variables. My part number will be 3 segments long, so I’ve created 3 variables to match the prefix, body and suffix. Two of these fields will be driven by serial numbers – a serial number to keep track of the year and a serial number to keep a count of parts I’ve created. The serial number for the year may not seem like it needs to be a serial number, but currently we lack a special value of just year in our data card creation. We’ll use this to handle this field that should update on its own, in the long run the specific value for this serial won’t matter. The year will be our part number’s middle section.
The serial number to count has just been configured as a serial with 2 leading zeros. This will be the part number’s suffix.
For the prefix of the part number we can create a list in order to get an intelligence about what the part number may mean. For this example, we’ll even use an aliased list so that the prefix number values aren’t something that needs to be known to the end user.
Setting this up is simple and just requires typing out these values. Any values can be created and chosen here. If we don’t need to use an alias list a normal or SQL list would work as well. Using SQL we could potentially be pulling this information from another piece of software such as an ERP/MRP.
With our part number pieces available to us, we need to put them on the data card and then put them to use.
In the data card editor, we’ve placed 3 fields across the top. For the prefix I’ve used a list, for the body and suffix a text box will work. The text boxes we will want to make read only so that no one is changing our serialized values before the file can be created.
We may be inclined to attempt to set a default vault to the prefix list. If we are using an aliased list this will cause some problems in generating our part number automatically. In that case we suggest you simply make that variable mandatory so that a user cannot click OK without setting the value.
In the Number field we should use the input formula to concatenate the components of the part number and set it to read only. This will calculate our serial based on our selections and pass it along to name the file.
Our data card is all set, now is the time to create the PDM template itself. The first page of the template wizard is related to what we’d like to see as our menu option in the right click menu of the vault. There aren’t any restrictions on this can it can be whatever works best for you.
Depending on the permissions of the users executing this, we may need to decide to have this template executed as a specific user on the “Execute As” page. We can use this in scenarios where we may also want to create folders, but normal users do not have that permission. Putting in the Admin credentials would allow them to create the folders – but only through this template.
On the template card page, we will add the template card that we created for this purpose.
We will see a list of variables that are available on the card, ready to capture data. The next steps are to create a place to put that data in the template. We do this by pressing the Template Variables button. We are confronted with a dialog to create variables with various methods of input.
In most cases we’ll want to use Format String. This will let us take data from the card. If we don’t need a data card because we are only collecting a single item, Prompt the user may be a good option.
In the dialog create a variable for each piece of data we want to put on the data card. I don’t want to capture my prefix, body and suffix separately so I will not be making variables for them. It’s also recommended that you name them in a way to distinguish themselves from the normal variables. It’s not necessary but helpful. Here I’ve added a “t_” to all the names. Set these to Format string and click OK.
Back in the wizard go through the list on the right size selecting the right template variable to the data card variable from the drop down, skipping any that we don’t want to put into our final file. The screenshot above shows what this should look like when mapped.
On the File and Folders page we can determine a folder structure and what files we are adding. We don’t have to do both if we don’t want. PDM Templates can create a folder structure alone, or if we do not specify a folder structure for a file it will place it wherever we have performed the right click > New. Here I have added my SOLIDWORKS file from the first few steps. Add files by clicking the New File button and browsing to the file.
Since we are generating our serial numbers in the template card, we will need to disable standard serial number generation for this file. We will also be renaming the file according to our Part Number variable that we created. We include variables in the file names by enclosing them in ‘%’ as shown above. We can then also map any variables we have picked from the template card into this file. Click OK when finished.
In order to use this template inside of SOLIDWORKS one important setting must be done. On the next page of the wizard we can set an icon to show in our right click menu. If we choose a SOLIDWORKS file type (such as SLDPRT in this case) it will show in our New File menu.