Sandbox:Piffpoof9a

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 Part workbench 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_Part.svg‎‎|24px]] Part workbench.
 * 2) Click on [[Image:Document-new.svg‎‎|24px]] to create a new document.
 * 3) Click on [[Image:Part_Cylinder.svg|24 px]] Cylinder, a new cylinder will be created at the origin.
 * 4) In the Combo View click on the Cylinder and press.
 * 5) Now enter the text  and press.
 * 6) In the bottom pane of the Combo View, click to the left of the Placement, Angle, Axis and Position should become visible.
 * 7) Click to the left of Position, x, y, and z should become visible.
 * 8) In the y field either enter  or use the small arrows to the right to decrement the existing value (which will be 0). Note: this manually places the key shaft at 0,10,0 which is the centre of the hole of the previously made lock housing.
 * 9) In the Radius field, enter.
 * 10) In the Height field, enter.
 * 11) Save your work: select the menu option, or click the [[Image:Document-save.svg‎‎|24px]] Save icon; or press -.

Creating the Key Teeth
First a bit of preparation before we model the teeth of the key.
 * 1) In the Combo View, click on the 'Sides' to select it.
 * 2) Press the  to toggle the visibility of the selected object - in this case it will make the object 'Sides' invisible.
 * 3) At any time, 'sides' can be made visible again by selecting it and pressing the  key.

With the 'sides' not being visible, we can now see into the lock housing so we can observe the modeling of the teeth of the key.

Create Rough Key Teeth

 * 1) Click on [[Image:Part_Box.svg|24 px]] Cube, a new cube will be created at the origin.
 * 2) In the Combo View click on the Cube and press.
 * 3) Now enter the text  and press.
 * 4) In the bottom pane of the Combo View, click to the left of the Placement, Angle, Axis and Position should become visible.
 * 5) Click to the left of Position, x, y, and z should become visible.
 * 6) In the x field, either enter   or use the small arrows to the right to decrement the existing value (which will be 0).
 * 7) In the y field either enter   or use the small arrows to the right to decrement the existing value (which will be 0).
 * 8) In the z field either enter  or use the small arrows to the right to increment the existing value (which will be 0).
 * 9) In the Length field, enter.
 * 10) In the Width field, enter.
 * 11) In the Height field, enter.

Create Cutouts for Key Teeth
We will now create some cutouts on the key teeth.
 * 1) Click on [[Image:Part_Box.svg|24 px]] Cube, a new cube will be created at the origin.
 * 2) In the Combo View click on the Cube and press.
 * 3) Now enter the text  and press.
 * 4) In the bottom pane of the Combo View, click to the left of the Placement, Angle, Axis and Position should become visible.
 * 5) Click to the left of Position, x, y, and z should become visible.
 * 6) In the x field, either enter   or use the small arrows to the right to decrement the existing value (which will be 0).
 * 7) In the y field either enter   or use the small arrows to the right to decrement the existing value (which will be 0).
 * 8) In the z field either enter  or use the small arrows to the right to increment the existing value (which will be 0).
 * 9) In the Length field, enter.
 * 10) In the Width field, enter.
 * 11) In the Height field, enter .  We will re-use this key tooth cutout#1 to make a second cutout:
 * 12) Single-click on key teeth cutout#1, once it is Selected, Copy it (- or ).
 * 13) Paste it (- or ). It will receive a name something like key teeth cutout#002. The actual name is not that important, as long as it is different from the first cutout we created.
 * 14) Single-click key teeth cutout#002 and press  . Change the name to key teeth cutout#2 and press   to exit Edit mode. Note: The copy of the original will have all the Placement values of the original - in other words, the two objects will be both existing in the same physical space.
 * 15) In the bottom pane of the Combo View, click to the left of the Placement, Angle, Axis and Position should become visible.
 * 16) Click to the left of Position, x, y, and z should become visible.
 * 17) In the z field either enter  or use the small arrows to the right to increment the existing value (which will be 0).

