How to work with custom properties (and cut lists)

Custom properties are extra data fields for your models.

They let you add text like a description, who created the model and the last revision number.

And if you use them right, they can give you superpowers.

Part two: all available variables

We created a complete list of all built-in SOLIDWORKS variables that are available for custom properties.

Within this post, you’ll find…

  1. What is a custom property?
  2. Edit properties: File properties / Summary Information window
  3. Data types
  4. How to add a custom property
  5. Change the pre-defined custom properties
  6. Change the (unlinked) properties for weldment templates (sldlfp files)
  7. How to fix the error “The properties.txt file cannot be located”
  8. How to use special characters
  9. Linked properties for derived parts
  10. Use weldment bounding box dimensions for body names
  11. Using variables as custom property values
  12. How to use custom properties in equations
  13. How to add custom properties to a design table
  14. How to show custom properties in a bill of materials
  15. Custom properties for drawings
  16. A list of available variables
  17. What do $PRP, $PRPSHEET, $PRPVIEW and $PRPMODEL mean?
  18. Working with the model, configurations and bodies
  19. How to use cut list properties
  20. One special property: the description
  21. One missing property: the item number
  22. Property Tab (Builder)
  23. Custom properties and the API
  24. Superpowers for custom properties

1. What is a custom property?

A custom property is a piece of text that is stored within your model file. It’s what we call metadata.

You can use custom properties to store the model mass, the person that created the file, the revision number. The possibilities are endless.

That’s why PDM and CustomTools use them everywhere.

2. Edit properties: File properties / Summary Information window

You can access the metadata for a file here:

solidworks view file properties

When you open that window, you see it has three tabs:

  1. Summary info
  2. Custom properties for the model
  3. Custom properties for each configuration

Drawings have no configurations, so the last tab is not present for drawings.

The BOM quantity is a special extra field that we previously wrote about here.

summary info

3. Data types

There are four data types available:

  1. Text
    • The most basic type. The maximum length is 1023 characters.
  2. Date:
    • Warning: dates are localized. That means they appear different and they depend on the system language of the PC that created the model. They’re not ideal.
  3. Number:
    • These can be whole numbers (integers) or comma values (doubles). SOLIDWORKS seems to round and evaluate these value values and shows you the result.
    • 24 becomes 24
    • 24.0 becomes 24.0
    • 24.0000000000000000001 becomes 24.000000
  4. Yes / No

4. How to add a custom property

To add one, click the last row with <Type a new property> and create a name. You can also pick one from the dropdown list. We’ll show you how to edit this list in the next section.

After that, pick a type, fill in a value and press enter again to store everything.

If you add a property in the Configuration Specific tab, the property is only added for the selected configuration. The other configurations don’t automatically get this property.

5. Change the pre-defined custom properties

When adding a custom property to a part or assembly, you see a list of pre-defined options. These are just proposed names and they have no real meaning. You can select one of these or enter a custom name.

solidworks custom property properties options

You can change these options though. In two ways:

  1. Click Edit List in the window shown above, enter a name, then click Add
  2. The names are read from a text file, located here:

solidworks properties.txt cannot be located file location

Open the text file in a text editor of your choice, et voila. Just add a custom property per line to add your own.

solidworks custom properties list text file

6. Change the (unlinked) properties for weldment templates (sldlfp files)

Did you ever notice that the Description property in cut lists is not linked?

That is because this property comes from the weldment template for that body. These templates are .SLDLFP files. As it turns out, you can add properties to these files and they show up in your cut list.

Just open an SLDLFP file in SOLIDWORKS and add a custom property on the file level:

weldment profile cut list custom properties

Now when you create a weldment with this template, the new custom property shows up in your cut list:

weldment sldlfp custom properties not linked unlinked

7. How to fix the error “The properties.txt file cannot be located”

This error just means that the file from the image above cannot be found. You can copy one from the internet or create your own.

Javelin wrote a blog post on how to fix this error as well.

8. How to use special characters

The SOLIDWORKS help page says the following:

When you define a custom property that includes a single or double quotation mark (‘ or “), type an @ sign in front of the quotation mark to ensure that the expression evaluates correctly. For example: [email protected]" X [email protected]" X 1/[email protected]".

9. Linked properties for derived parts

When you make a derived part, for example a mirrored version, you could enable linking custom properties between the parts.

This link could not be changed or removed in older SOLIDWORKS versions.

SOLIDWORKS 2018 and newer allow you to specify which custom properties remain linked:

solidworks linked properties derived part

10. Use weldment bounding box dimensions for body names

According to this article in the SOLIDWORKS help, you can customize the name of cut list bodies and sheet metal bodies.

You can use custom properties like SW-Thickness, SW-Length, and SW-Width and enter your own prefix and suffix. The result should be something like “Plate, 20x30x300”

We have tried it, but so far it did not work for weldment bodies, only for sheet metal bodies.

11. Using variables as custom property values

Now that we have explained the basics, let’s start using some more advanced stuff.

Because custom properties become way more powerful when you use variables.

When entering the value of a property, notice that you can pick a pre-defined variable like the model mass:

