Variable Studio Configurations
In Onshape, you can configure Variable Studios similar to the way you can configure Part Studios and Assemblies.
You can configure any variable value or description. All values and descriptions you configure in one Variable Studio are referred to as a configuration. One configuration can include multiple configuration inputs.
The configuration inputs you define in a Variable Studio become options in the Insert dialog when you insert the Variable Studio into another tab or document.

- Click the
icon on the right side of the Variable Studio window to open the Configuration panel.
- The Variable Studio cannot be configured while being automatically referenced. Deselect the Insert into all Part Studios and Assemblies checkbox. (When you insert a configured variable table into a Part Studio or assembly, you must choose which configurations to insert.)
- Click Configure Variable Studio. A configuration input table appears in the Configuration panel.
- Click in the first row to activate it, and enter the input value names in the first column. Press Tab to move to the next row. The blue bar to the left of the row indicates the currently selected configuration in the Variable Studio.
- Right-click a variable value or description and click Configure on the context menu to add it to the configuration table.
- Continue right-clicking and selecting Configure to add additional values or descriptions to the table. The selections are added to the table with their default values, and are highlighted in orange in the Variable Studio.
- Double-click and edit the values in the configuration table as necessary.

- At the bottom of the Configuration panel, click the Add configuration input arrow and select the type of configuration to add. Clicking the button instead of the arrow automatically inserts a List configuration type.
- Select an option from the menu:
- List - Creates a list of selectable values to present at insertion.
Checkbox - Creates a checkbox to check/uncheck during insertion.
Configuration variable - Creates a variable that can be used in any feature or in FeatureScript.
-
Edit the values in the configuration input table as needed.

See Basic steps.

- Click the Add configuration input arrow and select Checkbox.
- Add a Name for the input in the dialog that appears.
- Use the Default option to specify if the configuration should be checked or unchecked by default. This can be changed later.
- Click the green check mark to add the input to the Configuration panel.
- Right-click the value or description to configure in the Variable Studio, and click Configure with to add the value to the input.
- Edit the values in the input as needed.

- Click the Add configuration input arrow and select Configuration variable.
- Add a Name for the variable in the dialog that appears.
- Select a type for the variable. Choose from Length, Angle, Integer, Real, or Text.
- Enter the values for the variable.
- Click the green check mark to add the input to the Configuration panel.
- Enter the values for the variable.
- Right-click a value or description in the Variable Studio and select Set to...
The value is added to the Configuration panel

Configured Variable Studios cannot be released.

-
In the Insert Variable Studio dialog, select the configured Variable Studio.
-
Make selections in the dialog to specify which configurations you want, then click Generate.
Click the Set to last viewed configuration dropdown (
) to select the last active configuration in the Variable Studio, or select Reset to default to set all inputs to their default values.
-
Click the Variable Studio to insert it into your Variable table, or select individual variables from the generated list.

- Insert the configured Variable Studio into the Variable table as described in the last section.
- In the Variable table, click the three-dot menu button and select Edit reference.
- In the Update Variable Studio dialog, right-click the configuration and select Configure (or Configure with if multiple configuration inputs exist in the Part Studio or assembly).
- A notification appears that the Variable Studio has been added to the Part Studio/Assembly configuration. Click the checkmark to close the dialog.
- Open the Configuration panel in the Part Studio or assembly. The Variable Studio configuration becomes a feature (column) in the Configuration panel.

The examples in this section show a configured Part Studio. Functionality is the same for configured Variable Studios.
配置可见性条件对话框允许您在配置中添加逻辑,因此您可以控制某些输入和选项何时可用。

假设一个有两个输入的零件:高度和宽度。
默认情况下,任意高度的零件可以将宽度设置为任意值。但是,假设超宽度仅适用于“较高”高度。在这种情况下,我们可以设置“宽度”输入参数可见的条件。
- 在“配置”面板中,单击输入的三点按钮,然后从菜单中选择“可见性条件”。
“配置可见性条件”对话框打开。右侧面板显示当前选定配置的预览。您可以在此面板中更改所选选项以预览您的设置。 - 单击“添加条件”。
- 单击第一个下拉菜单,然后选择应控制此输入参数可见性的参数。在此示例中,我们将选择“高度”输入参数。
- 在第二个下拉列表中,选择要么选择特定选项,要么在两者之间选择一系列选项:
- 是:单击出现的第三个下拉列表,然后为输入选择允许的选项。
- 介于两者之间: Click the third dropdown and select the first allowed option in the range. Click the fourth dropdown and select the final allowed option in the range.
在此示例中,宽度输入仅适用于 Tall 身高。右侧的预览会更新以反映您的选择。在下图中,您可以看到宽度输入不再适用于默认高度。
- 单击“保存”。现在,“宽度”输入参数仅在选择“较高”高度时可见,“宽度”输入参数表显示可见性条件图标
。

