Variable Studio
本主题介绍使用 Variable Studio 创建变量的功能和机制,这些变量可在创建它们时所在的文档以及其他文档中使用。您只能通过 Onshape 的浏览器平台创建 Variable Studio,但可以在所有移动平台上使用变量。
Variable Studio 是在文档中创建的,其中的变量可立即在该文档工作区的所有 Part Studio 和装配体中使用。
创建 Variable Studio
-
在文档中,使用
菜单创建 Variable Studio:
-
Variable Studio 将打开,其中一个变量表可用于输入:
-
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 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.
可以使用之前在表中定义的变量,稍后在该表中定义其他变量的值。例如:
L1 变量(桌边的长度)用于计算 W1 变量(桌面的宽度)。
要使变量可用于工作区中的所有 Part Studio 和装配体,请选中“Variable Studio”选项卡底部边缘的框:
取消选中此框可移除在此文档的工作区中的 Part Studio 和装配体中使用变量的功能。(如果变量处于草稿状态,则保持此框为取消选中;如果变量可供使用,则选中此框。)
在其他文档中参考变量表
要在定义变量表的文档以外的文档中使用它(以及其中定义的变量):
-
打开您要在其中将在 Variable Studio 中定义的变量用于其他文档的文档。
-
使用
按钮可创建 Variable Studio。
-
在新的 Variable Studio 中,单击顶部的插入 Variable Studio按钮。“插入 Variable Studio”对话框将会打开:
-
在要查找变量表的对话框的顶部选择两个选项卡中的一个:“当前文档”或“其他文档”。
如果在当前文档中有任何 Variable Studio,它们将在“当前文档”下列出。要在其他文档中找到 Variable Studio,请选择“其他文档”选项卡:
可以选择整个 Variable Studio 表(上图显示为 Variable Studio 1),也可以从列表中选择一个或多个不同的变量。您所做的选择在当前文档中立即可用。如果从其他文档插入变量表或变量,该文档必须具有包含这些变量的版本。如果版本不存在,系统会提示您创建一个,然后再继续。
成功选择变量和/或变量表后,您会在当前文档的 Variable Studio 中看到所选的图元:
从其插入表的 Variable Studio 的名称和版本会显示在表的顶部,在上图中显示为 Variable Studio 1 V1。
发布 Variable Studio
右击 Variable Studio 选项卡并选择“发布”:
如需其他学习中心资源,请注册以下课程:变量和表达式(需要 Onshape 帐户)。