Default values for card controls are a powerful tool that can be leveraged in SOLIDWORKS PDM Standard and Professional data cards to automate the population of values without the intervention of the user. When editing a control in the data card editor, there are many options for selecting a default value for a given control, such as text, a value from the parent folder’s data card, or even special values such as file name, the user’s initials, or the current date.
Figure 1: Default Text in Data Card Editor
The Text option is the most versatile and can be utilized to evaluate a variety of native and custom SOLIDWORKS properties beyond what’s immediately available in the Card Editor. Use the following syntax for these types of expressions in the Text Default Value or Free Text List options of Editbox and list controls.
Default Properties
There are many additional Default Properties that can be used other than the ones listed here. For reference, see the pulldown menu in the Custom Properties Values/Text Expression Field and format them like the examples above.
Figure 2: Custom Property Pulldown
Custom and File Properties
It is important to note that any custom property linked with a $PRP are read-only values, and changing them in the data card does not change the original properties in SOLIDWORKS. For additional options for $PRP mappings, see page 474 of the PDM Administration Guide.
Figure 3: Admin Page
Here is an example of these default values being used in a data card. In the first example, the Editbox is used to evaluate the material and mass of a SOLIDWORKS part automatically. In the second example, a droplist allows the user to use the file name or configuration name for a Part Number.
Figure 4: Completed Data Card
Default expressions, like "SW-Material", can be added as a default value for the Editbox Control linked to the PDM variable Material, which itself is linked to the SOLIDWORKS Custom Property “Material” through variable mapping.
Similarly, "SW-Mass" is selected for the Editbox and is ultimately linked to the calculated mass of the part. When a part file is created and saved in the SOLIDWORKS PDM vault, these expressions are automatically added to the data card and stored as a custom property where it will evaluate to the actual SOLIDWORKS material name and corresponding mass when that is applied by the user.
Figure 5: Example 1 Data Card Editor
Figure 6: Example 1 Custom Properties
The evaluated result is identical to when this expression is built into a file template using the Custom Property pulldown menu for the expressions SW-Material@Part.SLDPRT and SW-Mass@Part.SLDPRT.
However, many file templates do not have this property mapping built into them, so files must be individually modified to possess this property and mapping.
Figure 7: SOLIDWORKS Part Evaluated Material Properties
Using this default value method, we can begin automatically recording Material and Mass as true custom properties, not just for new documents, but also for legacy data being migrated into SOLIDWORKS PDM that originally lacked the property.
Figure 8: Example 1 Data Card Properties Evaluated
However, existing files need to be rebuilt and resaved through SOLIDWORKS for the expression to have a chance to be evaluated. Otherwise, they will remain unevaluated (shown below).
Figure 9: Unevaluated Syntax
Even existing custom properties in the file can be called out using this method and concatenated with other text, like an annotation in a drawing. Here, the evaluated output for “SW-Mass” in the Custom Property “Mass” and the selected unit of measure from another droplist control in the Custom Property “UoM” are concatenated with the expression $PRP:”Mass”$PRP:”UoM” to give the weight of the part with associated units.
Figure 10: Combined PRP Syntax
Figure 11: Evaluated Combined Syntax
Part Number control is a dropdown list where the options are to either use the expressions, $PRP: SW-File Name" for the Windows file name without extension, $PRP:”SW-Configuration Name" for the SOLIDWORKS configuration name, or custom text. These expressions can then be selected as the default value.
Figure 12: Example 2 Data Card Editor
Depending on the file naming and part numbering policies within an organization, a file may be named after its part/serial number or be given a short description as a filename instead, while the part number is a separate custom property. SOLIDWORKS configurations may also be assigned a configuration-specific dash number as well for use in BOMs and drawings.
This method then gives a user the choice to use a custom value or a given property of the file itself, such as a file or configuration name. In this example, the filename was the chosen value for the @ tab, and the configuration name for the configuration-specific values. However, it is important to note that if the file or its configurations are renamed, the file must be rebuilt and resaved for the data card to update.
Figure 13: Example 3 Data Card Choice
Figure 14: Example 3 Evaluated Text Examples
For a bonus, the Material option from the previous example can be improved when implemented as a droplist instead. In addition to the default properties, several custom options have been added with “SW-Material” being the default choice.
The Material database does not have every possible material, and it may be preferred to call out a more specific name for the material in use without the hassle of creating a new custom material profile for it. Using the syntax, as shown here in a free text list, will allow it to evaluate either a custom text value for material or display the SOLIDWORKS material.
Figure 15: Data Card Pulldown List Example
Flags are an important consideration when it comes to any data card control—specifically, whether it is appropriate to use the Updates all configurations Flag.
Here are some arguments for and against this flag when using these types of expressions.
Figure 16: Updates All Configurations Flag
In favor of "Updates all configurations"
Against “Updates All Configurations”:
I hope you found this article explaining default expressions in SOLIDWORKS PDM data cards helpful. Learn more about SOLIDWORKS PDM below.
SOLIDWORKS PDM vs 3DEXPERIENCE CLOUD PDM: Workflows, Licensing & More
How to Check What Version of SQL a SOLIDWORKS PDM Environment is Running
How to Search for Variables That Have Been Left Blank in SOLIDWORKS PDM Data Cards
SOLIDWORKS PDM: Dynamic Reporting Using Excel
About Miguel de Villa
Miguel de Villa is a SOLIDWORKS Elite Applications Engineer with a B.S. in Mechanical Engineering from the University of California, San Diego. He’s been working at GoEngineer since 2017 helping customers with all their SOLIDWORKS, Simulation and PDM needs. In his free time he enjoys working with his 3D printer, playing video games and building model kits.
Get our wide array of technical resources delivered right to your inbox.
Unsubscribe at any time.