您可以使用配置可见性条件对话框中的选项规则设置来指定某些选项的显示条件。
只能为列表输入设置选项规则逻辑。
- 在“配置可见性条件”对话框中,展开输入并单击“添加选项规则”。对话框中出现一个新部分:
- 在“显示”行中,选择受控制的选项。
- 选项:单击出现的下拉列表,然后选择要为其设置条件的选项。
- 范围:单击第一个下拉列表并选择该范围内的第一个选项。单击第二个下拉列表,然后选择该范围内的最后一个选项。范围包含特定选项,允许重叠范围。
- 在“何时”行中:
- 从第一个下拉列表中选择输入。
- 选择要么选择特定的选项,要么介于两者之间来选择一系列选项。
- 是:单击出现的下拉列表并选择该选项的允许值。
- 介于两者之间:单击第一个下拉列表,然后选择该范围内第一个允许的选项。单击第二个下拉列表,然后选择该范围内的最终允许选项。
-
通过单击“添加条件”并重复这组步骤,继续在配置中添加逻辑。
期权规则中的条件以 AND 语句组合在一起;必须满足所有条件才能显示受控期权。
- 再次单击“添加选项规则”,为其他选项添加条件。
- 单击保存。
在下面的示例中,仅当“区域”为“默认”或更大时,才允许使用“深度”选项。仅当“区域”为“大”、“默认”或“小”时,才允许使用“标准”选项。仅当区域较小或较小时,才允许使用“浅色”选项:
下一个示例使用重叠范围来指定可见性条件:
以下示例使用选项和范围控件的组合来设置所需的逻辑。

输入条件是累加的;如果我们在上面的示例中添加第三种配置并设置下图所示的条件,则“大圆角”选项将仅适用于同时具有“较高”高度和“超宽”宽度输入参数的零件。
当将“较高高度”设置为“默认宽度”时,“圆角”配置将被隐藏。
配置输入参数只能控制“配置”面板中显示在其下方的输入的可见性。在本示例中,“宽度”输入参数可以由“高度”输入参数控制,但不能由“圆角”输入参数控制。

如果找不到必要的输入或选项,则会自动修复(移除)可见性条件。
例如,如果宽度输入的可见性取决于高度输入,并且删除了高度输入,则宽度的可见性条件将自动移除。这同样适用于被删除或移动的单个选项。在本示例中,高度输入也已从“圆角”选项中移除。
您将在工作区中看到一条警告,对话框中的条件已删除:

-
您设置的可见性条件和选项规则可在所有“插入”对话框中找到(例如,将配置的零件插入到装配体时)。对可见性条件所做的更改会自动反映在引用配置元素的所有现有文档中。
-
隐藏的输入始终有其默认值。在本页的第一个示例中,尽管未设置宽度选项,但短高度和中等高度部分的默认宽度仍为默认宽度。
-
如果配置输入没有可见的选项,则会将其隐藏并采用其默认值。
-
-
折叠输入或选项后,对话框中会显示可见性条件的摘要。
-
(仅限零件和 Part Studio):已从特性中排除的配置输入只能控制其下方其他输入的可见性,这些输入参数也已从特性中排除。在下面的示例中,如果将“宽度”排除在特性中(由图标
指示),则只有当“圆角”也从特性中排除时,它才能控制圆角的可见性。
-
(仅限零件和 Part Studio):已从特性中排除的配置输入项,在发布包和修订引用值中将被视为采用其默认值。若可见性条件阻止使用默认值,则采用首个可见值。
- 使用“配置可见性条件”对话框中的“输入”下拉菜单来查看其他输入参数。您可以选择“所有输入”来查看所有可用输入参数。
- 当对话框中显示多个输入时,单击三点按钮可展开或折叠所有输入。
- 您可以将配置可见性条件对话框的预览部分用作操场来测试您的配置。
- 取消选中“显示隐藏的输入”复选框以从对话框中移除灰色的输入。
- 取消选中“显示隐藏的输入”复选框以从对话框中移除灰色的输入。
-
将配置部件添加到装配体时,“配置”面板中的隐藏输入显示为灰色。
-
单击配置选择器中的
打开所有输入参数的“配置可见性条件”对话框。单击配置面板中的
以打开该输入参数的对话框。

