Creating a simple part with PartDesign/fr



Ce tutoriel a pour but d'expliquer aux débutants découvrant Freecad, quelques fonctions de base à travers un exemple. Après avoir découvert quelques notions de base dans la Documentation pour utilisateurs, vous pouvez maintenant dessiner pas à pas une première pièce.

Nous allons voir dans ce tutoriel notamment:


 * Utiliser l'atelier Part Design v0.17, dessin du "sketch".
 * Utiliser les fonctions Pad et Pocket.
 * Changer couleur et transparence.
 * Déplacer manuellement la pièce.
 * Afficher des cotes indicatives dans l'esquisse.
 * Faire varier une ou plusieurs dimensions.
 * Utiliser la fonction géométrie extérieure et utiliser un plan repère pour centrer le trou.

Utiliser l'atelier Part Design v0.17, dessin du "sketch"
Créez un nouveau document et sélectionnez l'atelier Part Design. Freecad doit démarrer avec les icônes au dessus, la vue combinée à gauche et la vue 3D à droite.

Créer un corps de pièce:

Cliquez sur Créer un corps. Un corps (ou body) est un conteneur où sont rangées de façon séquentielle les fonctions de Part Design. Il contient ses propres références d'axes et de plans. Il doit être surligné en bleu, cela signifie qu'il est actif, c'est à dire que l'on peut éditer des formes. Si ce n'est pas le cas, double-cliquez dessus. Profitons en pour le renommer.

Renommer le body:

Cliquez dessus avec le bouton droit. Sélectionnez Renommer et donnez un nom, par exemple "Body pièce1" puis valider.

Créer un sketch:

Nous allons maintenant dessiner l'esquisse (ou sketch) qui possède la forme générale de la pièce. Une esquisse est un schéma qui décrit une forme à appliquer à une fonction afin de produire une forme. Soit une forme "positive" ou "additive": un bossage (ou pad) par exemple, ou une forme "négative" ou "soustractive": un creux (ou poche - pocket) par exemple.

Ici, comme la forme générale de la pièce est régulière suivant l'axe des Y, nous allons faire un Pad suivant cet axe, une extrusion d'une forme.

Press New sketch. FreeCAD then offers to attach this sketch to a plane of the Body; select the XZ plane and press. The interface now changes, the Sketcher now takes over and its toolbars appear over the 3D view. We find ourselves on the XZ plane of the body to trace the sketch.

To aid with sketching, set the following options in "Edit controls" in the Tasks panel to the left:
 * Show grid: checked
 * Grid size: 10 mm
 * Auto constraints: checked

We will trace the following sketch:



Let's start with the first segments:

Select the Line tool. Click on the origin point, first making sure that a small red dot appears besides and to the right of the mouse pointer. Click next on the X axis about 10 squares to the right or at about 100 mm. If the segment is not exactly 100 mm at this point, it does not matter, we will later give it a fixed dimension that will constrain this length.

Do the same for the other segments, try to aim at the points that you have created which must light up in yellow. Which means that these points will be coincident. You should get pretty much this:



Note the small red lines above and beside the segments you have drawn: these are horizontal and vertical constraints. Your lines are forced to stay either horizontal or vertical. Note also the symbol in the form of a small arc on the left: it means that the point is fixed to the Z axis.

Now pick different line segments with the left mouse button and while keeping the left button pressed, drag the mouse to try to move them: some are free, others not.

Applying constraints:

At the top of the combo box, in the Tasks panel, you can read the number of degrees of freedom of the already sketched elements: it must be about 6, the objective of the constraints is to reduce the number of degrees of freedom to 0.

The slanted line should be free to rotate at this time: we will give it an angle constraint to fix it.

Click on the slanted line, then the bottom line; once selected these lines will turn dark green; then click the Constraint_InternalAngle icon.



Enter a value of 30°. Both lines have a fixed angle now. The constraint was created to the left of the sketch; with the mouse, move it inside the profile.

We will now constrain the bottom line with a dimension: select it then click  Horizontal distance.

Enter a value of 100 mm. The vertical line on the right now aligns exactly with the grid's 10th square to the right of the origin.

