From Inflow Technology: That was Easy - Using Buttons on a Data Card
Have you ever wished that you could just have an “easy button” for something? Well, using SOLIDWORKS PDM Data Card controls, you can create your own! The Button control allows you to place a button on a data card that can be configured to launch a web page, open a file, browse to a location, or even run a custom add-in. Here are a couple of examples of how you can use buttons to make tasks just a bit easier.
Launch a Web Page:
Using a button to launch a web page is the easiest option to configure. To start, select the Button Control from the toolbar in the card editor, and place the button where you need it on the card.
From here, all you need to do is fill out the caption field to give the button a name, and the WWW-address box with the web address you would like the button to link to.
I’ve linked a button on my SOLIDWORKS part card to our Inflow Web Page. As you can see below, clicking the button launched the Inflow home page in my default web browser.
Open a File:
To get a bit more complex with a button, you can utilize the Command type “Command String” to have a button launch an executable or navigate to a location. In the example below, I have a task that automatically creates a PDF of a SOLIDWORKS drawing and stores it in a PDF folder in my vault. To easily open the associated PDF, I’ve created a button. This button first opens the PDF viewer on my machine and then opens the PDF with the same file name as the drawing from the “PDFs” folder location.
As you can see, instead of typing out a file name, I used “%3” to have PDM dynamically pull the file name from the file where the button is used. There are 5 dynamic triggers that can be used for command strings that are for File Path (%1), File Vault Name (%2), File Name (%3), File Extension (%4), and Folder Path (%5).
While command strings alone can create some nice options for a button, they are limited. For example, file paths need to be available on all machines where the button is used, and a file needs to already be locally cached on a machine to open it from a button. Using a button to launch a Custom Add-in that is already loaded in your vault is a great way to use more advanced commands that the command string alone cannot handle well.
Buttons are available in both PDM Standard and PDM Professional to use on your data cards. The options are basically the same between the two, but only PDM Professional can use the command type “Run Add-in,” as custom add-ins are not available in PDM Standard.