| Topic |
|---|
| Sketcher |
| Level |
| Beginner |
| Time to complete |
| 10 minutes |
| Authors |
| Drei |
| FreeCAD version |
| 0.16 or above |
| Example files |
| See also |
| None |
This tutorial was originally written by Drei, and it was rewritten and illustrated by vocx.
This tutorial is meant to introduce the reader to the basic workflow of the Sketcher Workbench.
The Sketcher Workbench exists as a standalone module, so it can be used to draw generic 2D (planar) objects. However, it is mostly used in conjunction with the PartDesign Workbench. A closed sketch is normally used to create a face or a profile to be extruded into a solid body with an operation such as
PartDesign Pad.
The reader will practice:
For a more in depth description of the sketcher, read the Sketcher Lecture.
Final result of the sketch, with all geometry fully constrained, including construction geometry for support.
1. Open FreeCAD, create a new empty document with File → New.
Some actions to remember:
2. Click on New sketch.
We are now inside the sketch edit mode. Within it, we're able to make use of the majority of the tools of this workbench.
Note: the tree view will switch to the task panel; in this interface expand the Edit controls section, and make sure the Auto constraints option is enabled. Other options can be changed including the size of the visible grid, and whether we want to snap to it; in this tutorial we will not snap to the grid and we will also hide it. In other sections of the task panel you can also see which geometrical elements and constraints have been defined.
Upper part of the task panel of the sketcher.
3. Construction geometry is used to guide the creation of "real" geometry. Real geometry will be the one shown outside of the sketch edit mode, while construction geometry will only be shown inside the edit mode. Therefore, you can use as much construction geometry as you need to build real shapes.
30 mm. You don't have to be very precise in this step; later we will set the correct dimension.Note: up to this point the line tool is still active. This means we can keep clicking on the 3D view to draw as many lines as we want. If we wish to exit this tool, we can press the right mouse button, or press Esc in the keyboard once. By doing this the pointer won't create lines any more, it will just be a pointer allowing us to select the objects we just created. In this pointer mode we can pick and drag the endpoints of each line to adjust its placement.
Note 2: do not press Esc a second time as this will exit the sketch edit mode. If you do this, re-enter the edit mode by double clicking on the sketch in the tree view.
Take a look at the task panel again. The Solver messages section already indicates that the sketch is under-constrained, and it mentions the number of degrees of freedom.
Look at the Constraints and Elements sections to see the new listed constraints and lines. Once your sketches have many elements, it may be difficult to select them in the 3D view, so you can use these lists to select the object that you wish exactly.
Construction lines forming a star shape with its center in the origin.
Real geometry must make a closed shape if it is to be used as a profile that can be extruded by tools such as PartDesign Pad.
Make sure you are not in construction mode by clicking on Toggle construction, if you have not previously exited this mode.
4. Create a circle.
8 mm. Again the dimension will be fixed later.5. Create a series of arcs.
8 mm.180° or half a circle.Circular arcs added at the endpoints of the construction lines. Also a central circle.
6. Create an arc between each pair of the previous O-arcs.
To summarize, the O-arcs should have their curvature pointing outwards, and their concavity pointing towards the origin of the sketch; the I-arcs should have their curvature pointing inwards, and their concavity pointing away from the same origin.
Circular arcs added between the first set of arcs placed.
Take a look at the task panel again. Due to the new geometrical elements that we have drawn, the Solver messages section indicates even more degrees of freedom. A degree of freedom (DOF) indicates a possible movement of one element. For example, a point can be moved both in horizontal and vertical directions, so it has two degrees of freedom. A line is defined by two points, therefore in total it has four degrees of freedom. If we fix one of those points, then the entire system has only two degrees of freedom available; if we additionally fix the horizontal movement of the remaining point, we only have one degree of freedom left; and if we also fix the vertical movement of this point, then the last degree of freedom disappears, and the line cannot move from its position any more.
Up to now when we have drawn lines and curves, the sketcher has added automatic constraints for us, those that keep the lines tied to the origin, and the O-arcs tied to the construction lines. But we haven't added other explicit constraints so the geometrical shapes can still be moved in many directions. Constraints are "rules" that tell us under which conditions a geometrical object can move and by how much. They are used to eliminate the degrees of freedom so that the sketch has a stable shape. If we eliminate all degrees of freedom, then the sketch is fully constrained, and has a fixed shape, that is, its points cannot move at all. In general, it is a good idea to fully constrain sketches because this will result in stable models.
There are two principal types of constraints:
7. Geometrically constrain the lines and arcs.
Note: as you add constraints, overlay symbols indicating the type of constraint appear over the geometry in the 3D view. If these symbols obfuscate your view, you can hide them by unchecking the constraint in the task panel. Also note that the number of degrees of freedom decreases after adding each constraint.
Note 2: if you wish to temporarily disable the constraint, you may select it and press Toggle active constraint. When you want to re-enable it, press the same button again.
Sketch with equality constraints applied to the construction lines, and to the two sets of arcs.
8. Apply tangency to the arcs.
Note: applying the tangential constraint very often will move the geometry around in order to produce a smooth connection. You may have to use the pointer to reposition the points a bit before applying the next tangential constraint. Try placing the endpoints in such a way that two arcs aren't too far apart, so they can be connected with a short line rather than a long line.
As of this step, we have now created a closed profile, as all arcs have been tied together. Now we can provide datum constraints to fix the shape of the sketch. While the dimensions of lines and arcs remain unfixed, we can drag the points of the sketch and observe how the entire sketch changes.
Sketch with tangential constraints applied to the arcs, which closes the shape.
These constraints specify the numerical distances between two points, and angles between two lines.
9. Adjust the size of the construction lines.
30 mm. Because all construction lines are constrained to have the same length, all these lines adjust their sizes at the same time.10. Adjust the angle between the construction lines.
72°.Sketch with length constraint applied to one vertical construction line (left), and angle constraints to three pairs of construction lines (right).
11. Adjust the size of the arcs.
8 mm. Because all O-arcs are constrained to have the same radius, all these arcs adjust their sizes at the same time.11 mm. Because all I-arcs are constrained to have the same radius, all these arcs adjust their sizes at the same time.Sketch with radius constraints applied to the outwards arcs (left), and inwards arcs (right).
8 mm.We should end up with a fully constrained sketch. It can be confirmed by noticing the change in color of the real geometry, and by the message that is shown in the task panel.
Sketch with all geometrical and datum constraints applied.
12. Now that we have a fully constrained sketch, it can be used to create a solid body.
Left: fully constrained sketch with only the most important constraints showing. Right: solid extrusion produced with PartDesign Pad.
For a more in depth description of the sketcher, visit the Sketcher Workbench documentation and also read the Sketcher Lecture.
Constraining a sketch can be done in many different ways. In general, it is recommended to use geometrical constraints first, and minimize the number of datum constraints, as this simplifies the task of the internal constraint solver. To investigate this, repeat this example, now adding the constraints in different order.