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''



Before You Begin
 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, on which all of the necessary dimensions to complete this task are given. See |https://wiki.freecadweb.org/Part_and_PartDesignPartDesign Workbench Concepts for some conceptual background.

You will start by creating a core solid shape from a base Sketch and then build on that shape, adding what are 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.

This tutorial will provide detailed descriptions when it describes an operation for the first time; subsequent operations will have a more concise description. When in doubt, find the operation that contains the more detailed description. For instance, when creating a sketch for the first time the process of choosing the sketch Plane will be explained in detail, for subsequent sketches it will not.

Feel free to signal errors and problems in this forum thread:

New Part Design Tutorial for FC 019 and 020

 The Part 



Constructing The Part
 Startup 

First begin by making sure you are in PartDesign Workbench, selected from the drop-down menu. 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 first save the new document, giving it any name you choose.

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 using Part Design|Sketch|Create Sketch, if no existing Body is found, a new one is automatically created and activated. This is not the case if you create a sketch using the Sketcher workbench, as sketches are useful in workbenches other than Part Design.''

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

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


 * 1) master sketch
 * 2) Named constraints are used to hold dimensions that can be readily referenced later in the model construction. For instance, to change the model width from 53 mm, as in the technical drawing, to 55 mm we need only to modify the Length value of the appropriate named constraint in the master sketch and the whole model will modify accordingly. This is parametric design in action.
 * 3) External Geometries are potentially subject to the Topological Naming Problem. We will be using them only when strictly necessary and will attempt to refer to the most stable elements available. Referring to edges or vertices of prior sketches is normally more stable than referencing edges or vertices of generated geometry.

Rationale


 * 1) The Master sketch contains the model's rectangular base shape and two named constraints that will be created to supply correct dimensions to other parts of the model:
 * 2) length that will contain 53mm. (The result of adding the 39mm dimension to the two 7mm "sides")
 * 3) width that will contain 26mm.

Notes
 * 1) If  in the Sketcher's Edit controls window is checked, some constraints will be applied automatically. Otherwise, you will need to apply them yourself.
 * 2) You exit a drawing tool either by right-clicking an empty area of the 3D view or by pressing the  key. The mouse cursor should change to the standard arrow cursor. If you press  an additional time you will exit the sketch editing mode. To return to the editor either click on the Model tab and double-click the Sketch element in the tree, or right-click in the 3D view and select Edit sketch in the context menu.)
 * 3) If Sketcher's Solver detects a redundant constraint it will turn the sketch orange in color. Before further constraints are added, redundant constraints should be removed. (Redundant constraints are shown in the Task view - click on the blue reference and press .)
 * 4) It's possible that some elements of the side panel, for instance 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.



 Sketch 


 * 1) Click on [[Image:PartDesign_NewSketch.svg|24px|link=PartDesign_NewSketch]] Create new sketch or the menu item Sketch|Create 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 from the Combo view list.
 * 4) Press
 * 5) FreeCAD automatically:
 * 6) switches to Sketcher workbench
 * 7) opens the sketch in editing mode and you will see something like Fig: SK2.

Step1: Rectangle creation



Click on Rectangle tool and start creating a rectangle this way:


 * 1) Create the rectangle roughly centered on Y axis resembling Fig: SKC1. Note:
 * 2)  Don't place points on X axis as the Solver will automatically apply constraints that will create a problem later.
 * 3) The dimensions of the rectangle are unimportant at this point. They will be assigned using constraints in a later step.
 * 4) Once done, press  (or right-click) to exit "rectangle creation mode".  "Rectangle creation mode" is indicated by this cursor appearance [[File:Pd tut rec cursor.png]].

Step2: Horizontal constraint

Assign now a horizontal distance constraint this way:


 * 1) Select the line defined by P2 to P3 in Fig: SKC1.
 * 2) Use the button Sketcher_ConstrainDistanceX.svg horizontal distance constraint which will make two things happen:
 * 3) A dimension will appear between extreme points of the line selected. This dimension is the current distance.
 * 4) Additionally, a dialog will appear: Pd tut rect03.png
 * 5) Assign a Length = 53mm, and to be able to easily reference this dimension later a name is required: assign Name = length. (You are free to use the name of your choice. It need only be unique within the sketch.)
 * 6) Click.
 * 7) The result should resemble Fig: SKC2

Step3: Symmetrical constraint

