处理约束
正在创建草图或打开草图进行编辑时,可以使用和查看约束。

在两个草图中的两个图元之间应用的约束(例如,将一个草图中的图元在另一个草图中“使用”时)由蓝色背景来区分。可以手动应用约束,某些约束是在绘制草图过程中创建几何图元时创建的。悬停光标时,参照的约束的背景为深蓝色:
上方显示的“使用”约束(带有蓝色背景)以圆草图中圆的中心点约束矩形草图中的一个顶点。



“约束”草图工具可让您在创建草图或打开草图以进行编辑时查看和更改约束。在两个草图中的图元之间应用的约束(例如,将一个草图中的图元用在另一个草图中时)由蓝色背景来区分。您可以手动应用约束,并且在您绘制草图的过程中,某些约束会在您创建几何图元时一同创建。悬停鼠标时,参照的约束背景为深蓝色。
有多个约束可用:重合、同心、平行、相切、水平、竖直、垂直、等长、中点、法向、穿透、对称、固定和曲率。可以使用推断功能自动将约束添加到草图,或者使用工具栏手动添加约束。
在此示例中,在竖直构造线和圆之间添加了中点约束。选择圆的中点和构造线。在草图工具栏上单击“中点”约束工具。可以为不同的约束仿真此过程。或者,您可以先从草图工具栏中选择“中点”约束工具,然后选择构造线和圆。

要应用工程图约束,请执行以下任一操作:
-
从菜单中选择约束(或使用其相应的快捷方式),然后在草图中选择要应用约束的图元。
-
选择草图图元,然后在工具栏的约束菜单上单击该约束。
工具栏约束菜单提供以下约束:
-
重合 - 使 2 个或更多草图图元在草图中共享相同位置。
-
同心 - 使任意点与圆弧或圆的中心重合。使选定的弧线和圆共享一个中心点。
-
平行 - 使 2 条或更多条线平行。
-
切线 - 在 2 个草图图元之间或草图图元和平面之间建立切线关系。
-
水平 - 将 1 条或多条线或一组点限制为水平线。
-
垂直 - 将 1 条或多条直线或一组点限制为垂直线。
-
正交垂直 - 使两条线垂直。
-
相等 - 使多条线的长度相等,或多条弧的半径相等。
-
中点 - 将草图点限制在直线或圆弧的中点。
-
法向 - 使曲线和直线,或曲线和平面垂直。
-
穿透 - 使草图图元与活动草图平面外的另一个实体重合。
-
对称 - 使 2 个相同类型的实体相对于直线、平面或线性边对称。
-
固定 - 将草图图元锁定在草图平面上,这样它就不会移动。
-
曲率 - 在草图样条或圆锥与周围几何图元之间创建曲率连续过渡。

在草图打开的情况下,将光标悬停在一个草图图元(如线或圆弧)上方以查看该图元的约束。当您移动鼠标以将光标悬停在多个图元上方时,将仅显示亮显图元的约束。要使所有约束保持可见状态,请在按住 Shift 键的同时移动鼠标。
将光标悬停在图元上方时,图元将以橙色亮显,但参照的约束除外,这些约束带有蓝色背景,将光标悬停在其上方时,它们带有深蓝色背景。相关的图元将以黄色亮显,选择约束时,配套的图元也会亮显。

以下约束未在工具栏的“约束”部分提供,而是在特定操作期间自动创建的,如下所述:
-
象限 - 约束点与椭圆重合,与该椭圆的长轴或短轴重合。创建的方法可以是推断、将某个对象拖动到或将某个对象放置到椭圆的一个点上。
-
使用 - 将一个草图中的草图图元约束为另一个草图中的图元。创建的方法是先选择“使用”工具,然后选择其他草图或特征中的图元(草图图元、面或边)。
-
相交 - 使用穿透约束
来约束开放曲线的端点(因使用相交工具而产生),以使它们位于相交面的边上;对于闭合曲线,使用相交约束来约束草图图元。

草图图元的颜色指示其约束的状态:
- 蓝色表示约束不足。
- 黑色表示完全约束。
- 红色表示约束存在问题(过度约束)。
约束图标的颜色表示其约束状态:
- 灰底黑色意味着定义良好。
- 红底白色表示有问题。
- 选择时,非完全约束的草图点(蓝色和红色)优先于任何重叠的完全约束的草图点(黑色)。
添加更多尺寸或约束将进一步约束草图。拖动图元可帮助您了解可能要添加哪些约束或尺寸。