The examples in this section show a configured Part Studio. Functionality is the same for configured Variable Studios.

You can copy and paste a configuration input into and out of Part Studios, assemblies, and Variable Studios. This makes it quick and easy to share configurations between designs.
-
Open the Configuration panel in the Part Studio, assembly, or Variable Studio that contains the input to copy.
-
Click the input's three-dot menu and select Copy input or Copy all inputs.
-
Open the Configuration panel in the tab to paste the input.
-
Click the arrow next to Configure Part Studio/Assembly/Variable Studio and select Paste inputs .
输入将插入到“配置”面板中。 -
Select the parameters to configure from the new tab. Continue reading to learn how to now copy input values and parameters into the input tables.
注释:
- You can copy and paste configuration inputs: between Part Studios, assemblies and Variable Studios; within the same document; and between different documents.
- 所有名称、可见性条件、FeatureScript ID 和变量定义都与输入一起复制。
- 在用户登出之前,复制的输入都可用。
- 复制的输入和粘贴的输入之间的参考不会保留;粘贴后,对原始配置输入的更改不会反映在粘贴的输入中。
- 如果目标配置没有计算可见性所需的所有输入,则粘贴的可见性条件将自动修复(移除)。
- 不粘贴具有相同内部 FeatureScript ID 的配置输入。要修复此问题,您可以删除具有相同内部 FeatureScript ID 的配置输入,然后重新粘贴。

您可以将配置复制并粘贴到配置中,以帮助输入或编辑值。
要复制值和参数,请执行以下操作:
- Open the
menu in the upper right corner of the Configuration panel.
- Select Copy table:
- 复制表格后,您可以将其粘贴到电子表格中:
请注意,列名也与表一起出现,如上所示。现在您可以编辑表格并将其复制/粘贴回 Onshape:
- 只选择具有数据的行和列(不是列名或标题),如下面的蓝色所示:
如果需要,您还可以为表格添加额外的空白行。在为复制命令进行选择时,只需包括电子表格中的额外行。
- Issue a Copy command.
- 在 Onshape 配置表中,单击表格左上角的单元格。
- Issue a keyboard Paste command:
Onshape 会自动将配置输入表的行和列中的数据替换为复制的数据。Onshape 还会自动包含每个输入的默认单位。
请注意,如果从电子表格复制的行数多于 Onshape 配置输入表格中的行数,则这些行不包含在粘贴中。Onshape 会立即创建行。
但是,如果从电子表格复制的列数多于 Onshape 配置输入表格中的列数,则这些列不包含在粘贴中。Onshape 尚未动态创建列。但是,在粘贴前,您可以在配置表格中创建其他列(参数)。

- Click an input name to rename it.
- To remove a value or description from a configuration, right-click it in the Variable Studio and click Unconfigure or Unconfigure from.
- To modify options in a configuration input, right-click the row.
Select from one of the following options:
- Switch to - Set the configuration to the option specified in the selected row.
- Set as default - Set the selected row as the default for the input.
- Duplicate row - Copy the selected row and insert the copy into the table.
- Move up/Move down - Reorder the rows in the table.
- Delete row - Delete the row from the table.
- Delete column - Delete the column from the table. The first column cannot be deleted.
- To modify a configuration input table, click its three-dot menu on the right side of the Configuration panel.
Select from one of the following options:
- Copy table/inputs/all inputs - Copy and paste input tables and values. See Copying configurations.
- Move up/move down - Reorder the tables in the Configuration panel.
- Rename - Rename a configuration input. You can also click an input name in the Configuration panel to rename it.
- Edit internal IDs - Open a dialog to change the internal FeatureScript identifiers of the configuration input. When finished, select Break reference and change IDs.
- 可见性条件 - 请参见设置可见性条件。
- Expand/collapse all inputs - Expand or collapse all inputs in the Configuration panel.
- Delete - Delete the configuration input table.