可用于:Feature Studio
Feature Studio 是 Onshape 中用于处理 FeatureScript 的页签,FeatureScript 是一种用于定义自定义特征的编程语言。
FeatureScript 由 Onshape 设计,用于创建特征和处理 3D 参数化模型。该语言内置于 Onshape 中,为 Part Studio 建模提供了基础,包括定义标准 Onshape 特征(如拉伸、圆角和抽壳)。
本页重点介绍如何使用 Feature Studio 用户界面。
——有关编写 FeatureScript 以创建自定义特征的信息,请参见“FeatureScript 文档”。
——有关将这些自定义特征添加到 Part Studio 的说明,请参见“自定义特征”。
The Feature Studio toolbar includes the following:
- Undo (
; ctrl/cmd+z ) - Undo the most recent change. - Redo (
; ctrl+y/shift+cmd+z ) - Repeat or redo the most recent change. - New feature (
) - Insert the basic framework for a new feature, which consists of a function declaration with the precondition and body within it. See the FeatureScript Docs for more information. - Parameters and functions lists - Insert the basic framework for parameters, queries, evaluations, math functions, sketch functions, and operations. On some screens, this option is collapsed into one list (as shown above); on other screens, each list is individual:
- Insert feature parameters
- Insert query functions
- Insert evaluation functions
- Insert math functions
- Insert sketch functions
- Insert operation functions
- Import (
) - Import a file, Part Studio, other Feature Studio, or Variable Studio from the current or another document. See Imports. - You can also create a version (
) and view the version graph (
) from this dialog. See Versions and History.
- You can also create a version (
- Format Studio (
) - Automatically format the current FeatureScript code. If this option is not visible on the toolbar, click the Import dropdown and select it from the menu. - Commit - Commit the current code changes. See Committing FeatureScript changes on this page.
- Search tools ( alt/option+c ) - Search for any of the parameters and functions available in the Parameters and functions lists, including their descriptions. To close the search box, click Close search, press the escape key, or click outside the box.
- Co-complete (
) - Use AI to help write FeatureScript code. See FeatureScript Co-Complete. - Monitor Part Studio (
) - Monitor a Part Studio's execution. See Debugging in Feature Studios. - Click the dropdown and select Profile Part Studio (
) to profile a Part Studio's execution. See Debugging in Feature Studios.
- Click the dropdown and select Profile Part Studio (
- Module outline (
) - Navigate through your FeatureScript code. See Navigating the outline on this page. - Back reference (
; ctrl/cmd+[ ) - Return your cursor to its previous position in your navigation history. - Forward reference (
; ctrl/cmd+] ) - Return your cursor to the next position in your navigation history. - Line - The line number of the current cursor location.
- Column - The column number of the current cursor location.
与 Onshape 中的所有页签一样,您的 FeatureScript 更改会在您键入时自动保存。要提交更改并在整个文档中应用新的 FeatureScript 代码,请单击“提交”按钮。
-
要仅在当前 Feature Studio 中提交更改,请单击“提交”按钮。
-
您也可以单击下拉列表并从菜单中选择“提交”。
-
您也可以按 cmd/ctrl + s
-
-
要提交文档中所有 Feature Studio 的所有更改,请单击“提交”按钮下拉菜单,然后选择“全部提交”。
-
下拉菜单中会在括号内显示有未提交更改的 Feature Studio 数量
-
您也可以按 cmd/ctrl + shift + s
-
-
单击菜单栏上的“搜索 Feature Studio”按钮 (
) 以打开“文本搜索”窗格,如上所示。-
您也可以使用 ctrl/cmd + shift + f 打开“文本搜索”窗格。
-
您可以通过右键单击符号,然后从环境菜单中选择“在工作区中查找用法”或“在工作区中重命名”来打开“符号搜索”窗格。

-
-
单击“搜索模式”下拉菜单可在文本、符号和标准库导入搜索之间切换。

-
(仅限文本搜索)在“查找文本”输入框中输入搜索文本。指定可选的搜索参数:
-
匹配大小写——勾选复选框以执行区分大小写的搜索。
-
正则表达式——勾选复选框以执行正则表达式搜索。
-
Feature Studio 名称筛选器——将搜索结果筛选为与输入文本匹配的页签。
-
-
(仅限标准库导入搜索)输入搜索选项以查找匹配的标准库导入:
-
包括和排除:——以逗号分隔列表的形式输入版本和版本范围。只有当导入的版本出现在“包括”列表中且不在“排除”列表中时,该导入才会出现在搜索结果中。
-
包括次版本(例如 3081.2)将仅返回该确切版本 (3081.2)。排除次版本(例如 3081)将返回该主版本内的所有次版本(3081.0、3081.1、3081.2、3081.3)。
-
版本范围(例如 3081.0-3081.2)是包括端点的。
-
使用短横线可匹配某版本之前(含该版本)的所有版本(例如 -3081.2),或某版本之后(含该版本)的所有版本(例如 3081.2-)。
-
以逗号分隔的搜索会返回匹配项的并集(例如 3079 - 3080, 3081.2 返回 3079 中的所有次版本、3080 中的所有次版本,以及 3081.2)。
-
将“包括”留空可匹配所有内容。将“排除”留空可不排除任何内容。
-
-
Feature Studio 名称筛选器——将搜索结果筛选为与输入文本匹配的页签。

-
-
单击 “查找”。
- 搜索结果会在 FeatureScript 代码中亮显。
-
使用展开 (
) 和折叠 (
) 按钮按 Feature Studio 页签查看结果。 -
使用展开搜索结果 (
) 和折叠搜索结果 (
) 按钮来展开或折叠所有结果。 -
单击搜索结果可跳转到其在 Feature Studio 中的位置。
-
(可选)要替换搜索文本、重命名符号或更新标准库导入版本,请执行以下操作:
-
单击“搜索模式”按钮左侧的“切换替换”箭头 (
)。 -
在“替换为”输入框中输入替换文本(文本或符号搜索),或在“将版本设置为”输入框中输入所需的版本号(标准库搜索)。您也可以从“将版本设置为”下拉列表中选择支持的版本。
-
单击“全部替换”(文本或标准库搜索)或“重命名”(符号搜索)。
-
单击 Feature Studio 工具栏上的模块大纲箭头以查看大纲。您还可以:
-
单击搜索结果可导航到 FeatureScript 代码的相应部分。
-
在“搜索符号”输入框中输入搜索文本以优化结果。
要获取其他学习中心资源,请遵循此处讲师指导的培训课程:Featu resScript 基础知识(需要 Onshape 帐户)。