A customer with many years of both SOLIDWORKS and SOLIDWORKS PDM experience asked; “How do I get the file name into the associated file data card?” You might think, like I did, simply set the default value in the card editor tool for an edit box on the file data card to one of two special values: file name or file name without extension.
The main considerations to keep in mind here are as follows:
1. The file gets renamed during its lifetime.
2. The default value only gets assigned to the data card when the file is added to the vault for the first time.
The solution to overcome these hurdles is to read the SOLIDWORKS system defined property (SW-File Name) using variable attributes. The process is very similar to linking model properties to the drawing file data card written in previous blog.
1. Open SOLIDWORKS PDM administration utility.
2. Create variable through Variable Editor in SOLIDWORKS PDM administration utility. In this case, “FileName” is the chosen name for the variable.
3. Add attribute linked to the custom property for SOLIDWORKS files. In this example, the variable is mapped to “Filename” custom property. Remember, the variable and attribute names are not required to match.
4. Map variable to control on the file data card. In this example, the “FileName” variable is assigned to an edit box control. See red box (1) in figure below.
5. The business rule for this exercise states the SOLIDWORKS file will drive the value into the edit box for “FileName.” Hence the property for “Read only” is checked. See green box (2) shown in figure above.
6. Updates all configurations” checkbox is selected. See blue box (3) in figure above. This setting is supposed to update all configurations within the file but does not perform as expected for this purpose.
7. See purple box (4) in figure above. This region of the edit box properties is for setting the default value for this control when the associated file is added to the vault. Notice the default value is “$PRP:’Sw-File Name.’” This was set with the notion that the SOLIDWORKS template file did not have a preconfigured custom property for “Filename.” This too does not perform as expected for this purpose; therefore, leave the value blank.
8. The last step is to configure the custom property in the file or SOLIDWORKS template. See image below.
9. Optional: For each configuration, set the property in the file or SOLIDWORKS template. See image below. The red box highlights the configuration and the blue box focuses on the property itself. Again, if the “Updates all configurations” edit box property is checked, this will not work as expected. Hence the purpose of this optional step.
IMPORTANT: The key to making this work is saving the file. In other words, if the file is renamed, it has to be opened in SOLIDWORKS and saved for the update to happen.
1. Open SOLIDWORKS.
2. Enable SOLIDWORKS PDM add-in.
3. Generate a new SOLIDWORKS file: part, assembly, or drawing.
4. Ensure custom and/or configuration property(s) are linked to $PRP:”SW-File Name” and associated value is shown.
5. Save file into SOLIDWORKS PDM.
6.Check file into vault.
Only custom property is configured.
Default configuration has no property for file name; therefore, the control on the data card is empty for this configuration. Keep in mind the edit box properties for the data card control is set to “Update all configurations.” “Updates all configurations” works when the value is edited through the data card.
The instructions written in the blog has given you the requisite knowledge to link system properties to SOLIDWORKS PDM file data card for any SOLIDWORKS file type (drawing, part, or assembly). The example system property used for this lesson was SOLIDWORKS file name. If you read the other parts of this blog series, you would recognize this topic is a slight twist to Part II: linking model properties to the SOLIDWORKS drawing file data card.
In either this or the previous postings, a firm understanding of property links in SOLIDWORKS is necessary. $PRP property link was used in this posting, and in Part II, the $PRPSHEET was employed. If you want to learn more about these property links including $PRPMODEL and $PRPVIEW, then please read Part I of this blog series.