Variable Studios
Available in: Variable Studio
This topic explains the functionality and mechanics of using a Variable Studio to create variables that can be used in the document in which they are created as well in other documents. You can create a Variable Studio only through Onshape's browser platform, however, you can view and use the variables on all mobile platforms.
A Variable Studio is created in a document and the variables therein are immediately available for use in all Part Studios and Assemblies in that document workspace.
See also: Variable Studio Configurations.
-
In a document, click the Insert new tab icon (
) at the bottom left and select Create Variable Studio:
-
The Variable Studio opens with a table for variables ready for input:
-
Type the name of the first variable in the Name column. (Only alphanumeric characters are allowed.)
-
Press Tab to move to the next row. A default type of Length is entered for the variable; to change it, use the drop down arrow and select a new type.
To import a variable from a CSV file, select the From import option and follow these instructions: Importing a variable from a CSV table.
-
Enter a default value for the variable and an optional description.
To reorder the inputs in the table, right-click and select Move up or Move down. You can also drag the inputs to reorder them.
Use the caret to the left of the Variable Studio title to collapse or expand the section. To collapse (or expand) all tables at once, click the three-dot menu on the right side of the title block and select Collapse (or Expand) all tables.
You can use variables defined earlier in the table to define the value of another variable later in the table. For example:
The L1 variable (length of the table top) is used to calculate the W1 variable (width of the table top).
To make the variables available for all Part Studios and Assemblies in the workspace, check the box at the bottom edge of the Variable Studio tab:
Unchecking this box removes the ability to use the variables in Part Studios and Assemblies in this document's workspace. (Keep the box unchecked if the variables are in a draft state and check the box when the variables are ready for use.)
The From import variable type enables users to create a single variable that stores a subset of rows and columns from an imported CSV table. The Row options filter the rows and determine the Result type (Single value, Array, or Map) of the variable. The Column options then filter each row and determine the type of each entry in the final variable.
- In the table, click the Variable type arrow and select From import.

- In the Value cell, click the Edit pencil icon. The Variable dialog opens with the From import tab selected:

- In the dialog:
- Under CSV file, click the Select CSV file field to open the dialog:

Select the CSV file from either the Current document, Other documents, or click the Import button at the bottom of the dialog to select a CSV file from your device.
Once selected, click the file. It is loaded into the Select CSV file field.
- Fill out the Row and Column fields according to your requirements:
- Access type - Select By index, By index range, By label, or All values.
- Index - If By index is selected, enter a single Index value.
- Min/Max index - When By index range is selected, enter both the minimum and maximum index values.
- Value - If By label is selected, enter the label's string value.
- Regular expression - Check to pattern match a set of target strings.
- Result type - Select Single value, Array, or Map.
- Label column/row index - If the Result type is a Map, enter either a numerical index value or a variable.
- Access type - Select By index, By index range, By label, or All values.
- Check Conversion factor and enter a value with measurement units if you are converting from one measurement to another (for example, if the table uses inches, and you want these values converted to centimeters).

- Optionally, enter a Description to provide some details about the Variable or CSV file being used.
- Under CSV file, click the Select CSV file field to open the dialog:
-
Click
.
See also: Variable: From Import Examples.
To use a Variable table (and variables defined within it) in a document other than that in which it was defined:
-
Open the document in which you wish to use variables defined in a Variable Studio in another document.
-
Click the Insert new tab icon (
) at the bottom left and select Create Variable Studio. -
In the new Variable Studio, click the button at the top: Insert Variable Studio. The Insert Variable Studio dialog opens:
-
Select one of the two tabs at the top of the dialog in which to look for the Variable table: Current document or Other documents.
If there are any Variable Studios in the current document, they are listed under Current document. To locate Variable Studios in another document, select the Other document tab:
You can select either an entire Variable Studio table (shown above as Variable Studio 1), or select one or more distinct variables from the list. Your selection is made available immediately in the current document. In the case of inserting a Variable table or variable from another document, the document must have a version that contains the variables. If no version exists, you are prompted to create one before proceeding.
Upon successful selection of a variable and/or Variable table, you see the selected entities in the current document's Variable Studio:
The name and version of the Variable Studio from which the table was inserted is displayed at the top of the table, shown above as Variable Studio 1 V1.
Configured Variable Studios must have their configurations set at time of insertion. See Referencing a configured Variable Studio.
Releasing a Variable Studio
Right-click on the Variable Studio tab and select Release:
For more information, see Release Management and Typical Release Workflow.
Configured Variable Studios cannot be released.
For an additional Learning center resource, register for the following course: Variables and Expressions (Onshape account required).