Let's set the overall height to the profile by selecting the highest point on the left then the origin point. Click on Vertical Distance, enter a value of 50 mm.

Do the same for the horizontal length of the sloped line with another 50 mm vertical distance contraint.

Move the dimensions away from the profile for better visibility. You should now have something like this:



Notice that the number of degrees of freedom reduced to 2. These are the ends still open.

Tracing the arc

Click on Arc, position the center at approximately x = 80 y = 30; then click to define the first starting point of the arc on the upper horizontal line's right end point; then click to define the end of the arc to the right vertical line's upper end point (make sure the points are highlighted in yellow before clicking).

Give the radius a radius constraint: select the arc, then click on Radius then enter a value of 20 mm.

Now let's make the arc tangent to the lines it's connected to: select the arc, then the top line, then click on Tangent. A Constraint substitution message appears, click. Do the same for the tangent constraint on the other side of the arc.

We proceeded in two stages to create the sketch, but we could also have traced the profile completely before constraining it fully.

Fully constrained sketch:

If you worked well, you should get this:



The sketch has become green, which means that it is fully constrained. There is no longer any ambiguity, everything is perfectly defined. This is confirmed by the solver message at the top left. Also note that the center of the arc has moved slightly, indeed giving these last three constraints, FreeCAD has calculated the true position of the center.

If your sketch is not yet green, one or more points are not coincident (2 points are superimposed but not coincident). Make a small window (capture window) around a point, and click Coincident.

Proceed in the same way with all the points.

If your sketch is still not green, verify that all lines (but the slanted one) have either a Horizontal or  Vertical constraint, and add if necessary.

Using Pad and Pocket features
Click on in the combo box, at the top left corner, the Part Design workbench is automatically activated again.

Click on Axonometric view then  Fit all, which gives a centered 3D isometric view.

Click on Pad, enter a length of 30 mm; check the Reversed box to reverse the direction of the Pad. Click, the shape is completed.

Note that the shape created forms a solid.



Creating the hole

Click on the top (square) side of the part and click the icon to create a new sketch. FreeCAD creates a new sketch attached to this face. So we are on a plane parallel to the absolute plane XY, but offset in height from the height of the piece, i.e. 50 mm.

You can activate a 3D view or stay in top view.

Note that the origin of this new sketch is that of the body. They may be different, but here are confounded with the absolute origin.

With the Circle tool, click roughly in the center of the face and make a circle of any radius.

Select the circle then Radius, enter a value of 5 mm.

Select the center of the circle then Lock, double click on the horizontal dimension and enter -65 mm (here we indicate a position relative to the origin of the sketch). Do the same for the vertical dimension (-15 mm). The circle takes its correct position and the sketch must be green, it is fully constrained:



Close the sketch and click on Pocket.

Pocket is a feature called "subtractive", it removes material from our part, here in the form of a cylinder since the sketch is a circle. Set "Through all" to completely cut the part. Press.

Changing color and transparency
It is possible to change the color of the part, it is often useful to distinguish a part among others. The transparency of the piece can also be modified, which is useful for visualizing its internals.

Select the body and go to the lower part of the left display, select the View tab, and click on the gray square of "Shape Color" and select another color then click OK. Next change the value of Transparency, for example to 50 and press to complete (0 = totally opaque, 100 = totally transparent).

The hole is now visible inside the part. This is often useful for seeing the hidden or internal faces of the model.

You can also vary "Line Color" and "Line Width" to change the line thickness and the color of the part outline.

Manually move the part
Go to the Display menu and select Toggle axis cross. These are the absolute axes. You should see in the 3D view, the 3 axes X, Y, Z in different colors. This landmark will help us to orient ourselves in space. This landmark is fixed and immutable, it is either the view that rotates or the object that rotates in this space.

Select the Body, in the lower part of the combined view on the left, you can see this:



Click on the three small dots (if they don't appear, click on the Placement field), this opens a new dialog in the Tasks panel. Using the arrows you can vary the position and angles of the part. It is actually the position of the body (so its origin) that moves in space, the orientation of the 3D view does not change.

Another method: in the combo view, select the Body and click on the right button of the mouse, then select Transform. A view like this appears:



Hold and drag the cones along the axes or the spheres to move the piece (the body) in all directions.

Validate. Then reset angles and coordinates to 0.

Displaying reference dimensions in the sketch
It may be useful to know the dimensions of some parts of the sketch, from the internal calculation of FreeCAD. It can be used just for reference, or use them later to set other dimensions for example.

Double click on the first sketch, then click on Toggle Constraint. From now on, we can create reference dimensions rather than dimensional constraints: they will be blue and will have no influence on the shapes of the sketch from which they come, they are calculated automatically.

You can display these dimensions for example:



We can see for example that the arc has a length of 20 since it's tangent with the edges.

We can also see that FreeCAD calculates the left face (50-50xTAN 30 °), as well as the distance dimension of the axis of the arc with the origin.

Editing one or more dimensions
During modeling, you can vary the dimensions of the model. It's very simple: for the thickness of the piece, double-click Pad, then enter a new value, 40mm for example. In the lower part of the combo view, you can change this value as well. Validate, the shape of the object has changed.

Do the same for the total length of the piece: double-click on Sketch, then double-click on the 100 mm dimensional constraint, change it to 110 mm then validate.

We can see that the piece was enlarged, but the hole is no longer centered in the middle of the top face. That's because it has been constrained to the sketch origin. Which does not necessarily correspond to what one would like, the hole should remain in the center, whatever the size of the face.

Center the hole
First method using external geometry.

Edit again the sketch of the hole and erase its horizontal and vertical distance constraints.

Then click on External Geometry.

We will now create two lines in the sketch, but extracted from a shape (or feature) external to this one and previously defined: that of the Pad.

Click on a vertical edge at the top of the part. For example, the edge slope side.

A new magenta line will appear above the edge. Repeat for the other edge, on the rounded side.

We can now use these lines (and especially their end points) to centre the circle, however we must add two construction lines: for example the diagonals.

Click on Construction Mode, we switch to construction mode: the lines will be blue and will be discarded outside of the sketch editing mode. They will allow to fix the center of the circle. Create the diagonals in the same way that you drew the first lines. Make sure all points are coincident.

Then select the center of the circle, then the two blue diagonal lines and click on Point on object, the circle must be centred at the intersection of the diagonals, that is at the center of the face. The sketch must be green, completely constrained (it is essential). Note that besides the radius of the circle, it is no longer necessary to create dimensional constraints.



Leave the sketch, we see that the circle is well centred. (The pocket feature was not deleted, but modified). If you change the dimensions of the part again, the thickness or the length, the circle will remain centered on the face.

Avoid construction lines:

It is often possible to avoid creating construction lines. You can edit the sketch again, erase the construction lines and use a Symmetric constraint between the two opposite vertices of the external geometry lines and the centre of the circle (select points in this order):



We get exactly the same resultat for the position of the hole. In fact, thanks to the constraints available in the Sketcher workbench, there are many possible methods. This example shows that it is often better to choose the simplest method, thus limiting the number of objects created as well as the errors that might result.

Second method using a datum plane.

Here is another, faster method that is possible since version 0.17: the use of a datum plane and its attachment.

Start by erasing the "Pocket" function as well as the sketch of the hole. Select the top face and click Datum point: create a datum point in the active body. The attachment mode chosen must be "Center of mass".

As the face is rectangular, its center of mass corresponds to the center of its diagonals. Validate, and a datum point is created. Select the top face again and while holding down the CTRL key, select the point you just created in the Model tree, release CTRL and click Datum plane. A reference plane is created with the origin of the point. Click OK.

It is now very easy to center the circle! Select from the Model tree or in the 3D view the plane you created, and click on Create a sketch, a sketch is created with as origin, the origin of the plane. Then just trace the 5 mm radius circle on this origin, then validate (the sketch must be green imperatively).

You get with "Pocket", as created previously, the hole and it will always be centered.



This tutorial is completed, save this file, you can have fun exploring various features. Change other dimensions, make other shapes, put other holes on other faces, it is when making mistakes that we progress!

You can also continue with this other tutorial of a slightly more complicated part:

Basic Part Design Tutorial 017