select variable for custom property value

Mass will be converted to a cryptic text: “[email protected]<model-name.SLDPRT”.

Don’t forget the quotes.

This is how SOLIDWORKS stores a variable. This variable is then evaluated when the value is requested.

We also created a list of all the available variables because we could not find a good overview.

12. How to use custom properties in equations

I never knew this was possible. You can actually use custom property values in equations. And store the result back in a custom property!

First, create a custom property. It can even be a text property, doesn’t have to be a number!

custom property in equations

Then use it in an equation. Simple as that. I multiplied it by two before I took this screenshot.

custom property in equations

You can store the result of global variables into a custom property as well. It seems you can only use global variables, not other equations.

13. How to add custom properties to a design table

The easiest way is to:

  1. Create a part or assembly
  2. Add a design table
  3. Close the design table
  4. Add a custom property
  5. Open the design table. SOLIDWORKS will now ask you if it should add the custom property.

You can also add the custom property manually. The syntax is simple:

[email protected]<property-name>, so for example [email protected]

We’ll explain this syntax in section 16: What do $PRP, $PRPSHEET, $PRPVIEW and $PRPMODEL mean?

14. How to show custom properties in a bill of materials

You can show the custom property values for all assembly components in a bill of materials. Click the row above the BOM, I clicked on the G, then click on the Column Property button.

custom property column bill of materials bom

Now you can pick the custom property you want to show in that column.

custom property column bill of materials bom

15. Custom properties for drawings

You cannot link custom properties between a part/assembly and the drawing, unfortunately.

The best method is to have all custom properties in the part or assembly, then link to those in the drawing.

Because you can use model properties in drawing notes.

That means you can create notes, blocks (a block contains one or multiple notes) and smart title blocks (which are also just a bunch of notes).

Method 1: Create a linked note through the user interface

To add a note that is linked to a custom property:

  1. Click Note
  2. Click Link to property
  3. Select Current document (this drawing) or Model found here (the part or assembly)
  4. Select a custom property
  5. Click OK

You can even create a note with multiple properties.

drawing custom properties note link

Method 2: Create a linked note manually

You can also type the note yourself and SOLIDWORKS will replace the text with the custom property value.

Get a sneak preview by hovering over existing notes:

prpsheet sw-author solidworks custom property

16. A list of available variables

We created a separate blog post with a list of all available variables for custom properties. Check it out and don’t forget to bookmark the post.

Are variable names case sensitive?

Nope, they are not. “LENGTH” and “length” will both work.

Although, in very rare cases, SOLIDWORKS seemed to be case sensitive. It’s very annoying, and I haven’t been able to reproduce it.

No more endless lists of fasteners

Lightning: The fast fastener filter

  • Pick a type, size and material
  • Lightning adds a washer and pattern
  • Change the diameter or length in 1 click

17. What do $PRP, $PRPSHEET, $PRPVIEW and $PRPMODEL mean?

When you want to use a variable, you need one of these prefixes, followed by the variable name.

These prefixes tell SOLIDWORKS where to gets its data from. $PRPVIEW uses the model that is in the view, for example.

  1. $PRP
    1. A property that is linked to the current model or drawing (called Current Document).
    2. Presumably, it’s short for property.
  2. $PRPMODEL
    1. Component to which the annotation is attached.
    2. Works for parts and assemblies.
  3. $PRPSMODEL
    1. Very rare.
    2. Use this when adding a note to the sheet, to reference a component in an assembly, in a view
    3. Practice this one in notepad and paste it into SOLIDWORKS, because it’s hard to get right.
  4. $PRPSHEET
    1. Model in the view specified in Sheet Properties.
    2. Use this when you add a note to a sheet. For example, when adding notes to a title block.
  5. $PRPVIEW
    1. Model in the drawing view to which the note belongs.
    2. Use this when you add a note to a view.
  6. $PRPWLD
    1. Cut list or BOM property.

How to add a linked note from the user interface

  1. $PRP
    1. Click Note in the Annotation toolbar
    2. Click anywhere on the sheet or in the model to select the location
    3. Click Link to property in the properties window
    4. Select a property from the dropdown
    5. Click OK
  2. $PRPMODEL
    1. Click Note in the Annotation toolbar
    2. Click Link to property in the properties window
    3. Select Model found here 
    4. Select a property from the dropdown
    5. Click OK
  3. $PRPSMODEL
    1. Click Note in the Annotation toolbar
    2. Click on the sheet
    3. Click Link to property in the properties window
    4. Select Model found here 
    5. Select Selected component or other drawing view
    6. Click on a component
    7. Select a property from the dropdown
    8. Click OK
  4. $PRPSHEET
    1. Click Note in the Annotation toolbar
    2. Click on the sheet
    3. Click Link to property in the properties window
    4. Select Model found here 
    5. Select a property from the dropdown
    6. Click OK
  5. $PRPVIEW
    1. Click Note in the Annotation toolbar
    2. Click Link to property in the properties window
    3. Click on a view
    4. Select Model found here 
    5. Select a property from the dropdown
    6. Click OK
  6. $PRPWLD
    1. Click Note in the Annotation toolbar
    2. Click on a body in a drawing view so the note is attached to that body
    3. Click Link to property in the properties window
    4. Select Model found here 
    5. Select Component to which the annotation is attached. This option is only available if you have clicked on a body in step 2.
    6. Select a property from the dropdown
    7. Click OK

