草图工作台

From FreeCAD Documentation
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This page is a translated version of the page Sketcher Workbench and the translation is 9% complete.
Outdated translations are marked like this.
This page has been marked for translation. But it is still a work in progress!!!
Sketcher workbench icon

简介

草图工作台用于创建用于 零件工作台 建筑工作台和其他工作台的二维几何图形。 通常,二维绘图被视为大多数CAD模型的起点,因为二维草图可以“拉伸”以创建三维形状;进一步的二维草图可以用于在先前构建的三维形状的基础上创建其他特征,如开槽“Pocket”、隆起“ridges”或拉伸。 草图绘制器与在零件设计工作台中定义的布尔操作一起构成了构建实体的构造实体几何方法的基础。此外,草图绘制器还与零件设计工作台操作一起构成了创建实体的特征编辑方法的基础。

Together with boolean operations defined in the Part Workbench, the Sketcher Workbench, or "The Sketcher" for short, forms the basis of the constructive solid geometry (CSG) method of building solids. Together with PartDesign Workbench operations, it also forms the basis of the feature editing methodology of creating solids. But many other workbenches use sketches as well.

草图工作台本身具有约束条件 - 允许将2D形状约束到精确的几何定义。以及一个约束求解器,它计算二维几何约束范围,并允许对草图自由度的交互式探索。

草图编辑器不擅长于

草图编辑器不打算制作2D蓝图。草图一旦用于生成实体特征后,会自动隐藏。约束仅在草图编辑模式下可见。

一个全约束草图

Constraints

什么是约束?

使用约束来限制对象的自由度。例如,没有约束的线条具有4 自由度(简写为“DOF”):可以水平或垂直移动,可以被拉伸,并且可以旋转。

应用水平或垂直约束或角度约束(相对于另一条线或与其中一条轴)将限制其旋转能力,从而使其具有3个自由度。锁定其原点之一的点将消除另外2个自由度。并且应用维度约束将消除最后的自由度。然后,该行被认为是“完全受限制的”。

多个对象可以彼此约束。可以通过其中一个点与重合点约束连接两条线。可以在它们之间设置一个角度,或者它们可以垂直设置。一条线可以与弧或圆相切,依此类推。具有多个对象的复杂草图将具有多种不同的解决方案,并使其“完全受约束”,这意味着基于所应用的约束只能达到其中一种可能的解决方案。

有两种约束:几何和尺寸。它们在下面的'工具'部分中详细介绍。

Driving vs. reference constraints

Edit constraints

When a driving constraint is created, and if the Ask for value after creating a dimensional constraint preference is selected (default), a dialog opens to edit its value.

Sketcher_Edit_Constraint.png

You can enter a numerical value or an expression, and it is possible to name the constraint to facilitate its use in other expressions. You can also check the Reference checkbox to switch the constrain to reference mode.

To edit the value of an existing dimensional constraint do one of the following:

  • Double-click the constraint value in the 3D view.
  • Double-click the constraint in the Sketcher Dialog.
  • Right-click the constraint in the Sketcher Dialog and select the Change value option from the context menu.

Reposition constraints

Constraints can be repositioned in the 3D view by dragging. Hold down the left mouse button over the constraint value and move the mouse.

Profile sketches

To create a sketch that can be used as a profile for generating solids certain rules must be followed:

  • The sketch must contain only closed contours. Gaps between endpoints, however small, are not allowed.
  • Contours can be nested, to create voids, but should not self-intersect or intersect other contours.
  • Contours cannot share edges with other contours. Duplicate edges should be avoided.
  • T-connections, that is more than two edges sharing a common point, or a point touching an edge, are not allowed.

These rules do not apply to construction geometry (default color blue), which is not shown outside edit mode, or if the sketch is used for a different purpose. Depending on the workbench and the tool that will use the profile sketch, additional restrictions may apply.

Drawing aids

The Sketcher Workbench has several drawing aids and other features that can help when creating geometry and applying constraints.

Continue modes

There are two continue modes: Geometry creation "Continue Mode" and Constraint creation "Continue Mode". If these are checked (default) in the preferences, related tools will restart after finishing. To exit an continuous tool press Esc or the right mouse button. This must be repeated if a continuous geometry tool has already received input. You can also exit a continuous tool by starting another geometry or constraint creation tool. Note that pressing Esc if no tool is active will exit sketch edit mode. Uncheck the Esc can leave sketch edit mode preference if you often inadvertently press Esc too many times.

Auto constraints

In sketches that have Auto constraints checked (default) several constraints are applied automatically when hovering the cursor properly (their symbols are displayed next to the cursor before applying). This is a per-sketch setting that can be changed in the Sketcher Dialog or by changing the 视图Autoconstraints property of the sketch. The following constraints are applied automatically:

Snapping

introduced in version 0.21

It is possible to snap to grid lines and grid intersection, to edges of geometry and midpoints of lines and arcs, and to certain angles. Please note that snapping does not produce constraints in and of itself. For example, only if Auto constraints is switched on will snapping to an edge produce a Point on object constraint. But just picking a point on the edge would then have the same result.

On-View-Parameters

introduced in version 0.22

Depending on the selected option in the preferences only the dimensional On-View-Parameters or both the dimensional and the positional On-View-Parameters can be enabled. Positional parameters allow the input of exact coordinates, for example the center of a circle, or the start point of a line. Dimensional parameters allow the input of exact dimensions, for example the radius of a circle, or the length and angle of a line. On-View-Parameters are not available for all tools.

Determining the center point of a circle with the positional parameters enabled

Determining the radius of a circle with the dimensional parameters enabled

If values are entered and confirmed by pressing Enter or Tab, related constraints are added automatically. If two parameters are displayed at the same time, for example the X and Y coordinate of a point, it is possible to enter one value and pick a point to define the other. Depending on the object additional constraints may be required to fully constrain it. Constraints resulting from On-View-Parameters take precedence over those that may result from Auto constraints.

Arc created by entering all On-View-Parameters with resulting automatically created constraints

Coordinate display

If the Show coordinates beside cursor while editing preference is checked (default), the parameters of the current geometry tool (coordinates, radius, or length and angle) are displayed next to the cursor. This is deactivated while On-View-Parameters are shown.

Selection

No need for Ctrl, but... Select in Sketcher Dialog...

Box selection

Connected geometry selection

Copy, cut and paste

introduced in version 0.22

The standard keyboard shortcuts can be used to copy, Ctrl+C, cut, Ctrl+X, and paste, Ctrl+V, the currently selected Sketcher geometry including related constraints. But these tools are also available from the Sketch → Sketcher tools menu. They can be used within the same sketch but also between different sketches or separate instances of FreeCAD. Since the data is copied to the clipboard in the form of Python code, it can be used in other ways too (e.g. shared on the forum).

Tools

工具

草图工作台工具都位于加载草图工作台时出现的草图菜单中。

introduced in version 0.21: If a sketch is in edit mode the Structure toolbar is hidden as none of its tools can then be used.

General

Sketcher toolbar

  • 创建草图: 在所选的面或平面上创建新的草图。如果在执行此工具时未选择任何面, 则系统将提示用户从弹出窗口中选择一个平面。
  • 校验草图…: 它允许你检查是否有不同点的公差和匹配。

Sketcher Edit Mode toolbar

  • 查看草图: 设置垂直于草图平面的模型视图。
  • 查看截面: 创建一个截面,并暂时隐藏此草图平面前侧的所有内容。

Sketcher edit tools toolbar

Other

  • Stop operation: Stops any currently running geometry or constraint creation tool.

草图编辑器几何工具

这是创建对象的工具。

  • Line by 2 point: 从2点绘制线段。对于特定的约束而言,此工具绘制的是无限长的直线。
  • Create arc:
  • Arc: 从中心,半径,起始角度和最终角度绘制弧段。
  • Arc by 3 Point: 根据圆周上的两个端点以及圆周上的另一个点来绘制弧段。
  • Create circle:
  • Circle: 从中心和半径画一个圆。
  • Create conic:
  • Ellipse by center: Draws an ellipse by center point, major radius point and minor radius point.
  • Arc of ellipse: Draws an arc of ellipse by center point, major radius point, starting point and ending point.
  • B-spline:
  • Create rectangle:
  • Rectangle: 从两个相反的点绘制一个矩形。
  • Create regular polygon:
  • Triangle: 在几何圆草图中绘制一个正三角形。
  • Square: 在几何圆草图中绘制一个正方形。
  • Pentagon: 在几何圆草图中绘制一个正五面。
  • Hexagon: 在几何圆草图中绘制一个正六边形。
  • Heptagon: 在几何圆草图中绘制一个正七边形。
  • Octagon: 在几何圆草图中绘制一个正八边形。
  • Create Regular Polygon : 根据指定的边数与拾取的两个点:中点与一个角点来绘制一个正多边形。
  • Create slot:
  • Slot: 通过选择一个半圆的中心和另一个半圆的终点绘制椭圆。
  • Create fillet/chamfer:
  • Fillet: 在一条线之间加入两条线之间的圆角。选择两行或单击角点,然后激活该工具。
  • Chamfer: Creates a chamfer between two non-parallel edges.
  • Edit edge:
  • Trimming: 相对于点击的点修剪线,圆或圆弧。
  • Construction Mode: 将元素切换 到/从 草图模式。对象草图不会在3D几何操作中使用,并且仅在编辑包含它的草图时可见。这是 v0.15 中使用的图标。直到FreeCAD v0.16,用户必须先在草图编辑器中创建常规(白色)几何对象,然后使用此工具将其更改为“几何草图”(蓝色)。
  • Construction Mode: 在FreeCAD v0.16中,添加了在构造模式下直接创建几何的能力,因此图标已更改为该图形。选择现有的草图编辑器几何图形,然后单击此工具可以在常规和构造模式之间切换几何图形,就像以前的FreeCAD版本一样。从FreeCAD v0.16开始,当没有选择草图编辑器几何图形时,选择此工具会更改将要创建将来的对象的模式(常规与构造)。