To center the the top edge of the rectangle around the origin proceed as follows:


 * 1) Select points P2 and P3 of the rectangle.
 * 2) Select the origin of the sketch. ''Note: the selection order of the points is important.
 * 3) Use Sketcher_ConstrainSymmetric.svg Symmetric tool.
 * 4) You will end up with something that resembles Fig: SKC3.
 * 5) Making a good choice of origin of the model can simplify its construction, in this case by taking advantage of the part's reflection symmetry in a later steps.

Step5: Vertical constraint

You now assign a vertical distance constraint, using a procedure analogous to the prior horizontal distance constraint


 * 1) Select the line defined by P3 to P4 in Fig: SKC1.
 * 2) Click on Sketcher_ConstrainDistanceY.svg vertical distance constraint and assign:
 * 3) Length = 26 mm
 * 4) Name = width.
 * 5) Click.
 * 6) Result should resemble Fig: SKC4.

Note the following:


 * 1) The lines on the sketch will become "bright green". (Assuming you have not modified the default color theme).
 * 2) The Solver messages window displays Fully constrained.
 * 3) If you select any line or vertex of the sketch and try to drag it, it won't move.

Step6: Close Sketch

Click on button in the Tasks tab to leave sketch edit mode.

Main Profile
You will create a new sketch that is holding the main profile.

 Sketch001 

Click on Create new sketch. Create it in YZ_Plane. FreeCAD will assign the name of Sketch001.

Step1: Polyline

Use the Polyline tool to make a shape like that in Fig: SP1
 * 1) Follow the order of points indicated in the figure (It was not obtained using FreeCAD, but has the real appearance with default color theme).
 * 2) As in the first sketch you will assign proper constraints later to adjust the dimensions and exact shape (see note about Constraints below).

Step2: 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: It may be easier for a less-experienced user of Sketcher to make the initial drawing offset from the axes and then apply these constraints "by hand". For instance, just because two points appear to be coincident, doesn't necessarily mean there is a coincidence constraint in place. Any constraint has to be explicit. When selecting vertices or lines with sketcher tools they will turn (default) green and any auto-constraints that will be applied will show beside the cursor. ''


 * 1) Select the line defined by points P2 and P3 and apply a Sketcher_ConstrainDistanceX.svg horizontal distance constraint and assign Length = 5 mm.
 * 2) Select the line defined by points P1 and P2 and apply a Sketcher_ConstrainDistanceY.svg vertical distance constraint and assign Length = 26 mm.
 * 3) Select the line defined by points P4 and P1 and apply a Sketcher_ConstrainDistanceX.svg horizontal distance constraint. For this value you will use a "Named constraint" using Expressions. To do so you have to press the little button on the dimensions [[Image:Bound-expression.svg|24px]], and you will be 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 When you start typing in the cell, you will be presented with some autocompletions, the example shows  .
 * 4) Select the right one for your design; in this case we want  . Note the period after the "element name".
 * 5) To select named constraint "width", you have to enter   with the period. Here autocomplete works.
 * 6) To add "length", as yet autocompletion is not available, 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 both the absence of any "red error message" and the correct value of the dimension displayed in the Result field
 * 7) Click  to close Formula editor dialog.
 * 8) Click  to close Insert length dialog. At this point you should have a fully constrained sketch similar to Fig: SPFC. Note the different colors between distance constraints assigned using expressions and those assigned specifying a length.

Step3: Close Sketch001

Click on button in the Tasks tab to leave sketch edit mode.

 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 its 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 ways, the way presented here is not the only way to achieve desired result.

Starting point is another time a Sketch.

 Sketch002 




 * 1) Hide the just created solid; Select it and hit  to hide.
 * 2) Click on [[Image:PartDesign_NewSketch.svg|24px|link=PartDesign_NewSketch]] Create new sketch in XZ_Plane; Sketch will be named Sketch002.

Step1: Rectangle


 * Select Sketcher_CreateRectangle.svg Rectangle tool, and create a rectangle, do not create it near the axis, to avoid automatic constraints that will make difficult to move it in the correct position using External geometry tool.

Step2: Constraints

Apply these constraints:
 * 1) Select one of the horizontal lines apply a horizontal distance constraint and a value of 11 mm.
 * 2) Select one of the vertical lines and give it a vertical distance constraint and a value of 5 mm.

You should obtain something similar to Fig: SK2.

Step3: Close Sketch002


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

Step:4 Make visible external geometries

To use an External geometry is necessary to have sketches to which we are "attaching" our geometry visible when you are modifying Sketch002.


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