How to add a linked note manually

The best way to practice these is in notepad because some of these are very hard to get right. Then copy and paste them into SOLIDWORKS.

If you have created one correctly, SOLIDWORKS will directly replace the variable with the value. The result might be empty, that’s when you see your input code disappear.

  1. $PRP:
    1. Blueprint: $PRP:”<property name>”
    2. Example: $PRP:”SW-Title”
  2. $PRPMODEL:
    1. Blueprint: $PRPMODEL:”<property name>”
    2. Example: $PRPMODEL:”SW-Title”
  3. $PRPSMODEL:
    1. $PRPSMODEL:”<property name>” $COMP:”<Assembly name>-<instance number>@<view name>/<part name>-<instance number>@<assembly name>”
    2. Example: $PRPSMODEL:”SW-Title” $COMP:”[email protected] View3/[email protected]
  4. $PRPSHEET:
    1. Blueprint: $PRPSHEET:”<property name>”
    2. Example: $PRPSHEET:”SW-Mass”
  5. $PRPVIEW:
    1. Blueprint: $PRPVIEW:”< custom property name>”
    2. Example: $PRPVIEW:”Weight”
  6. $PRPWLD:
    1. Blueprint:  $PRPWLD:”<property name” of <part name>
    2. Example: $PRPWLD:”Length” of Part1

Source

18. Working with the model, configurations and bodies

There are multiple levels. Fortunately, you can recognize them by the number of @-signs.

  1. Normal custom properties:
    • Double quote – Variable name – @ – Filename with extension – Double quote
    • Example: “[email protected] pad.SLDPRT”
  2. Configuration-specific properties:
  3. Body or feature properties:
    • Double quote – Variable name – @@@ – Body name (with instance number) – @ – Filename with extension – Double quote
    • Example: “[email protected]@@TUBE, SQUARE 20 X 20 X 2<3>@Strongback.SLDPRT”

19. How to use cut list properties

You can use all properties from a cut list in drawing notes.

The easiest way is to add a note, click the button Link to property, select Model found here, then Component to which the annotation is attached. Now you can select Length for example.

To do this manually, use $PRPWLD:”property name” and add “of” and the file name at the end.

cut list bom properties length quantity

20. One special property: the description

Barbara Jerin recently wrote a nice article on LinkedIn about one property that’s more special than the rest.

It’s the Description property.

You can use it as a column in Windows Explorer, for example.

Check out the article here.

21. One missing property: the item number

I could not find the item number as a variable, but I really want to so I’ll keep looking.

If you have found a way to use the item number from a BOM or Cut List, please let me know.

22. Property Tab (Builder)

SOLIDWORKS created the Property Tab so you can quickly enter relevant model information and store it in custom properties.

solidworks property tab

(The tab below that is for our drawing automation add-in Drew)

Property tab templates

You can create four different kinds of templates for the contents of this tab:

  • For parts
  • For assemblies
  • For drawings
  • For weldments

These templates are actually just XML files with a fancy extension. They are stored in the same folder as properties.txt.

Property Tab Builder

Because the templates are XML files, you can edit them in any text editor you like.

But it might be simpler to use the Property Tab Builder that SOLIDWORKS supplies with its software.

It’s a separate program.

You can start it via Start > SOLIDWORKS 20xx > SOLIDWORKS Tools > Property Tab Builder 20xx

property tab builder

To create a new template, follow these steps:

  1. Create a new file
  2. Select the model type in the right column. If you only see details for an input, click on an empty space in the center column to show the model type.
  3. The left column shows every type of input you can use. Drag an item from the left column to the center column to use it
  4. Set the details in the right column
  5. Click save and pick a file name

If you want a more in-depth article, check out this one.

23. Custom properties and the API

There are three different (but slightly confusing) methods to get to the model properties.

SOLIDWORKS has the Custom Property Manager to work with these custom properties. You get this object from the model itself or from the cut list feature.

  • Custom properties:
    • Get ModelDocExtension.CustomPropertyManager and use that object with Get5 or Get6 (2018 and newer) to get the value and Set2 to set the value.
    • Pass an empty string when getting the custom property manager to get the custom properties for the entire part/assembly.
    • Pass the configuration name to get or set configuration-specific custom properties.
  • Cut list properties:
  • Summary info:
    • Use this method to get the Title, Summary and other special properties.
    • Use ModelDoc2.SummaryInfo(id) to get or set items that appear in the Summary tab. Pass zero as the argument to get the Title, pass one for the Subject.

24. Superpowers for custom properties

The wonderful people at ATR Soft created CUSTOMTOOLS, a powerful suite of productivity tools.

CUSTOMTOOLS uses custom properties for many of its automations. You can check it out here.

Don't miss the next post. Get a free add-in.

Subscribe to our newsletter and get our TimeSavers add-in for free.