草图编辑器约束

约束用于定义长度、在草图元素之间设置规则以及沿垂直和水平轴锁定草图。某些约束要求 辅助约束

  • Coincident: 在一个或多个点上(同时)附加一个点。
  • Point On Object: 将点附加到另一对象上, 如直线、圆弧或轴。
  • Horizontal/Vertical constraints:
  • Horizontal: 将所选线条或折线元素约束为真正的水平方向。在应用此约束之前, 可以选择多个对象。
  • Vertical: 将所选线条或折线元素约束为真正的垂直方向。在应用此约束之前, 可以选择多个对象。
  • Parallel: 约束两条或多行平行于彼此。
  • Perpendicular: 约束两条垂直于彼此的线, 或约束垂直于弧线端点的直线。
  • Tangent: 在两个所选实体之间创建切线约束, 或在两个线段之间建立共线约束。 直线段不必直接位于圆弧或圆上, 而将其与圆弧或圆相切。
  • Equal Length: 约束两个选定的实体彼此相等。 如果在圆或弧形上使用它们的半径将被设置为相等。
  • Symmetric: 将两个点对称地约束在一条直线上, 或者将前两个点对称地限制在第三个选定点上。
  • Block: it blocks an edge from moving, that is, it prevents its vertices from changing their current positions. It should be particularly useful to fix the position of B-Splines. See the Block Constraint forum topic.
  • Dimensional constraints:
  • Horizontal distance: Fixes the horizontal distance between two points or line endpoints. If only one item is selected, the distance is set to the origin.
  • Vertical Distance: 修复两点或线端点之间的水平距离。如果只选择一项, 则将距离设置为原点。
  • Distance: 通过限制选定行的长度来定义其距离, 或通过限制两点之间的距离来定义它们之间的距离。
  • Radius: 通过限制半径来定义所选圆弧或圆的半径。
  • Internal Angle: 定义两个选定行之间的内部角度。
  • Diameter: Defines the diameter of an arc or circle.
  • Angle: Defines the internal angle between two selected lines.
  • Lock: 通过设置相对于原点的垂直和水平距离来约束选定项, 从而锁定该项的位置。这些约束距离可以在以后进行编辑。

Special constraints

Constraint tools

The following tools can be used the change the effect of constraints:

草图工具

  • Show/hide internal geometry: Recreates missing/deletes unneeded internal geometry of a selected ellipse, arc of ellipse/hyperbola/parabola or B-spline.
  • Symmetry: Copies a Sketcher element symmetrically to a chosen line.

Sketcher B-spline tools

Sketcher visual

Obsolete tools

  • Clone: Clones a Sketcher element. Not available in version 0.22 and above.
  • Corner-preserving fillet: Creates a fillet between two non-parallel lines while preserving their corner point. Not available in version 0.22 and above.
  • Copy: Copies a Sketcher element. Not available in version 0.22 and above.
  • Move: Moves the selected geometry taking as reference the last selected point. Not available in version 0.22 and above.
  • Rectangular array: Creates an array of selected Sketcher elements. Not available in version 0.22 and above.

Preferences

Best practices

最佳做法

每个CAD用户随着时间的推移发展自己的工作方式,但跟随一些有用的一般原则。

  • 一系列简单的草图比单个复杂的草图更容易管理。例如,可以为基础3D特征(衬垫或旋转)创建第一个草图,而第二个可以包含孔或切口(凹坑)。一些细节可以省略,稍后将作为3D功能实现。如果太多,你可以选择避免草图中的圆角,并将其添加为3D功能。
  • 始终创建一个封闭的配置文件,或者你的草图不会产生实体,而是一组开放的面。如果你不希望将某些对象包含在实体创建中,请使用“构造模式”工具将其转换为构造元素。
  • 使用自动约束特性来限制你必须手动添加的约束数量。
  • 作为一般规则,首先应用几何约束,然后应用尺寸约束,并最后锁定草图。但请记住:规则被破坏。如果你在操作草图时遇到问题,在完成配置文件之前先限制几个对象可能很有用。
  • 如果可能,将草图中心定位到具有锁定约束的原点(0,0)。如果你的草图不对称,请将其中一个点定位到原点,或者为锁定距离选择好的圆角参数。在v0.12中,外部约束(将草图约束到现有3D几何像边缘或其他草图)未实现。这意味着要将以下草图定位到你的第一个草图中,你需要手动设置相对于你的第一个草图的距离。一个基于原点的(25,75)的锁定约束比(23.47,73.02)更容易记住。
  • 如果你有可能在长度约束和水平或垂直距离约束之间进行选择,则选择后者。水平和垂直距离约束在计算上更便宜。
  • 一般来说,最好使用的约束是:水平和垂直约束;水平和垂直长度约束;点对点相切。如果可能,限制使用这些:一般长度约束;边缘到边缘相切;固定点到线约束;对称约束

教程

Scripting

The Sketcher scripting page contains examples on how to create constraints from Python scripts.

Examples

For some ideas of what can be achieved with Sketcher tools, have a look at: Sketcher examples.