Use Boolean Operations to Create Finished Key Teeth

 * 1) Single-click the 'key teeth' in the Combo View to select it
 * 2) Holding down, single-click on 'key teeth cutout#1' to select it.
 * 3) Click on [[Image:Part_Cut.svg‎‎|24px]]  Cut to cut the second object from the first. Notice that the resultant is another object called something like 'Cut'. The two objects that were used to form the result are encapsulated within the resulting object. Click to the left of 'Cut" to view the 2 objects used to form it.
 * 4) Single-click the object 'Cut' just created
 * 5) Holding down, single-click on 'key teeth cutout#2' to select it.
 * 6) Click on [[Image:Part_Cut.svg‎‎|24px]]  Cut to cut the second object from the first. Notice that the resultant is another object called something like 'Cut001'. The two objects that were used to form the result are encapsulated within the resulting object - one being the resultant from the first cut operation.
 * 7) In the Combo View click on the second Cut resultant and press.
 * 8) Now enter the text  and press.
 * 9) Save your work: select the menu option, or click the [[Image:Document-save.svg‎‎|24px]] Save icon; or press -.

Creating the Key Handle
The sides should still be invisible from the previous steps.


 * 1) Click on [[Image:Part_Cylinder.svg|24 px]] Cylinder, a new cylinder will be created at the origin.
 * 2) In the Combo View click on the Cylinder and press.
 * 3) Now enter the text  and press.
 * 4) In the bottom pane of the Combo View, click to the left of the Placement, Angle, Axis and Position should become visible.
 * 5) In the Angle field enter.
 * 6) Click to the left of Axis, x, y, and z should become visible (but these are X, Y & Z for the axis, not for the position).
 * 7) In the y field either enter  or use the small arrows to the right to increment the existing value (which will be 0).
 * 8) In the z field either enter  or use the small arrows to the right to increment the existing value (which will be 1). Notice that the cylinder has now changed it orientation. The x axis should remain at.
 * 9) In the x field enter.
 * 10) In the y field enter.
 * 11) In the z field enter.
 * 12) Single-click on key handle part 1 outer, once it is Selected, Copy it (- or ).
 * 13) Paste it (- or ). It will receive a name something like key handle part outer002. The actual name is not that important, as long as it is different from the first cylinder we created.
 * 14) In the Combo View click on the cylinder you just pasted and press.
 * 15) Now enter the text  and press.
 * 16) In the Radius field enter.
 * 17) Single-click the 'key handle part 1 outer' in the Combo View to select it
 * 18) Holding down, single-click on 'key handle part 1 inner' to select it.
 * 19) Click on [[Image:Part_Cut.svg‎‎|24px]]  Cut to cut the second object from the first. Notice that the resultant is another object called something like 'Cut'.
 * 20) In the upper pane of the Combo View, click to the left of the Cut object just created, it's component objects (i.e. 'key handle part 1 inner' & 'key handle part 1 outer')  should become visible.
 * 21) In the Combo View click on the Cut you just made and press.
 * 22) Now enter the text  and press.


 * 1) Single-click on key handle part 1 outer, once it is Selected, Copy it (- or ).
 * 2) Paste it (- or ). It will receive a name something like 'key handle part 2 outer 001. The actual name is not that important, as long as it is different from the previous cylinder we created.
 * 3) In the Combo View click on the newly created 'key handle part 2 outer001' and press.
 * 4) Now enter the text  and press.
 * 5) In the y field enter.
 * 6) Single-click on key handle part 2 outer, once it is Selected, Copy it (- or ).
 * 7) Paste it (- or ). It will receive a name something like 'key handle part 2 outer002. The actual name is not that important, as long as it is different from the previous cylinder we created.
 * 8) In the Combo View click on the newly created 'key handle part outer002' and press.
 * 9) Now enter the text  and press.
 * 10) In the Radius field enter.
 * 11) Single-click the 'key handle part 2 outer' in the Combo View to select it
 * 12) Holding down, single-click on 'key handle part 2 inner' to select it.
 * 13) Click on [[Image:Part_Cut.svg‎‎|24px]]  Cut to cut the second object from the first.
 * 14) In the Combo View click on the Cut you just made and press.
 * 15) Now enter the text  and press.
 * 16) Save your work: select the menu option, or click the [[Image:Document-save.svg‎‎|24px]] Save icon; or press -.

Results
The twelve objects we have created now constitute a simplistic key, to fit the housing for a lock from the previous tutorial.

There is an | example data set #99 which has the results so far. You can download this and compare it to your own results.

Further Ideas

 * Animate the key (see tutorial YYY)

Summary
We used the following tools in this tutorial:
 * Cube, Cylinder and Cut from the Part workbench

Further Information

 * To learn more about the Part Workbench, see Part Workbench

To Do On Tutorial

 * Groups
 * rename 2 last Cuts
 * teeth cutout to 8 from 10 - need to raise upper cutout by 2