View and filter the sketch constraints and dimensions in order to analyze them and correct any sketch constraint errors.
Accessing the Constraint manager
From the Sketch dialog:
-
Click the Show sketch diagnostic tools icon (
).
-
Click Constraint manager.
The Constraint manager dialog opens:
Using the Constraint manager
From the Constraint manager dialog, you can do the following:
-
Filters - Collapse/Expand all dialog sections at once (Type, Mode, Status).
-
Automatically select constraints - When toggled on (default), any constraint selected in the Constraint manager dialog places a yellow bounding box around corresponding constraints in the sketch. When off, constraints will not have a bounding box placed around them (they are not selected).
This option is useful if you want to select only those constraints from a specific part of the sketch. For example, toggle this option off. Select the constraints Type you want to locate in the portion of your sketch (for example, coincident constraints in the example below). Then create a selection box around a portion of your sketch (a rectangle in the example below). Only constraints for that section display bounding boxes around them and are available from the Entities and constraints list (see below).
Disabling "Automatically select constraints" and then box-selecting the rectangle in the sketch (left). Once selected, the filters only apply to the selected sketch entity. In the example here, coincident constraints are only shown for the previously-selected rectangle (right).
-
Type - Select from a list of available constraints. For example, selecting Coincident places a yellow bounding box around all coincident constraints in the sketch (provided Automatically select constraints is enabled).
-
Mode - Select from the following 3 modes:
-
Internal - Selects constraints from the current sketch.
-
External - Selects constraints from external sources.
-
In context - Selects constraints referenced in context
-
-
Status - Select from the following 3 statuses:
-
Driven - Driven constraints. When selected, driven constraints are highlighted yellow. If they are under-constrained, they are highlighted a darker blue.
-
Solved - Solved constraints. When selected, solved constraints are highlighted yellow. If they are under-constrained, they are highlighted a darker blue.
-
Errors - Constraints in error. When selected, constraints in error are highlighted a darker red,
-
-
Sort by constraint - Sorts the Entities and constraints list below by constraint first, then entity second.
-
Sort by entity - Sorts the Entities and constraints list below by entity first, then constraint second.
-
Entities and constraints list - Displays all selected constraints, depending on the filter selections in the dialog. Hovering over a constraint or entity in the list highlights it in the sketch. From this list, you can:
-
Delete constraint (
) - Deletes the constraint from the sketch.
-
Remove selection (
) - Removes the constraint from the Entities and constraints list.
Sort by constraint (left); Sort by entity (right)
Right-click on a constraint or entity in the Entities and constraints list to access the following commands:
-
Delete constraint/entity - Deletes the selection (constraint or entity)
-
Zoom to selection - Zooms in to the selection (constraint or entity)
-
Hide external references - Hides all externally referenced constraints
-
Clear all - Clears all constraints from the Entities and constraints list
-
-
-
Delete all button - Deletes all selected constraints from the sketch.
Turning Constraint manager off
To turn off the Constraint manager, either:
-
Click X at the top right corner of the Constraint manager dialog.
-
Click the Show sketch diagnostic tools icon (
) and select Turn constraint manager off:
提示
-
Select as many types, modes and statuses from the dialog to filter the constraints to what is selected. These filters can be used in any combination.
-
If Show constraints and Show errors are disabled in the Sketch dialog, hovering over the constraint in the Entities and constraints list displays only that constraint (and related entities) in the sketch:
-
Selecting an entity in the Entities and constraints list highlights the entity in light yellow:
-
Constraint manager also works with sketches in the Sheet metal flat pattern view:

您可以与约束图标交互:
- 单击一个图标或一组图标并将其拖动到不同的位置。
- 将光标悬停在单个约束图标上方以查看哪些图元亮显,从而指示对其应用的约束。
- 删除约束:单击单个约束图标并按 Delete 键或从环境菜单中选择“删除”。
- 在草图对话框中,选中“显示约束”以显示为草图定义的所有约束。
- 冲突的约束显示为红色背景上的白色符号。
绘制草图时,随着曲线捕捉到推断,约束指示符会出现在鼠标光标旁边。

添加、应用和编辑约束可帮助在 Onshape 中定义零件。当正在创建草图或打开草图进行编辑时,会在草图对话框中列出约束。
可以在一个草图中的图元之间或者在两个或更多草图中的图元之间应用约束(例如,将一个草图中的图元在另一个草图中使用时)。可以手动应用约束,某些约束是在绘制草图过程中创建几何图元时创建的。请参见自动推断,详细了解有关自动创建约束的信息。
在草图对话框中,轻按列表中的约束以亮显相关的草图几何图元。例如,如果两条线在水平方向上相互约束并且您轻按水平约束,则会亮显这两条线。
添加、应用和编辑约束可帮助在 Onshape 中定义零件。仅当正在创建草图或打开草图进行编辑时,才能使用和查看约束。
有关在移动设备上使用特定约束的信息,请参阅特定约束主题。