Sandbox:Piffpoof9-2a

Introduction
In this tutorial we will continue on from XXX. In the previous tutorial we used the Sketcher and the Part Design workbench to create a housing for a lock. This tutorial will make a key to fit the housing but will exclusively use the Sketcher and Part Design workbenches so as to show how to bring these two different approached together into one model.



Problem Background
Nominally we're setting out to create a key for our lock housing from the previous tutorial. We will integrate the key which we produce with the Part workbench with objects created previously using the Sketcher and Part Design workbench.

One thing to realise is that there is no "geometry" or formulas that we can use to control the positioning of the different parts. We will place the key at the correct location, we will do this manually. Should the lock housing ever be moved, then the key would have to be moved manually at that time.

Our key will not be overly realistic as this tutorial is really focussing on producing results using more than one workbench.

We will make the key in 3 pieces: All of this will be done using the Part workbench.
 * the key shaft
 * the teeth of the key
 * the handle of the key

Preparation
FreeCAD has numerous facilities and features. To make our work easier in this tutorial, we need to make sure some of them are visible. From the menu bar at the top of the screen select the option. This will produce the Combo View which is a browser with two panes, one above the other. The upper pane has two tabs Model and Tasks - select Model. The lower pane also has two tabs View and Data - select Data.

Viewing Work in Progress
While working through the tutorial, utilise the Standard View icons built into FreeCAD which will allow you to manipulate your viewpoint and so therefore better see what is being done. The icons are:, , , , , , , , all of which are described on the page Standard View Menu. Manipulating the viewpoint does not effect any of the objects being constructed. The very nature of 3-dimensional modeling means that often some of the result of an operation will be on an aspect of the model not currently visible. Judicious use of the viewpoint allows the modeler to fully appreciate the model being developed.

Creating the Key Shaft

 * 1) Switch to the [[Image:Workbench_PartDesign.svg‎‎|24px]] Part Design workbench.
 * 2) Click on [[Image:Document-new.svg‎‎|24px]] to create a new document.
 * 3) Select [[Image:Sketcher_NewSketch.svg‎‎|24px]] 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
 * 7) Select [[Image:Sketcher_Circle.svg|24px]] Circle
 * 8) 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.
 * 9) Click on the centre of the circle, then click on the Y-axis.
 * 10) Click on [[Image:Constraint PointOnObject.svg|24px]] Point on Object Constraint. The circle centre is now constrained to remain on the Y-axis.
 * 11) Click on the centre of the circle then on the X axis.
 * 12) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint
 * 13) A small query box asking for the Length will appear, enter the number 10 into it and click OK
 * 14) Click on the circle
 * 15) Click on [[Image:Constraint Radius.svg|24px]] Radius Constraint
 * 16) A small query box asking for the Radius will appear, enter the number 4 into it and click OK
 * 17) Click on the Close button at the top of the Tasks Tab of the Combo View
 * 18) In the Combo View click on the Cube and press.
 * 19) Now enter the text  and press.
 * 20) Single-click the 'key shaft sketch' in the Combo View to select it
 * 21) Single-click on  [[Image:PartDesign_Pad.svg‎‎|24px]] Pad
 * 22) 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 100 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).
 * 23) We have now generated a 3-dimensional model which is 100mm high.
 * 24) You will notice that our Sketch has disappeared. Also a new object is appearing in the Combo View, one called Pad.
 * 25) To the immediate left of Pad is a small triangle point rightwards, click once on that.
 * 26) 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 concealed within the other, but is always there.
 * 27) In the Combo View click on the Sketch and press.
 * 28) Now enter the text  and press.
 * 29) Save your work: select the menu option, or click the [[Image:Document-save.svg‎‎|24px]] Save icon; or press -.

Creating the Key Teeth
We will create the teeth of the key in 2 steps.

Create Rough Key Teeth

 * 1) Select [[Image:Sketcher_NewSketch.svg‎‎|24px]] New sketch
 * 2) Select the third option for the Sketch to be created in the YZ plane
 * 3) In the Offset field, enter.
 * 4) Click OK
 * 5) Select [[Image:Sketcher_Rectangle.svg|24px]] Rectangle
 * 6) Create the rectangle somewhere near the origin with arbitrary lengths.
 * 7) Click on either side edge of the rectangle.
 * 8) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint
 * 9) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 10) Click on either the top or bottom edge of the rectangle
 * 11) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 12) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 13) Click on the lower lefthand corner of the rectangle, then click on the origin.
 * 14) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint.
 * 15) A small query box asking for the Length will appear, enter the number  into it and click OK.
 * 16) Click on the lower lefthand corner of the rectangle, then click on the origin.
 * 17) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 18) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 19) Click on the Close button at the top of the Tasks Tab of the Combo View
 * 20) In the Combo View click on the Cube and press.
 * 21) Now enter the text  and press.
 * 22) Single-click the 'key teeth rough sketch' in the Combo View to select it
 * 23) Single-click on  [[Image:PartDesign_Pad.svg‎‎|24px]] Pad
 * 24) 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   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).
 * 25) We have now generated a 3-dimensional model which is 6mm high.
 * 26) You will notice that our Sketch has disappeared. Also a new object is appearing in the Combo View, one called Pad.
 * 27) To the immediate left of Pad is a small triangle point rightwards, click once on that.
 * 28) 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 concealed within the other, but is always there.
 * 29) In the Combo View click on the Pad and press.
 * 30) Now enter the text  and press.
 * 31) Save your work: select the menu option, or click the [[Image:Document-save.svg‎‎|24px]] Save icon; or press -.

Create Cutouts for Key Teeth

 * 1) Single-click the 'key teeth rough' in the Combo View to select it
 * 2) Select [[Image:Sketcher_NewSketch.svg‎‎|24px]] New sketch
 * 3) Select [[Image:Sketcher_Rectangle.svg|24px]] Rectangle
 * 4) Create the rectangle somewhere near the origin with arbitrary lengths.
 * 5) Click on either side edge of the rectangle.
 * 6) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint
 * 7) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 8) Click on either the top or bottom edge of the rectangle
 * 9) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 10) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 11) Click on the lower lefthand corner of the rectangle, then click on the origin.
 * 12) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint.
 * 13) A small query box asking for the Length will appear, enter the number  into it and click OK.
 * 14) Click on the lower lefthand corner of the rectangle, then click on the origin.
 * 15) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 16) A small query box asking for the Length will appear, enter the number  into it and click OK


 * 1) Select [[Image:Sketcher_Rectangle.svg|24px]] Rectangle
 * 2) Create the rectangle somewhere near the origin with arbitrary lengths.
 * 3) Click on either side edge of the rectangle.
 * 4) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint
 * 5) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 6) Click on either the top or bottom edge of the rectangle
 * 7) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 8) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 9) Click on the lower lefthand corner of the rectangle, then click on the origin.
 * 10) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint.
 * 11) A small query box asking for the Length will appear, enter the number  into it and click OK.
 * 12) Click on the lower lefthand corner of the rectangle, then click on the origin.
 * 13) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 14) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 15) Click on the Close button at the top of the Tasks Tab of the Combo View.
 * 16) In the Combo View click on the Sketch and press.
 * 17) Now enter the text  and press.

Pocket to Create Finished Key Teeth

 * 1) Click on [[Image:PartDesign_Pocket.svg|24px]] Pocket
 * 2) In the Type field, select 'Through All'.
 * 3) Click
 * 4) In the Combo View click on the Pocket and press.
 * 5) Now enter the text  and press.
 * 6) Save your work: select the menu option, or click the [[Image:Document-save.svg‎‎|24px]] Save icon; or press -.

Creating the Key Handle

 * 1) Select [[Image:Sketcher_NewSketch.svg‎‎|24px]] New sketch
 * 2) Select the third option for the Sketch to be created in the YZ plane
 * 3) In the Offset field, enter.
 * 4) Click OK
 * 5) Select [[Image:Sketcher_Circle.svg|24px]] Circle
 * 6) 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.
 * 7) Click on the circle to select it.
 * 8) Click on [[Image:Constraint Radius.svg|24px]] Radius Constraint
 * 9) A small query box asking for the Radius will appear, enter the number  into it and click OK
 * 10) Click on the centre of the circle then on the X axis.
 * 11) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint
 * 12) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 13) Click on the centre of the circle then on the Y axis.
 * 14) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 15) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 16) Select [[Image:Sketcher_Circle.svg|24px]] Circle
 * 17) 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.
 * 18) Click on the circle to select it.
 * 19) Click on [[Image:Constraint Radius.svg|24px]] Radius Constraint
 * 20) A small query box asking for the Radius will appear, enter the number  into it and click OK
 * 21) Click on the centre of the first circle to select it.
 * 22) Click on the centre of the second circle to select it.
 * 23) Click on [[Image:Constraint_PointOnPoint.svg|24px]] Coincident Point Constraint
 * 24) Select [[Image:Sketcher_Circle.svg|24px]] Circle
 * 25) 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.
 * 26) Click on the circle to select it.
 * 27) Click on [[Image:Constraint Radius.svg|24px]] Radius Constraint
 * 28) A small query box asking for the Radius will appear, enter the number  into it and click OK
 * 29) Click on the centre of the circle then on the X axis.
 * 30) Click on [[Image:Constraint VerticalDistance.svg|24px]] Vertical Distance Constraint
 * 31) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 32) Click on the centre of the circle then on the Y axis.
 * 33) Click on [[Image:Constraint HorizontalDistance.svg|24px]] Horizontal Distance Constraint
 * 34) A small query box asking for the Length will appear, enter the number  into it and click OK
 * 35) Select [[Image:Sketcher_Circle.svg|24px]] Circle
 * 36) 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.
 * 37) Click on the circle to select it.
 * 38) Click on [[Image:Constraint Radius.svg|24px]] Radius Constraint
 * 39) A small query box asking for the Radius will appear, enter the number  into it and click OK
 * 40) Click on the centre of the third circle to select it.
 * 41) Click on the centre of the fourth circle to select it.
 * 42) Click on [[Image:Constraint_PointOnPoint.svg|24px]] Coincident Point Constraint
 * 43) Click on the Close button at the top of the Tasks Tab of the Combo View
 * 44) In the Combo View click on the Sketch and press.
 * 45) Now enter the text  and press.
 * 46) Single-click on  [[Image:PartDesign_Pad.svg‎‎|24px]] Pad
 * 47) 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   into this and click OK.
 * 48) In the Combo View click on the Pad and press.
 * 49) Now enter the text  and press.

Further Ideas

 * Animate the key (see tutorial YYY)

Summary
We used the following tools in this tutorial:

Further Information

 * To learn more about the Sketcher and Part Design Workbenches, see Sketcher Workbench, Part Design Workbench