Basic Part Design Tutorial 019

This tutorial introduces the new user to some of the tools and techniques used in the PartDesign Workbench. This tutorial is not a complete and comprehensive guide to the Part Design Workbench and many of the tools and capabilities are not covered. This tutorial will take user through the steps needed to model the part shown in the image below using sketches.

''Author Note: This tutorial is work in progress, in this state it is tested only with FreeCAD version 0.20.1 for Linux. Screenshots are made for 0.20.1 too, but it should work without big problems even on 0.19.

As soon I find someone to review it for 0.19 I will made appropriate remarks if necessary for v0.19''



The Task
In this tutorial, you will be using the Part Design Workbench to create a 3D solid model of the part shown in the Drawing below. All of the necessary dimensions to complete this task are given. You will start by creating a core shape from a base Sketch and then build on that shape, adding what is known as Features. These features will either add material to, or remove material from the solid by use of additional sketches and accompanying feature operations. This Tutorial will not use every feature and tool available within the Part Design Workbench, but should use enough to give the user of this tutorial a basic foundation upon which to build their knowledge and skills.

Startup
First begin by making sure you are in the Part Design Workbench. Once there, you will want to create a new document if you have not done so already. It is a good habit to save your work often, so before anything else save the new document, giving it any name you might like.

All work in Part Design begins with a Body. Then we will build the solid inside the body by starting with a sketch.

Click on Create new body to create and activate a new Body Container. ''Note: this step can be omitted. When creating a sketch, if no existing Body is found, a new one will be automatically created and activated.''

Sketch
You will create a base sketch, see maybe Sketcher WorkBench for a more detailed explanation of the terminology used here.

Workflow is following one of the many possible ways to make the design above. This example will use some techniques described in Advice for creating stable models.


 * 1) master sketch
 * 2) Named constraints that could be easily reference by other Sketches to make the model parametric. Named constraints are used to hold a dimension in a way to make easy to reuse them across the model. This will permit as example to change model width from 53mm as in the technical drawing, to 55mm simply modify Length value of the appropriate named constraint in the mater sketch and having the whole model modify accordingly.
 * 3) External Geometries that could be subject to Topological Naming Problem, will be used only when stricly necessary and trying to refer stable elements.

Create Sketch


This section is about creating the master sketch, that simply hold the rectangle of the base and two named constraints:
 * 1) length that will contain 53mm that is the result of adding the 39mm plus the two 7mm "sides"
 * 2) width that will contain 26mm.

Here the steps:


 * 1) Click on [[Image:PartDesign_NewSketch.svg|24px|link=PartDesign_NewSketch]] Create new sketch. This will create the sketch within the just created body. It will be named Sketch.
 * 2) A dialog like Fig: SK1 will open in Tasks tab on which you have to choose on which plane sketch will be attached.
 * 3) Select XY_Plane in from the Combo view list.
 * 4) Press   Note: it's possible that the  button may not be visible if the side panel is not wide enough. You can make it wider by dragging its right border. Place your mouse pointer over the border; when the pointer changes to a two-way arrow, press and hold the left mouse button and drag.
 * 5) FreeCAD automatically:
 * 6) switches to Sketcher workbench
 * 7) opens the sketch in editing mode and you will see something like Fig: SK2.

Create the rectangle


Click on Rectangle tool and start creating a rectangle, to obtain something that resemble Fig: RS operate in this way:


 * 1) Create the rectangle roughly centered on Y axis but not with upper side laying on the X axis, if not Solver will automatically apply constraints that will create some problem later. Note: It is not important at this step to state exact dimensions, exact dimensions will be assigned using constraints in a later step.
 * 2) Press, if not FreeCAD will remain in "rectangle creation" mode indicated by this cursor appearance [[File:Pd tut rec cursor.png]] and you will start creation of another rectangle.

Horizontal constraint


Assign now horizontal distance constraint this way:


 * 1) Select the upper line as shown in Fig: HS1.
 * 2) Use button Sketcher_ConstrainDistanceX.svg horizontal distance constraint this will make two things:
 * 3) A dimension will appear between extreme points of the line selected. This dimension is the actual dimension.
 * 4) Additionally a dialog will appear: Pd tut rect03.png
 * 5) Assign a Length = 53mm, and to be able to reference the dimension later a name is required as well: assign Name = length.
 * 6) Click.
 * 7) The result should resemble Fig: HS2

