Sandbox:Piffpoof9

Introduction
This tutorial is meant to introduce the reader to the basic workflow of the Sketcher Workbench used in conjunction with the Part Design workbench to make a model with 3 different pieces. This will be done using Sketches and the Pad function of the Part Design workbench,

The Sketcher workbench exists as a standalone module, but it is also accessible from within the PartDesign Workbench when it is required to create a profile.



Problem Background
We're going to construct a model of a housing for a lock - like the lock on a door. After looking at the task, we have decided we will make this in 3 pieces: And because this is a Sketcher tutorial, we will use the Sketcher workbench, but we will use it from the Part Design workbench
 * a plate at the back of the lock housing
 * the sides of the lock housing
 * the front plate of the lock housing which will have the aperture through which the key passes

Preparation
FreeCAD has numerous facilities and features. To make our work easier in this tutorial, we want to make sure some of them are visible:

- combo viewer

- Data tab

Creating the First Sketch

 * 1) Switch to the Part Design Workbench
 * 2) Create a new document
 * 3) Select [[Image:Sketcher_NewSketch.png‎‎|32px]] New sketch
 * 4) Select the first option for the Sketch to be created in the XY plane
 * 5) Notice that the offset value is 0, which is where we will leave it
 * 6) Click OK

Creating Geometry With Constraints
The Sketcher is a two dimensional editor. When creating Sketches in the Sketcher, it is beneficial to either centre the drawing over the XY origin or to place one corner or edge of the drawing along either the origin or one axis.

As this is an intoductory tutorial, we will not use External Geometry which is covered in other tutorials such as Sketcher Tutorial. Rather, we will define the position and dimensions of our Sketch in reference to the origin.
 * 1) Select [[Image:Sketcher_Rectangle.svg|32px]] Rectangle
 * 2) Create the rectangle somewhere near the origin with arbitrary lengths.
 * 3) Click on the lower-left corner of the rectangle, then on the lower-right corner, then finally on the Y axis. Both points and the Y axis should now be selected.
 * 4) Click on [[Image:Constraint Symmetric.svg|32px]] Symetric Constraint
 * 5) The two sides of the rectangle are now equi-distant from the Y-axis.
 * 6) Repeat the previous steps with the upper-left corner, the lower-left corner, and the X axis and click on [[Image:Constraint Symmetric.svg|32px]] Symetric Constraint
 * 7) The box is now symmetrically constrained around the XY origin. It can be made wider, narrower, taller, shorter but any changes will be mirrored on the other side of the axis.
 * 8) It's now a good time to exit the Sketcher and have the previous steps saved. Click on the Close button at the top of the Tasks Tab of the Combo View

So we now have a rectangle that is constrained to be symmetrical around the XY origin. Now we need to specify its dimensions.
 * 1) Double-click the Sketch in the Combo View which will put you into edit mode of the Sketcher
 * 2) Click on the upper-left corner, then on the lower-left corner
 * 3) Click on [[Image:Constraint VerticalDistance.svg|32px]] Vertical Distance Constraint
 * 4) A small query box asking for the Length will appear, enter the number 80 into it and click OK
 * 5) Click on the lower-left corner, then on the lower-right corner
 * 6) Click on [[Image:Constraint HorizontalDistance.svg|32px]] Horizontal Distance Constraint
 * 7) A small query box asking for the Length will appear, enter the number 60 into it and click OK
 * 8) Click on the Close button at the top of the Tasks Tab of the Combo View

The last thing we will do is create the hole that the shaft of the key will pass through when the key is in the lock.


 * 1) Double-click the Sketch in the Combo View which will put you into edit mode of the Sketcher
 * 2) Select [[Image:Sketcher_Circle.svg|32px]] Circle
 * 3) Your first click will place the centre of the circle, your second click will set the radius of the circle. Place the centre somewhere near the Y axis.
 * 4) Click on the centre of the circle then on the Y axis.
 * 5) Click on [[Image:Constraint HorizontalDistance.svg|32px]] Horizontal Distance Constraint
 * 6) A small query box asking for the Length will appear, enter the number 0 into it and click OK
 * 7) Click on the centre of the circle then on the X axis.
 * 8) Click on [[Image:Constraint VerticalDistance.svg|32px]] Vertical Distance Constraint
 * 9) A small query box asking for the Length will appear, enter the number 10 into it and click OK
 * 10) Click on the circle
 * 11) Click on [[Image:Constraint Radius.svg|32px]] Radius Constraint
 * 12) A small query box asking for the Radius will appear, enter the number 5 into it and click OK
 * 13) in the Model tab of the Combo View, under the Solver label will be a message in green "Full constrained sketch"
 * 14) Click on the Close button at the top of the Tasks Tab of the Combo View

The diagram is now complete and is "fully constrained" which means that all the points and edges are fixed in one and only one position. Also it means that there are no conflicting constraints. As soon as the Sketch is"fully constrained" the colour of the edges will change.

Padding a Sketch (Generating 3 Dimensions From 2)
So far we have created a 2-dimensional drawing which in FreeCAD is called a Sketch. Of course our end goal is to create a 3-dimensional model and so will need to convert our Sketch, which has no height, into a 3-dimensional object. One that looks and behaves like one in the real world.

One of the ways to generate a 3-dimensional object from a FreeCAD Sketch, and maybe the most common way, is to use the Pad function


 * 1) Single-click the Sketch in the Combo View to select it
 * 2) Single-click on  [[Image:PartDesign_Pad.svg‎‎|32px]] Pad
 * 3) A dialogue box will appear in the Tasks tab of the Combo View, it will have a field to enter with the label Length. Enter 2 into this and click OK. Our Sketch will receive a 3rd dimension along the orthogonal axis (which in Z for our Sketch which lies in the XY plane).
 * 4) We have now generated a 3-dimensional model which is 2mm thick. in the real world that would mean it is made from 2mm thick material (wood, metal, plastic, etc.)
 * 5) You will notice that our Sketch has disappeared. Also a new object is appearing in the Combo View, one called Pad.
 * 6) To the immediate left of Pad is a small triangle point rightwards, click once on that.
 * 7) Now you will see both the Sketch which we created and the Pad which we created from the Sketch. Both objects are there, for ease of management the one is concelaed within the other, but is always there.

The last thing to do before finishing this section is to cleanup our work.


 * 1) With both objects showing, click once on the Sketch. It will become selected for editing. Press the Return key and you will be to edit the name of the object.
 * 2) Change the name of the Sketch to back plate sketch and press Return to exit Edit mode.
 * 3) Change the name of the Pad to back plate

You may now Save this document, we are finished the first of the 3 objects.

There is an example data set#1 which has the results so far. You can download this and compare it to your own results. Certain things like the positioning of labels on the Sketches may change depending on zoom levels. So your the positioning of your labels may differ but the dimensions and the list of Constraints should be identical.

Creating the Second Sketch
In creating the second Sketch, we can save some of our work from the first Sketch. Working in this fashion where you cannablise a previous step is one of the efficiencies of CAD work, it mainly comes with practice. To do this we have the following steps:


 * 1) Open the document you previously Saved.
 * 2) Make sure that both Sketch and the Pad are visible.
 * 3) Single-click on the Sketch back plate sketch, once it is Selected, Copy it.
 * 4) Paste it. It will receive a name something like back plate sketch001. The actual name is not that important, as long as it is different from the first Sketch we created.
 * 5) Single-click back plate sketch and press the Return key. Change the name to sides sketch and press Return to exit Edit mode.
 * 6) Double-click sides sketch to start editing the Sketch.
 * 7) Click on the circle and press the Delete key. Notice that both the circle is gone as well as any constraints that involved the circle. You should now have only the outer box in the Sketch.

Creating and Constraining the Geometry for the Second Sketch
We are going to make a square within a square so that when it is Padded we will have 4 walls.


 * 1) Select [[Image:Sketcher_Rectangle.svg|32px]] Rectangle
 * 2) Create the rectangle somewhere near the origin with arbitrary lengths.
 * 3) Click on the lower-left corner of the new rectangle, then on the lower-left corner of the first rectangle.
 * 4) Click on [[Image:Constraint VerticalDistance.svg|32px]] Vertical Distance Constraint
 * 5) A small query box asking for the Length will appear, enter the number 2 into it and click OK
 * 6) Click on the lower-left corner of the new rectangle, then on the lower-left corner of the first rectangle.
 * 7) Click on [[Image:Constraint HorizontalDistance.svg|32px]] Horizontal Distance Constraint
 * 8) A small query box asking for the Length will appear, enter the number 2 into it and click OK


 * 1) Click on the upper-right corner of the new rectangle, then on the upper-right corner of the first rectangle.
 * 2) Click on [[Image:Constraint VerticalDistance.svg|32px]] Vertical Distance Constraint
 * 3) A small query box asking for the Length will appear, enter the number 2 into it and click OK
 * 4) Click on the upper-right corner of the new rectangle, then on the upper-right corner of the first rectangle.
 * 5) Click on [[Image:Constraint HorizontalDistance.svg|32px]] Horizontal Distance Constraint
 * 6) A small query box asking for the Length will appear, enter the number 2 into it and click OK
 * 7) Click on the Close button at the top of the Tasks Tab of the Combo View

We have now created a rectangle within a rectangle, the spacing between them being 2mm. When we Pad this will be the thickness of the "walls" we will extrude.

Padding the Second Sketch

 * 1) Single-click the second Sketch in the Combo View to Select it
 * 2) Single-click on  [[Image:PartDesign_Pad.svg‎‎|32px]] Pad
 * 3) A dialogue box will appear in the Tasks tab of the Combo View, it will have a field to enter with the label Length. Enter 30 into this and click OK. Our Sketch will receive a 3rd dimension along the orthogonal axis (which in Z for our Sketch which lies in the XY plane).
 * 4) We have now generated a 3-dimensional model which is 30mm thick.

The last thing to do before finishing this section is to cleanup our work.


 * 1) With both the second Sketch and the Pad showing, click once on the Pad. It will become selected for editing. Press the Return key and you will be to edit the name of the object.
 * 2) Change the name of the Pad to sides

You may now Save this document, we are finished the second of the 3 objects.

There is an example data set#2 which has the results so far. You can download this and compare it to your own results. Certain things like the positioning of labels on the Sketches may change depending on zoom levels. So your the positioning of your labels may differ but the dimensions and the list of Constraints should be identical.