Step5: Applying External geometries constraints
 * 1) Double click on Sketch002 to activate edit mode again and adjust the view so you have clearly visible the points as example like in Fig: SK2_1, this will ease subsequent steps. Note: rectangle's initial position could be different on your sketch.
 * 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.

Step4: Close Sketch002


 * 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 pocketing it, we can take advantage of the model's mirror symmetry about the YZ_plane, and use 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. Note: "Vertical sketch axis" makes the plane of the sketch the mirror plane. Or, we could have selected "Base_YZ_Plane", obtaining the same result.
 * 4) Click . If all has gone well, you should now have a part that looks like Fig: PK2

Sides
 Sketch003 




 * 1) Make Sketch visible as done before.
 * 2) Click on [[Image:PartDesign_NewSketch.svg|24px|link=PartDesign_NewSketch]] Create new sketch and create the new sketch in XY_Plane; Sketch will be named Sketch003.
 * 3) Select Sketcher_CreateRectangle.svg Rectangle tool, and create a rectangle, similar to those in Fig: Sk3_1. This should not trigger any auto constraint, because we offset our rectangle from the x-axis..  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 Expression and assigning the distance  .
 * 6) Add an Sketcher_External.svg External geometry using the point P1 as shown in Fig: SK2_2.
 * 7) Select top-left point of created rectangle, (marked TL in in Fig: Sk3_1), and make sure that the newly added External Geometry is selected.
 * 8) Apply a Sketcher_ConstrainCoincident.svg Coincident Constraint.
 * 9) 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 check that:
 * 3) Plane  from the pulldown menu, is selected. (It should be already selected, but a double check is not a bad habit.)
 * 4) Click . If all has gone well, you should now have a part that looks like Fig: Mirrored001

Note:

Our two mirror operations have a common symmetry plane, so we could have made our model a little simpler by combining them. We would
 * 1) Omit the Mirror operation above
 * 2) Select both Pad001 and Pocket in step 1 of the above Mirrored001 operation.

This emphasizes the important concept that we are mirroring the selected features (the operations we performed on the body, in the order selected), not the body itself.

Center Hole


Now it is time for the most challenging part of our modeling, a challenge that arises because the central pocket dimensions are referred to the slanted face.

If we use as a reference points on the slanted face created by padding Sketch001, we make ourselves vulnerable to the Topological_naming_problem. A better solution is to reference Sketch001 itself when creating our next sketch as follows.

 Sketch004 


 * 1) Make Sketch visible as described previously.
 * 2) Click on [[Image:PartDesign_NewSketch.svg|24px|link=PartDesign_NewSketch]] Create new sketch, and create the new sketch in the YZ Plane. This will create a sketch named Sketch004.
 * 3) Using [[Image:Sketcher_CreatePolyline.svg|24px|link=Sketcher_CreatePolyline]] Polyline tool, trace a polyline like those indicated by the points P1, P2, P3, P4 in Fig: CP01. Note:
 * 4) Remember to close the polyline by clicking the last point over the selected first point. This will create the required coincidence constraint.
 * 5) Check the applied constraints. If they were not applied using  apply them manually:
 * 6) Sketcher_ConstrainHorizontal.svg Constraint horizontal on lines defined by P1 to P4, and P2 to P3.
 * 7) Sketcher_ConstrainPointOnObject.svg Point on object on P1 and P2 on the Y axis.
 * 8) Using Sketcher_External.svg External geometry tool select line defined by EGP1 and EGP2 on Sketch001 indicated in Fig: CP02  with purple color.
 * 9) Apply Sketcher_ConstrainPointOnObject.svg Point on object to P3 and P4, selecting the point and the external geometry, this will make line P3 to P4 coincident with line defined by EGP1 and EGP2 in Sketch001.
 * 10) Apply Sketcher_ConstrainDistance.svg Distance to line P3 to P4 and assign Length = 17.00mm
 * 11) Apply Sketcher_ConstrainDistance.svg Distance to P4 and EGP2 and assign Length = 7.00mm This will result in a fully constrained sketch like in Fig: CP02.
 * 12) Close Sketch004

 Pocket001 

Now we the central pocket, given that its distance from the side pad is 11mm. An easy calculation shows this centers the pocket, extending 8.5 mm in each direction.

Note: Alternatively we could have used Type, checked Symmetric to Plane and entered 17 mm for the Length value
 * 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:



Your model is complete.

Single click on Sketch in the Tree View. Look for Sketch|Constraints in the Data tab and check on the effects of changing the length and/or width properties. The model should change parametrically.

Additional Resources
File to make comparison with your results: