Base ExampleCommandModel.png Tutorial

Topic
{{{Topic}}}
Level
Intermediate
Time to complete
20 minutes
Author
piffpoof
FreeCAD version
0.14 or above
Example File(s)
[1] example data set #1

[2] example data set #2

[3] example data set #3

[4] example data set #4

[5] example data set #5



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 comprised of 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 Part Design Workbench.

Tutorial example screen snapshot.jpg

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:

  • 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

And because this is a Sketcher tutorial, we will use the Sketcher workbench, but we will use it from the Part Design workbench

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 View->Views->Combo View. 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: View-zoom-all.svg, View-zoom-selection.svg, View-axometric.svg, View-front.svg, View-top.svg, View-right.svg, View-rear.svg, View-bottom.svg, View-left.svg 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 First Sketch

  1. Switch to the Workbench PartDesign.svg Part Design workbench.
  2. Click on Document-new.svg to create a new document.
  3. Select Sketcher NewSketch.png 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 introductory 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 Sketcher Rectangle.svg 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 Constraint Symmetric.svg Symmetric 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 Constraint Symmetric.svg Symmetric 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

Note: you can save your work at any time in FreeCAD, either in the Sketcher or not, by clicking the Save button.

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 Constraint VerticalDistance.svg 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 Constraint HorizontalDistance.svg 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 Sketcher Circle.svg 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 click on the Y-axis.
  5. Click on Constraint PointOnObject.svg Point on Object Constraint. The circle centre is now constrained to remain on the Y-axis.
  6. Click on the centre of the circle then on the X axis.
  7. Click on Constraint VerticalDistance.svg Vertical Distance Constraint
  8. A small query box asking for the Length will appear, enter the number 10 into it and click OK
  9. Click on the circle
  10. Click on Constraint Radius.svg Radius Constraint
  11. A small query box asking for the Radius will appear, enter the number 5 into it and click OK
  12. in the Model tab of the Combo View, under the Solver label will be a message in green "Full constrained sketch"
  13. 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 PartDesign Pad.svg Pad function

  1. Single-click the Sketch in the Combo View to select it
  2. Single-click on PartDesign Pad.svg 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 concealed 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 back plate sketch and back plate are visible.
  3. Single-click on 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 Sketcher Rectangle.svg 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 Constraint VerticalDistance.svg 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 Constraint HorizontalDistance.svg Horizontal Distance Constraint
  8. A small query box asking for the Length will appear, enter the number 2 into it and click OK
  9. Click on the upper-right corner of the new rectangle, then on the upper-right corner of the first rectangle.
  10. Click on Constraint VerticalDistance.svg Vertical Distance Constraint
  11. A small query box asking for the Length will appear, enter the number 2 into it and click OK
  12. Click on the upper-right corner of the new rectangle, then on the upper-right corner of the first rectangle.
  13. Click on Constraint HorizontalDistance.svg Horizontal Distance Constraint
  14. A small query box asking for the Length will appear, enter the number 2 into it and click OK
  15. 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 our sketch this will be the thickness of the "walls" we will extrude.

Setting the Placement for the Second Sketch

At present the second Sketch lies at the same place as the first Sketch. When we Pad the second Sketch we want it to become a discrete object, as opposed to an object that shares the same 3-space as the first Pad. To do this we elevate (i.e. raise) the second Sketch up the Z axis. Remembering the first Pad, we Padded to a thickness of 2mm. Consequently we want this second Pad to start where the first one finished. This means we move our second Sketch to Z=2.

This is done using the Data tab of the lower pane of the Combo View:

Data tab.jpg

The screen snapshot shows the setting for the first Sketch. Whatever object you click on to Select in the upper pane of the Combo View will casue the values to update in the lwoer pane. But remember to have the Data tab selected and not the View tab.

  1. Single-click the second Sketch to Select it.
  2. Single-Click on the "z" field under the label "Position"
  3. Small arrows to increment/decrement the value. Use these or directly type in the value 2. Press Return to apply your changes to the value.

We are now ready to Pad the second Sketch.

Padding the Second Sketch

  1. Single-click the second Sketch in the Combo View to Select it
  2. Single-click on PartDesign Pad.svg 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 have 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.

Creating the Third Sketch

As with creating the second Sketch, we can re-use some of our work from the first Sketch.

  1. Open the document you previously saved.
  2. Make sure that both first Sketch and the first Pad are visible.
  3. Single-click on the first 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 front plate sketch and press Return to exit Edit mode.
  6. Double-click front plate sketch to start editing the Sketch.

Creating and Constraining the Geometry for the Third Sketch

We are going to make a square which will be the aperture for the key to pass through.

  1. Select Sketcher Rectangle.svg 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 Constraint Symmetric.svg Symmetric Constraint
  5. The two sides of the rectangle are now equi-distant from the Y-axis.
  6. Click on the upper-left corner, then on the lower-left corner
  7. Click on Constraint VerticalDistance.svg Vertical Distance Constraint
  8. A small query box asking for the Length will appear, enter the number 30 into it and click OK
  9. Drag the rectangle so that it's top edge is slightly into the circle.
  10. 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

We have now come to the most complex steps of this tutorial. In order to make the complex shape that the key will pass through we will create a new shape from the rectangle and the circle together.

  1. Double-click the 3rd Sketch to start Editing it.
  2. Zoom in on the model so the display is something like:

Trim lines.jpg

  1. Select Sketcher Trimming.svg Trimming - the Sketcher will now Trim line segments until you exit the Trimming tool.
  2. Click on the line segments numbered above: 1, 2, 3. This will delete those edges.
  3. Press the Escape key to leave the Trimming mode. Now only line portion 4 remains.
  4. Single-click line portion 4, then press the Delete key to delete it.
  5. Exit the Sketcher and the previous steps will be saved.

Setting the Placement for the Third Sketch

We will now change the Position of the third Sketch as we did with the second Sketch.

  1. Single-click the second Sketch to Select it.
  2. Single-Click on the "z" field under the label "Position"
  3. Small arrows to increment/decrement the value. Use these or directly type in the value 32. Press Return to apply your changes to the value.

We are now ready to Pad the third Sketch.

Padding the Third Sketch

  1. Single-click the third Sketch in the Combo View to Select it
  2. Single-click on PartDesign Pad.svg 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.

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

  1. With both the third Sketch and third 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 front plate

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

There is an example data set #3 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.

Results

The three objects we have created now constitute the housing for a lock.

There is an example data set #4 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.

Further Ideas

  • Create a key to fit this lock (see tutorial XXX)
  • Model some working of real lock inside our lock housing - now that would be complex!

Summary

We used the following tools in this tutorial:

  • Sketcher
  • Constraints within the Sketcher
  • Pad from the Part Design workbench

Further Information

To Do On Tutorial

  • constrain the rectangle on the 3rd Sketch
  • 0.16 specific changes
    • View->Views->Combo View becomes View->Panels->Combo View