Product design is inherently a variable and iterative process. Perhaps you want to try out different master sketch geometry, or maybe experiment with various part specifications. Conversely, maybe you have a specific value that drives multiple features that you want to control from one source. Whatever the reason for your design variance, Onshape has a great way of handling these needs: Variables.

There are two modalities for creating Onshape variables: Parametric variable features or Configuration variables. While there is a fair amount of overlap between what these two variable types can control, there are striking differences in their use cases which are largely based on the design intent. Let’s jump in.

Similarities

1. Both variable types have the capacity to control a variety of value types in the Part Studio space such as lengths, angles, and real numbers. These values can be used to drive:

  • Sketch Dimensions
  • Feature & custom feature values such as Extrude depth, Chamfer distance, Pattern instance counts, etc.

2. Both of these variable types can also control multiple items simultaneously. In other words, setting two or more discrete dimensions or feature values to be driven by the same variable is permissible.

3. Many dialogues in Onshape can take in formulas. In these dialogues, any variable can be used in a formula. This is useful when you want your design to have self relationships or even spatial relationships. For example, in this Bedside Table Part Studio, I can set ‘Chamfer 2’ to the equation

#Chamfer_Dist/#Leg_Length in

This gives my design a geometric relationship such that should I choose to change the leg length, the chamfer will accordingly update. This is useful for aesthetic purposes or perhaps for specification purposes.

Note: Both configuration and parametric variable types were used in the same feature input.

4. A caveat to the above point is that parametric variables are “unit sensitive. The equation must return the proper unit to be accepted by the feature or dimension. In the above example, the dimensional analysis would be ( [inch] / [inch]) yielding a numeric value with [inch] tacked on at the end. Had the equation been

(#Chamfer_Distance -4) in

, the feature would throw an error because “4” and “#Chamfer_Distance” have different units.

Parametric variable

1. Parametric variables exist exclusively in the Part Studio environment. You can create this feature using thisVariable feature iconicon in the feature toolbar.

2. As the name suggests, these variables are features and are managed parametrically in the same way that other features are. These types of variables can thereby only be referenced by other features that exist below them on the feature tree.

3. Parametric variables can reference other parametric variables that are located above themselves in the feature tree.

Continuing with the Bedside Table example, I’ve now created a new parametric variable called “#Golden_Ratio.’ This variable is then later referenced by the ‘#Chamfer_Dist’ variable in an equation. This can be useful for creating a variable that will often be referenced and is not often changed. Due to its position in the feature tree, it makes more sense to create a variable that is more stagnant as a parametric variable, whereas a configuration variable may suggest a frequent change.

4. It can be controlled by configurations that exist only in the same environment. When using configurations lists or variables, you can configure parametric variables.

The video above shows a workflow with a list configuration. The logic is the same for a configuration variable, but the workflow is slightly different: Right-click on the parametric variable and select to ‘set to’ the desired configuration variable.

This may seem redundant, but if you want to combine the use case shown in point #3 with configuration tables, this would be the best approach.

5. You cannot enforce limits on parametric variables outside of the “type” of variable which you select when creating it. The limits are inherent to this type. You can choose from:

  • Length
  • Angle
  • Number
  • Any

Configuration Variables

1. Configuration variables exist in both Part Studio and Assembly environments and can be accessed through this icon Configurations Icon on the right side bar. They are not features and thus are not solved parametrically; Conversely, they exist one level above features and are used to control the variance of said features.

2. While parametric variables are limited to control over features in the Part Studio, configuration variables can be accessed in both the Part Studio space as well as the Assembly space.

This point is especially what makes configuration variables so powerful. Due to Onshape’s architecture, this means that configuration variables are accessible both across tabs as well as across Documents.

This figure shows the approach:

3. Configuration variables cannot reference each other in the same space. The general workflow for assigning something to a configuration variable is to right-click and select ‘Set to #___’ from the context menu. However, this is exclusive to feature values. Since configuration variables exist above the feature level, they cannot configure one another.

4. You can enforce limits on configuration variables. Of course, there are inherent limits imposed by the types of variable, such as:

  • Length
  • Angle
  • Integer
  • Real
  • Text

You can get more granular with configuration variables by defining the variable’s default, minimum, and maximum values.

Interested in learning more Onshape Tech Tips? You can review the most recent technical blogs here.