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.

Within this post, you’ll find…

  1. What is a custom property?
  2. File properties / Summary Information window
  3. Data types
  4. How to add a custom property
  5. Change the pre-defined custom properties
  6. How to fix the error “The properties.txt file cannot be located”
  7. How to use special characters
  8. Linked properties for derived parts
  9. Using variables as custom property values
  10. A list of available variables
  11. Custom properties for drawings
  12. Working with the model, configurations and bodies
  13. One special property: the description
  14. One missing property: the item number
  15. Property Tab (Builder)
  16. Custom properties and the API
  17. Superpowers for custom properties

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.

File properties / Summary Information window

You can access the metadata 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

Data types

There are four data types available:

  1. Text
    • The most basic type. The maximum length is 1023 characters.
  2. Date:
    • Note: dates are localized. That means they appear different and they depend on the system language of the PC that created the model.
  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
    1. Probably stored as a boolean internally, so as true or false.

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. You can edit this list, we’ll show you how 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 will only be added for the selected configuration.

Change the pre-defined custom properties

When you want to add a custom property to a part or assembly, there is a list of pre-defined options. 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

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.

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: 2@" X 2@" X 1/4@".

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

Customizing body descriptions using the bounding box properties

According to this article in the SOLIDWORKS What’s new from 2018, 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.

 

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: “SW-Mass@<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.

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.

Drew doubles your drawing speed

Watch 95 second demo

Free 14 day trial

  • Try out all features
  • Get started in two minutes
  • No creditcard needed
Get more info

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 what you can do, is to use properties from the model 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 few 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

What is the difference between $PRP and $PRPSHEET?

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

  1. $PRP: A property that is linked to the drawing (called Current Document) starts with $PRP. I assume it’s short for property.
  2. $PRPSHEET: Model in the view specified in Sheet Properties
  3. $PRPVIEW: Model in the drawing view to which the note belongs
  4. $PRPMODEL: Component to which the annotation is attached. Works for parts and assemblies)

Source

Are variable names case sensitive?

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

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 – One @ sign – Filename with extension – Double quote
    • Example: “SW-Mass@Launch pad.SLDPRT”
  2. Configuration-specific properties:
    • Double quote – Variable name – Two @ signs – Configuration name – One @ sign – Filename with extension – Double quote
    • Example: “SW-Mass@@DefaultSM-FLAT-PATTERN@Launch pad.SLDPRT”
  3. Body or feature properties:
    • Double quote – Variable name – Three @ signs – Body name (with number) – One @ sign – Filename with extension – Double quote
    • Example: “SW-Mass@@@TUBE, SQUARE 20 X 20 X 2<3>@Strongback.SLDPRT”

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.

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.

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

Custom properties and the API

There are three different (and 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.

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.