For many of us, SOLIDWORKS PDM proves to be a lifesaver in automation time and again. To make data entry a lot less painful and more practical, there are a few things we can do on the front end. I was reminded of this during a recent encounter dealing with variable names.
In this specific instance, there was a field within the drawing that needed to be driven by a data card variable. A company had multiple locations with different company identities at each location. If the location was set to "City A" on the data card, then the drawing needed to show "Company A" in the title block. This can be achieved rather easily with the following steps.
First, a few things to consider with this method and example:
- It is assumed PDM variables have been created and the drawing property has been appropriately mapped. Variable mapping is discussed in greater detail here. In this example, I used the variable names TEST_Company and TEST_City.
- This is not a two-way interaction, so one property must drive the other. In this example, TEST_City will drive TEST_Company.
Now to the good stuff, here's how to define the relation between the two properties:
- Once the variables have been created and appropriately mapped on our drawing property, we must define a list. We'll do this in the PDM Administration tool (Start Menu >> All Programs >> SOLIDWORKS PDM >> Administration).
- With the PDM Administration tool open, we will need to log into the vault and expand the vault node.
- Then right-click on Lists (for cards) and select Add New.
- In the List dialog, select Text With Alias as the data type and enter a preferred list name.
- Populate the list with Displayed Values/Cities and a corresponding number starting at 1, as shown above.
- Navigate to File >> Save to complete the list creation.
It's now time to make our data card modifications. Open the Data Card for these properties and start the setup process. In this case, the properties are entered into the part and carried into the drawing, which means we must edit the part card using an edit-box for the controlled value and a drop list for the controlling value.
Next, we will need to configure our edit-box and drop list.
For our drop list, we must change the following parameters:
- Items: Special Value - Alias List
For our edit-box, we will change the following parameters:
- Read-Only: Checked (Because city is the driving factor, we don't want to allow direct edits.)
- Default Value: Text Value
- Input Formula: See Below.
Finally, we must define an input formula for our edit-box using the $Token command. The syntax for this command is defined as:
<string> - List of strings to choose from.
<index> - Index of strings to use. This could be a variable linked to an alias list.
| - The character used to separate the <string> values.
$Token(Company A|Company B|Company C|Company D|Company E|Company F,%TEST_City%,|)
The above command basically states if the alias of TEST_City (as we defined when we created the list) is 1, then the value will equal Company A. If it is equal to 2, then the value will be Company B, and so on. Once the defined formula syntax is inputted, the value of TEST_City on the data card TEST_Company will populate automatically when changed.
This is a great way to use the built-in capabilities of SOLIDWORKS PDM to enable functionality that is otherwise difficult to achieve. The time savings and reduced data entry for users is always a good thing.