Sketcher Workbench/zh-cn

草图工作台用于创建二维几何，用于零件设计工作台和其他工作台. 通常，2D几何被认为是大多数CAD模型的起点 - 简单的2D草图可以“挤压”成3D形状，另外可以使用2D草图在该形状的表面中创建凹坑，并且可以使用草图在3D对象的表面定义“垫高”（挤压）. 随着部件模块|布尔运算，草图编辑器形成了生成实体形状设计的核心.

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

一个基本的，全约束的草图

约束草图的基础
为了解释草图编辑器的工作原理，将其与“传统的”起草方式进行比较可能是有用的.

传统起草
CAD绘图的传统方式继承于旧的绘图板. 正交（2D）视图 手动绘制，用于生产技术图纸（也称为蓝图）. 对象被精确地绘制到预期的尺寸或尺寸上. 如果要从（0,0）开始绘制长度为100mm的水平线，您可以激活线条工具，点击屏幕或输入第一个点的（0,0）坐标，然后再次点击或在（100,0）处输入第二点坐标. 或者你会画你的线，而不考虑它的位置，然后移动它. 绘制几何图形后，可以向其添加尺寸.

约束草图
草图远离这个逻辑. 对象不需要完全按照您的意图进行绘制，因为它们将在稍后被约束定义. 对象可以松散绘制，只要不受约束，就可以进行修改. 它们实际上是“浮动”，可以移动，拉伸，旋转，缩放等等. 这在设计过程中给予了很大的灵活性.

什么是约束？
使用约束来限制对象的自由度. 例如，没有约束的线条具有4 自由度（简写为“DOF”）：可以水平或垂直移动，可以被拉伸，并且可以旋转.

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

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

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

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

如果您仅需要生成2D视图进行打印，并不想创建3D模型，请查看底图工作台（请注意，底图工作台也可用于创建此时草图编辑器中不可用的2D几何，如B-Splines. ）

草图工作流程
草图总是二维（2D）. 要创建一个实体，创建单个封闭区域的2D草图，然后垫高或旋转以添加第三维，从2D草图创建3D实体.

如果草图具有彼此交叉的段，其中一个点不直接位于段上的位置，或相邻段的端点之间存在间隙的位置，垫高或旋转将不会创建一个实体. 这个规则的例外是它不适用于构造（蓝色）几何对象.

在封闭区域内，我们可以有较小的非重叠区域. 当创建3D实体时，这些将变为空白.

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


 * [[Image:Sketcher_NewSketch.png‎‎|32px]] New sketch: 在所选的面或平面上创建新的草图. 如果在执行此工具时未选择任何面, 则系统将提示用户从弹出窗口中选择一个平面.


 * [[Image:Sketcher_EditSketch.png|32px]] Edit sketch: 编辑已选择的草图.


 * [[Image:Sketcher_LeaveSketch.png|32px]] Leave sketch: Leave the Sketch editing mode.


 * [[Image:Sketcher_ViewSketch.png‎|32px]] View sketch: Sets the model view perpendicular to the sketch plane.


 * [[Image:Sketcher ViewSection.png|32px]] View section: v0.18 and above Creates a section plane that temporarily hides any matter in front of the sketch plane.


 * [[Image:Sketcher_MapSketch.png‎|32px]] Map sketch to face: Maps a sketch to the previously selected face of a solid.


 * Reorient sketch : Allows you to change the position of a sketch


 * Validate sketch: It allows you to check if there are in the tolerance of different points and to match them.


 * [[Image:Sketcher MergeSketch.png‎|32px]] Merge sketches: Merge two or more sketches. [v 0.15]


 * [[Image:Sketcher MirrorSketch.png‎|32px]] Mirror sketch: Mirror a sketch along the x-axis, the y-axis or the origin [v 0.16]

