Default Expressions in SOLIDWORKS PDM Data Cards

Article by Miguel de Villa on Mar 22, 2024

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. 

Default Expressions in SOLIDWORKS PDM Data Cards

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

Default Properties SOLIDWORKS PDM

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.

Custom Property Pulldown SOLIDWORKS PDM

Figure 2: Custom Property Pulldown

Custom and File Properties

Custom and File Properties in SOLIDWORKS PDM

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.

SOLIDWORKS PDM Admin Page 474

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.

Completed Data Card in SOLIDWORKS PDM

Figure 4: Completed Data Card 

Example 1: Default Value in Editbox control

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.

Example of Data Card Editor in SOLIDWORKS PDM

Figure 5: Example 1 Data Card Editor

Custom Properties Example in SOLIDWORKS PDM

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. 

SOLIDWORKS Part Evaluated Material Properties

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. 

Example of Data Card Properties Evaluated in SOLIDWORKS

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). 

Unevaluated Syntax SOLIDWORKS PDM Default Value

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. 

Combined PRP Syntax SOLIDWORKS PDM Data Cards

Figure 10: Combined PRP Syntax

Evaluated Combined Syntax SOLIDWORKS PDM

Figure 11: Evaluated Combined Syntax

Example 2: Dropdown List Control

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.

Data Card Editor Example in SOLIDWORKS PDM

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.

Data Card Choice Example in SOLIDWORKS PDM

Figure 13: Example 3 Data Card Choice

Evaluated Text Examples in SOLIDWORKS PDM

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.

SOLIDWORKS PDM Data Card Pulldown List Example

Figure 15: Data Card Pulldown List Example

Appendix: Configuration Specific Considerations

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.

Updates All Configurations Flag in SOLIDWORKS PDM

Figure 16: Updates All Configurations Flag

In favor of "Updates all configurations"

  • In the case of $PRP:”SW-Configuration Name”, when Updates all configurations is on and this option is selected from a droplist, then the control itself is actually evaluating to the text $PRP:”SW-Configuration Name” for all configurations and not the given name of the active configuration for all configurations.
  • Maintenance of configuration-specific properties can be tricky because creating a new configuration in a file that has already been saved into the vault does not trigger the default value for the control to populate again. If Updates all configurations is on and “SW-Configuration Name” is selectable from the dropdown menu, it becomes easier to globally reapply the expression for any new configurations. 

Against “Updates All Configurations”:

  • When configuration-specific properties are heavily in use within an organization, what is displayed on the @ tab of the data card becomes an important question. When it comes to BOM columns and drawing annotations, the @ tab is typically unimportant as the configuration-specific custom properties of the referenced model configuration for a given drawing model view or assembly BOM are always preferred if they exist. As a result, it can be useful to have the @ tab alone reflect placeholder values such as “SEE NOTES” or “SEE BOM”, that instruct the user to pay more attention to the configuration-specific values themselves.

I hope you found this article explaining default expressions in SOLIDWORKS PDM data cards helpful. Learn more about SOLIDWORKS PDM below.

More SOLIDWORKS PDM Tutorials 

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

Using and Exporting BOMs from Inside SOLIDWORKS PDM

VIEW ALL SOLIDWORKS PDM ARTICLES

 

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.

View all posts by Miguel de Villa