Symmetrical constraint


To center the rectangle, around Y axis proceed in this way:


 * 1) Select the top left corner and top right corner of the rectangle.
 * 2) Select the origin of the sketch. Note: selection order of the points is important. (Result will resemble Fig: HS3)
 * 3) Using Sketcher_ConstrainSymmetric.svg Symmetric tool.
 * 4) You will end with something that resemble Fig: HS4.

Vertical constraint


You have to assign a vertical distance constraint, the procedure is similar to what done for horizontal distance constraint


 * 1) Select the vertical line like in the image Fig: V1
 * 2) Click on Sketcher_ConstrainDistanceY.svg vertical distance constraint and assign:
 * 3) Length = 26 mm
 * 4) Name = width.
 * 5) Click.
 * 6) Result must resemble Fig: V2.

Note a couple of things:


 * 1) Lines on sketch will change color assuming a "bright green" color. (If you use default color theme).
 * 2) Solver messages window is displaying Fully constrained.
 * 3) If you try to click on some line and try to drag them, they won't move.

Side Profile
You will create a new sketch that is holding the side profile.

Create the Sketch001



 * 1) Click on [[Image:PartDesign_NewSketch.svg|24px|link=PartDesign_NewSketch]] Create new sketch. This will create the sketch within the just created body, and FreeCAD will assign the name of Sketch001.
 * 2) When choosing the plane you will select YZ_Plane in the list and press :
 * 3) Use the [[Image:Sketcher_CreatePolyline.svg|24px|link=Sketcher_CreatePolyline]] Polyline tool and make a shape roughly like that in Fig: SP1;
 * 4) Follow the order of point indicated in the image (It is not obtained using FreeCAD, but mimics decently the real appearance with default color theme).
 * 5) Exact shape is not important as like in the first sketch you will assign proper constraints later (see note about Constraints below). Notes:
 * 6) If you had checked  in Edit controls window, some of these constraints will have been applied automatically, if not: Make sure that you have exited the Polyline tool by right-clicking or pressing  twice; the mouse cursor should turn back from a cross-hair to the standard arrow cursor. (Don't press  a third time or you will exit the sketch editing mode; if this happens, click on the Model tab, then double-click the Sketch element in the tree, or right-click and select Edit sketch in the contextual menu.)
 * 7) If Sketcher's Solver detects a redundant constraint it will turn sketch orange in colour, and before further constraints are added, redundant constraints should be removed. (Redundant constraint are shown in  Task view, click on the blue reference and press .)

Applying Constraints


From Fig: SP1 you will see that FreeCAD has already applied some constraints:


 * 1) Top horizontal line has a Sketcher_ConstrainHorizontal.svg Horizontal Constraint applied.
 * 2) Right point of the top line has a Sketcher_ConstrainPointOnObject.svg Point On Object Constraint applied.
 * 3) Left point of bottom horizontal line has another Sketcher_ConstrainPointOnObject.svg Point On Object Constraint applied.

Note: when using "named constraints" you have to refer to the "Name" property, but names shown here may vary due to the way the example file is done (It was made using Part Design Scripting), refer to the names you have in your design


 * 1) Select line defined by points P2 and P3 and apply a Sketcher_ConstrainDistanceX.svg horizontal distance constraint and assign Length = 5 mm.
 * 2) Select line defined by points P1 and P2 and apply a Sketcher_ConstrainDistanceY.svg vertical distance constraint and assign Length = 26 mm.
 * 3) Select line defined by points P4 and P1 and apply a Sketcher_ConstrainDistanceX.svg horizontal distance constraint for the value you will use a "Named constraints" using Expressions to do so you have to press the little button on the dimensions [[Image:Bound-expression.svg|24px]], and you are presented with a new dialog window named Formula editor that contains an input field and a Result: label, similar to the image below:Pd tut expressions.png if you start typing in the cell, you will be presented with some autocompletions, base on the "Name" of the sketch, in the example is  .
 * 4) Select the right one for your design; Field should have autocompletion so when an element is slected you will be presented with  , note the point after the "element name".
 * 5) To select named constraint "width", you have to write the word   with the point, here autocomplete will work.
 * 6) To add "length" sadly you have not yet autocomplete, so complete the cell to read   if all is good you should see in the cell Result: the correct value as in figure below:Pd tut expression end.png Note the absence of "red words" and the correct value in the Result field
 * 7) Click  to close Formula editor dialog.
 * 8) Click  to close Insert length dialog.

Finalizing the Sketch
At this point you should have a fully constrained sketch as indicated by it changing color and the message shown in the Combo View. It should now look just like Fig: SPFC:

''Note the differences in color between distance constraints assigned using expressions and those assigned specifying a length. ''

Now in the Tasks tab, click on the button to leave the sketch edit mode

Making the Pad


Select Pad from the toolbar or from the Part Design menu.

This will give you a Pad dialog in the Task View.

Using that dialog, set it's values accordingly to the following directions:


 * 1) For Type select.
 * 2) For Length you will use again an Expression but this time you will enter   in the field.
 * 3) Select.

Once that is done you will have a solid as shown in Fig: Pad

Features


With Pad you have obtained a solid.

Now it is time to add some Features to this solid..

These Features could be obtained in various way, the way presented here is not the only way to achieve desired result.

Starting point is another time a Sketch.


 * 1) Hide the just created solid selecting it and using  to hide, or using the
 * 2) Click on the New sketch icon in the toolbar or from the Part Design menu. This will create a sketch named Sketch002.
 * 3) Select Sketcher_CreateRectangle.svg Rectangle tool, and create a rectangle, do not create it using near the axis, to avoid automatic constraints that will make difficult to move it in the correct position using External geometry tool.  Apply these constraints:
 * 4) Select one of the horizontal lines apply a horizontal distance constraint and a value of 5 mm.
 * 5) Select one of the vertical lines and give it a vertical distance constraint and a value of 11 mm. You should obtain something similar to Fig: SK2.
 * 6) Click  at top of the Tasks tab in the Combo View window.

Adding external geometries constraints
To use an External geometry is necessary to have sketches on which we are "attaching" our geometry visible.


 * 1) In the Treeview select Sketch and Sketch001 and make both visible using.

With Sketch and Sketch001 visible, it is easy to operate:
 * 1) Double click on Sketch002 to activate again edit mode and adjust the view so you have clearly visible the points as example like in Fig: SK2_1, this will ease subsequent steps. Note: position of the rectangle could be different on your draw.
 * 2) Select Sketcher_External.svg External geometry tool, the cursor will became [[File:Pd tut eg cursor.png]].
 * 3) Select with this cursor point P1 in Fig: SK2_2, selected point will remain highlighted and in the Elements tab of Task Panel you will see that this element is shown [[File:Pd tut ext geom pt.png]].
 * 4) Select with this cursor point P2 in Fig: SK2_2. In the Elements tab of Task Panel you will see another element like the above.
 * 5) Press  to terminate External Geometry selection. Cursor will return standard arrow pointer.
 * 6) Select point P1 and point P3 and apply a Sketcher_ConstrainVertical.svg Vertical Constraint. Rectangle will be aligned with the vertical position of selected point.
 * 7) Select point P2 and point P3 and apply a Sketcher_ConstrainHorizontal.svg Horizontal Constraint. Rectangle will be aligned with the horizontal position the selected point.


 * 1) Click  button at top of the Tasks tab in the Combo View window.

Pockets


You have to subtract some material using the just created sketch that is positioned at one end. To make this operation you have to use Pocket tool from the toolbar or Part Design menu.

Using this tool is the opposite of the Pad tool. As the Pad tool adds material to the part, the Pocket tool removes material from the part.

Pocket

 * 1) Select Pad and Unhide it.
 * 2) Select Sketch002.
 * 3) Select PartDesign_Pocket.svg Pocket and configure the operation:
 * 4) Select Type.
 * 5) Check
 * 6) Click the  button.

You should have something that resemble Fig: PK1