Sketcher geometries
These are tools for creating objects.


 * [[Image:Sketcher_CreatePoint.png|32px]] Point: Draws a point.


 * [[Image:Sketcher_Line.png|32px]] Line by 2 point: Draws a line segment from 2 points.


 * [[Image:Sketcher_Arc.png|32px]] Arc: Draws an arc segment from center, radius, start angle and end angle.


 * [[Image:Sketcher CreateArc3Point.png|32px]] Arc by 3 Point: Draws an arc segment from two endpoints and another point on the circumference.


 * [[Image:Sketcher_Circle.png|32px]] Circle: Draws a circle from center and radius.


 * [[Image:Sketcher CreateCircle3Point.png|32px]] Circle by 3 Point : Draws a circle from three points on the circumference.


 * [[Image:Sketcher_Conics.png|32px]] Create a conic:
 * [[Image:Sketcher_CreateEllipse.png|32px]] Ellipse by center : Draws an ellipse by center point, major radius point and minor radius point. (v0.15)
 * [[Image:Sketcher_CreateEllipse_3points.png|32px]] Ellipse by 3 points : Draws an ellipse by major diameter (2 points) and minor radius point. (v0.15)
 * [[Image:Sketcher_Elliptical_Arc.png|32px]] Arc of ellipse : Draws an arc of ellipse by center point, major radius point, starting point and ending point. (v0.15)
 * [[Image:Sketcher_Hyperbolic_Arc.png|32px]] Arc of hyperbola: Draws an arc of hyperbola. (v0.17)
 * [[Image:Sketcher_Parabolic_Arc.png|32px]] Arc of parabola: Draws an arc of parabola. (v0.17)


 * [[Image:Sketcher_CreatePolyline.png|32px]] Polyline (multiple-point line): Draws a line made of multiple line segments. Pressing the M key while drawing a Polyline toggles between the different polyline modes.


 * [[Image:Sketcher_CreateRectangle.png|32px]] Rectangle: Draws a rectangle from 2 opposite points.


 * [[Image:Sketcher_CreateTriangle.png|32px]] Triangle: Draws a regular triangle inscribed in a construction geometry circle. (v0.15)


 * [[Image:Sketcher_CreateSquare.png|32px]] Square: Draws a regular square inscribed in a construction geometry circle. (v0.15)


 * [[Image:Sketcher_CreatePentagon.png|32px]] Pentagon: Draws a regular pentagon inscribed in a construction geometry circle. (v0.15)


 * [[Image:Sketcher_CreateHexagon.png|32px]] Hexagon: Draws a regular hexagon inscribed in a construction geometry circle. (v0.15)


 * [[Image:Sketcher_CreateHeptagon.png|32px]] Heptagon: Draws a regular heptagon inscribed in a construction geometry circle. (v0.15)


 * [[Image:Sketcher_CreateOctagon.png|32px]] Octagon: Draws a regular octagon inscribed in a construction geometry circle. (v0.15)


 * [[Image:Sketcher_CreateSlot.png|32px]] Slot: Draws an oval by selecting the center of one semicircle and an endpoint of the other semicircle.


 * [[Image:Sketcher_CreateFillet.png|32px]] Fillet: Makes a fillet between two lines joined at one point. Select both lines or click on the corner point, then activate the tool.


 * [[Image:Sketcher_Trimming.png|32px]] Trimming: Trims a line, circle or arc with respect to the clicked point.


 * [[Image:Sketcher_External.png|32px]] External Geometry: Creates an edge linked to external geometry.


 * [[Image:Sketcher_ToggleConstruction.png|32px]] Construction Mode: Toggles sketch geometry from/to construction mode. Construction geometry is shown in blue and is discarded outside of Sketch editing mode.

Sketcher constraints
Constraints are used to define lengths, set rules between sketch elements, and to lock the sketch along the vertical and horizontal axes. Some constraints require use of Helper constraints.

Geometric constraints
These constraints are not associated with numeric data.


 * [[Image:Constraint_PointOnPoint.png|32px]] Coincident: Affixes a point onto (coincident with) one or more other points.


 * [[Image:Constraint_PointOnObject.png|32px]] Point On Object: Affixes a point onto another object such as a line, arc, or axis.


 * [[Image:Constraint_Vertical.png|32px]] Vertical: Constrains the selected lines or polyline elements to a true vertical orientation. More than one object can be selected before applying this constraint.


 * [[Image:Constraint_Horizontal.png|32px]] Horizontal: Constrains the selected lines or polyline elements to a true horizontal orientation. More than one object can be selected before applying this constraint.


 * [[Image:Constraint_Parallel.png|32px]] Parallel: Constrains two or more lines parallel to one another.


 * [[Image:Constraint_Perpendicular.png|32px]] Perpendicular: Constrains two lines perpendicular to one another, or constrains a line perpendicular to an arc endpoint.


 * [[Image:Constraint_Tangent.png|32px]] Tangent: Creates a tangent constraint between two selected entities, or a co-linear constraint between two line segments. A line segment does not have to lie directly on an arc or circle to be constrained tangent to that arc or circle.


 * [[Image:Constraint_EqualLength.png|32px]] Equal Length: Constrains two selected entities equal to one another. If used on circles or arcs their radii will be set equal.


 * [[Image:Constraint_Symmetric.png|32px]] Symmetric: Constrains two points symmetrically about a line, or constrains the first two selected points symmetrically about a third selected point.


 * [[Image:Sketcher_ConstrainBlock.png|32px]] Constrain Block: v0.17 and above Basically allows to block a geometric element in place with a single constraint. It should be particularly useful to work with B-Splines. See the Block Constraint forum topic.

Dimensional constraints
These are constraints associated with numeric data, for which you can use the expressions. The data may be taken from a spreadsheet.


 * [[Image:Sketcher_ConstrainLock.png‎|32px]] Lock: Constrains the selected item by setting vertical and horizontal distances relative to the origin, thereby locking the location of that item. These constraint distances can be edited later.


 * [[Image:Constraint_HorizontalDistance.png‎|32px]] 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.


 * [[Image:Constraint_VerticalDistance.png|32px]] Vertical Distance: Fixes the vertical distance between 2 points or line endpoints. If only one item is selected, the distance is set to the origin.


 * [[Image:Constraint_Length.png|32px]] Distance: Defines the distance of a selected line by constraining its length, or defines the distance between two points by constraining the distance between them.


 * [[Image:Constraint_Radius.png|32px]] Radius: Defines the radius of a selected arc or circle by constraining the radius.
 * [[Image:Constraint_InternalAngle.png|32px]] Internal Angle: Defines the internal angle between two selected lines.


 * [[Image:Constraint_SnellsLaw.png|32px]] Snell's Law: Constrains two lines to obey a refraction law to simulate the light going through an interface. (v 0.15)


 * [[Image:Constraint_InternalAlignment.png |32px]] Internal Alignment: Aligns selected elements to selected shape (e.g. a line to become major axis of an ellipse).


 * [[Image:Sketcher_ToggleConstraint.png |32px]] Toggle Constraint: Toggles the toolbar or the selected constraints to/from reference mode. v0.16

Sketcher tools

 * Sketcher SelectElementsWithDoFs.svg Select solver DOFs: v0.18 and above Highlights in green the geometry with degrees of freedom (DOFs), i.e. not fully constrained.


 * [[Image:Sketcher CloseShape.png‎|32px]] Close Shape: Creates a closed shape by applying coincident constraints to endpoints [v 0.15]


 * [[Image:Sketcher ConnectLines.png‎|32px]] Connect Edges: Connect sketcher elements by applying coincident constraints to endpoints [v 0.15]


 * [[Image:Sketcher SelectConstraints.png‎|32px]] Select Constraints: Selects the constraints of a sketcher element [v 0.15]


 * [[Image:Sketcher SelectOrigin.png‎|32px]] Select Origin: Selects the origin of a sketch [v 0.15]


 * [[Image:Sketcher SelectVerticalAxis.png‎|32px]] Select Vertical Axis: Selects the vertical axis of a sketch [v 0.15]


 * [[Image:Sketcher SelectHorizontalAxis.png‎|32px]] Select Horizontal Axis: Selects the horizontal axis of a sketch [v 0.15]


 * [[Image:Sketcher SelectRedundantConstraints.png‎|32px]] Select Redundant Constraints: Selects redundant constraints of a sketch [v 0.15]


 * [[Image:Sketcher SelectConflictingConstraints.png‎|32px]] Select Conflicting Constraints: Selects conflicting constraints of a sketch [v 0.15]


 * [[Image:Sketcher SelectElementsAssociatedWithConstraints.png‎|32px]] Select Elements Associated with constraints: Select sketcher elements associated with constraints [v 0.15]


 * Sketcher Element Ellipse All.svg Show/hide internal geometry: Toggles the visibility of internal geometry of ellipses, arcs of hyperbola and parabola and B-splines.


 * Sketcher_Element_Ellipse_All.png‎ Show/Hide internal geometry: Recreates missing/deletes unneeded internal geometry of a selected ellipse, arc of ellipse/hyperbola/parabola or B-spline.


 * [[Image:Sketcher Symmetry.png‎|32px]] Symmetry: Copies a sketcher element symmetrical to a chosen line [v 0.16]


 * [[Image:Sketcher Clone.png‎|32px]] Clone: Clones a sketcher element [v 0.16]


 * [[Image:Sketcher Copy.png‎|32px]] Copy: Copies a sketcher element [v 0.16]


 * Sketcher_Move.svg Move: v0.18 and above Moves the selected geometry taking as reference the last selected point.


 * [[Image:Sketcher RectangularArray.png‎|32px]] Rectangular Array: Creates an array of selected sketcher elements [v 0.16]


 * Sketcher Element SelectionTypeInvalid.svg Delete All Geometry: v0.18 and above Deletes all geometry from the sketch.


 * Sketcher Element SelectionTypeInvalid.svg Delete All Constraints: v0.18 and above Deletes all constraints from the sketch.

Sketcher B-spline tools

 * Sketcher_BSplineDegree.svg Show/Hide B-spline degree


 * Sketcher_BSplinePolygon.svg Show/Hide B-spline control polygon


 * Sketcher_BSplineComb.svg Show/Hide B-spline curvature comb


 * Sketcher_BSplineKnotMultiplicity.svg Show/Hide B-spline knot multiplicity


 * Sketcher_BSplineApproximate.svg Convert Geometry to B-spline


 * Sketcher_BSplineIncreaseDegree.svg Increase degree


 * Sketcher_BSplineIncreaseKnotMultiplicity.svg Increase knot multiplicity


 * Sketcher_BSplineDecreaseKnotMultiplicity.svg Decrease knot multiplicity

Sketcher virtual space

 * [[Image:Sketcher SwitchVirtualSpace.png‎|32px]] Switch Virtual Space: v0.17 Allows you to "hide" constraints and make them visible again. See https://forum.freecadweb.org/viewtopic.php?f=9&t=26614

Preferences

 * [[Image:Std_DlgParameter.png|32px]] Preferences...: Preferences disposable in Sketcher Tools.

最佳做法
每个CAD用户随着时间的推移发展自己的工作方式，但跟随一些有用的一般原则.


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

教程

 * 草图编辑器教程
 * 草图编辑器教程为初学者
 * 草图编辑器微教程 - 约束实践