Automate Folder and File Creation in SOLIDWORKS PDM

   By Tracy Wettig on February 26, 2021

Templates are a fantastic time saving tool in SOLIDWORKS PDM Professional. Have you ever desired a uniform folder structure or had dread for the inevitable update of required project forms? Templates can help put your mind at ease by automatically enforcing these procedures.

Templates are executed with a right-click anywhere in the vault and selecting the designated template. You can design a template to generate a folder structure with appropriate forms with only two clicks. This easy access will make getting your users to adopt the new workflow effortless.

Before You Start

Below are required and optional vault elements to have completed before you can complete a new template.

  • Users and Groups (required): You will have to assign who has permission to use the Template and can only select users and groups already in the vault
  • Serial Numbers (optional): If you desire your Template to leverage serial numbers (ex. for numbering project folders or generating and creating the next unique file name for a SOLIDWORKS part file)
  • Template Card (optional): You can design a pop-up window to prompt the user to enter in required metadata that can be pushed to folder and file data cards created in the template. This pop-up is the Template Card. A Template Card is not required to execute a Template.
  • Folder and File Data Cards (optional): If you use a Template Card, you can redirect the user’s input into variables mapped to completed Folder and File Data Cards.
  • File Templates (optional): If your Template’s intent is to keep reuse files up to date (like SOLIDWORKS part, assembly, and drawing templates or the Project Checklist Word document), these files must be checked into the vault. You can adjust permissions to prevent these files from being seen and/or edited by unapproved users

Six-Step Wizard

Templates are created via a wizard. Be logged in to the PDM Administration Tool as a user with the Administrative Permission “Can administrate templates” enabled. Right click the Templates node and select New Template.SOLIDWORKS Users and Groups

Step 1: Template Name

The Menu string will show up in your user’s right click menu under New:SOLIDWORKS Template Name
Per the example in your Template wizard, you can use the backslash to create submenus for the sake of organizing. Name your Templates intuitively and be sure to check for spelling errors.

Step 2: Execute As 

Depending on how you’ve set up permissions, you may want to have the user run this tool with the elevated permissions of a specific user.

For example, if your current Group/User permissions are set to prevent from adding or renaming folders but your Template’s intent will be to create a folder structure, select “Read permissions from the following user” and enter in the credentials of a user who does not have relevant restrictions.SOLIDWORKS Execute As
Pro-tip: Don’t use your own personal PDM credentials. If you move on professionally and the new Admin deactivates your account, the Templates referencing your credentials in this step of the wizard will fail. Create a user account for a purpose like “admin_template”. You can set appropriate permissions if you don’t want to assign the Vault’s Admin user at this step.

Step 3: Template Cards

SOLIDWORKS Standard Pop UpWhen a user executes a Template, you can design a pop-up to prompt the user to input metadata that will then be pushed to Folder and/or File data cards of whatever you’ve designed the Template to generate.

These Template cards are created and designed in the Card Editor (just like with Folder and File Data Cards). In the PDM Administration Tool, expand your Cards node, right click Template Cards, select “New Card…”SOLIDWORKS Template CardYou can save these Template cards at the root level of your vault. Their save location does not affect their application like Folder cards.

In the Template wizard, select “Add Card…” and navigate to the Template Card you would like to be launched when a user selects a Template from their right click menu. The variables defined in the Template Card will show up in the column “Card Variable”.SOLIDWORKS Template Variable 2
Because the metadata entered in by the user in the Template Card can go to different destinations (some data to Folder Data cards and other data to File data cards), each input entered in the Template Card must go into a temporary holding pattern called a Template Variable (which is *not* the same as the Variables node in the Vault). Clicking “Template Variables” will open the Organize Template Variables window. Select New to add a Template Variable.

Though not required but strongly suggested, designate a unique naming convention to prevent confusion from typical vault Variables like a prefix of “t_”. Assign the appropriate type of input for this Template Variable and the conditional field spanning below it. Do so for every anticipated Template Card input. This Templates Variables list will list all Template Variables created across multiple separate Templates in the same Vault.SOLIDWORKS Template VariableThen, assign the Template Variable in the Template Variable Column of the Wizard to the appropriate Template Card Variable input.SOLIDWORKS Template Variable 2The metadata received from the Template Card is now in an organized holding pattern and is waiting to be assigned to its appropriate destination in the next section “Files and Folders”.

Step 4: Files and Folders

You can design a Template to create a consistent folder structure and generate required forms. In the example below, this Template will automatically generate a folder called “Project” and the appropriate serial number associated with the Template Variable called t_projectNumber.

Within this Project folder there are three subfolders: DesignData, Documentation, and Specifications. The pane on the right indicates the Template will also create a file referencing a clean document in the Vault and it will be placed within the new Project folder at the same level of the subfolders.SOLIDWORKS Files and FoldersIf you don’t want to worry where the user is executing the Template, the Template can enforce the folders and files will go to the correct directories every time.

If you have “C:PDMDesigns” and you want the Template to create new folders only in the Designs directory, simply type Designs after selecting the yellow folder icon (1) below. The result will look like the example image above. Add the new folders via the green folder icon (2) below. Folders will be nested under the preselected folder.

To auto-generate a clean copy of a file, first select the desired target directory on the left and click the Add Template file document button on the top right. Navigate to the document already checked into the vault.

Folder Properties
To assign Template Card input to the Folder data cards, you must map Template Variables to your Folder’s data card. Right click one of the green folders and select Properties. On the Copy Variables Tab, assign the Template Variables to the desired Variables for the Folder Data Card.SOLIDWORKS Folder Properties
File Properties
Similarly, to assign Template Card input to the File data cards, you must map the Template Variables appropriately. Select the file and click the Edit Template File button:SOLIDWORKS File PropertiesThis window will allow you to map the appropriate Template Variables to the variables used in the File data card. You will also have more control over how the file will be named by incorporating template variables mapped to Serial Numbers. The percent (%) symbol must bookend your template variable as seen in the “File Name” field below.SOLIDWORKS Edit Template File

Step 5: Icon
This step is purely for aesthetics. Select an icon that a user can quickly identify the intent of the Template.SOLIDWORKS File NameIf the Template is designed to generate a SOLIDWORKS Part file, it’d make sense to have the Template icon be the .sldprt icon:SOLIDWORKS Template Icon
Step 6: Users and Groups
The final step of the wizard controls who has access to see and execute this Template. Excluded parties will conveniently not see the Template as an option in the right-click > New menuSOLIDWORKS Icon Selection

Now your Template is complete! Congratulations!

For more details on the individual settings within this Template Wizard, be sure to explore the Templates chapter in your PDM Administration guide found in your PDM Admin tool Help menu.

Related Products

Browse the TriMech web store for SOLIDWORKS software to design, analyze and manufacture your products on your desktop.

Tracy Wettig

Related Content

3D Model Powerpoint Solidworks

Bring your SOLIDWORKS Models to Life in a PowerPoint Presentation

Next time you want to showcase your 3D SOLIDWORKS CAD Model in a PowerPoint presentation,…

Learn More...

How to create a piping route with SOLIDWORKS

Today we’re going to review how we can create a piping route for this current…

Learn More...

Quick Imported Simplification using SOLIDWORKS Import Diagnostics

If you work with big STEP or IGES files, you know how critical it is…

Learn More...