Mirror
Instead of creating another sketch and pocket it, as the model is created using the Y axis as a symmetry axis, you could easily duplicate the pocket using Mirrored.


 * 1) Select “Pocket”.
 * 2) Click on the PartDesign_Mirrored.svg Mirrored feature on the toolbar or from the Part Design menu. A dialog will appear in the Combo View.
 * 3) Select Plane  from the pulldown menu.
 * 4) Click  If all has gone well, you should now have a part that looks like Fig: PK2

Sketch003



 * 1) Make Sketch visible as done in precedence.
 * 2) Click on the New sketch icon in the toolbar or from the Part Design menu. This will create a sketch named Sketch003.
 * 3) Select Sketcher_CreateRectangle.svg Rectangle tool, and create a rectangle.  Apply these constraints:
 * 4) Select one of the horizontal lines apply a horizontal distance constraint and a value of 7 mm.
 * 5) Select one of the vertical lines and give it a vertical distance constraint using an Espression and assign a  .
 * 6) Add an Sketcher_External.svg External geometry using the point P1 as shown in Fig: SK2_2
 * 7) Click  at top of the Tasks tab in the Combo View window.

Pad001

 * 1) Select Sketch003.
 * 2) Click PartDesign_Pad.svg Pad and assign these values:
 * 3) Type = .
 * 4) Length = 16,70 mm
 * 5) Click  at top of the Tasks tab in the Combo View window. You should have a result as shown in Fig: Pad001

Mirrored001

 * 1) Select “Pad001”.
 * 2) Click on PartDesign_Mirrored.svg Mirrored and assign:
 * 3) Select Plane  from the pulldown menu. (It should be already selected, but check)
 * 4) Click  If all has gone well, you should now have a part that looks like Fig: Mirrored001

Sketch004


Now it is time of the most challenging thing, in the design above, you will easily see that central pocket dimensions are referred to the slanted face.

This will surely lead to Topological_naming_problem as you could refer to the face that is created using Sketch001, a different solution is to use Sketch001 to model another sketch as follows.


 * 1) Make Sketch visible as done in precedence.
 * 2) Click on the New sketch icon in the toolbar or from the Part Design menu. This will create a sketch named Sketch004.
 * 3) Select YZ Plane
 * 4) Using [[Image:Sketcher_CreatePolyline.svg|24px|link=Sketcher_CreatePolyline]] Polyline tool, trace a polyline like those in Fig: CP01. Note:
 * 5) Trace polyline slightly over X axis.
 * 6) Remeber to close polyline clicking first point as last point, this will correctly make the coincident constraints.
 * 7) Note applied constraints, if they are not applied using  apply manually:
 * 8) Sketcher_ConstrainHorizontal.svg Constraint horizontal on the two horizontal lines.
 * 9) Sketcher_ConstrainPointOnObject.svg Point on object on two point that must lie on the Y axis.
 * 10) Using Sketcher_External.svg External geometry tool select the slanted line of Sketch001 in Fig: CP02 indicated in purple color.
 * 11) Apply Sketcher_ConstrainPointOnObject.svg Point on object to the two corresponding points lying on the slanted line of the just created polyline, selecting the point and the external geometry, this will make slanted line of just created polyline coincident with line in Sketch001.
 * 12) Apply Sketcher_ConstrainDistance.svg Distance to the slanted line and assign Length = 17.00mm
 * 13) Apply Sketcher_ConstrainDistance.svg Distance to the lower point of the slanted line of the just create polyline slanted line and assign Length = 7.00mm This will result in a fully constrainted sketch like in Fig: CP02.
 * 14) Close Sketch004

Pocket001
Now it is time to make the central pocket, remember that the central pocket has to respect some distance to the side pad marked as 11mm distance, but with some easy calculations this distance will reveal that it is simply centered on the face, this will ease the pocket.


 * 1) Select Sketch004.
 * 2) Select PartDesign_Pocket.svg Pocket and configure the operation:
 * 3) Select Type.
 * 4) Assign 8,50mm to Length and Length2 values
 * 5) Click the  button.
 * 6) Select the newly created Pocket001 and modify Refine property to True

This will result in:



This tutorial and your model are complete.

Additional Resources
File to make comparison with your results: