Creating a simple part with Draft and Part WB/fr

Introduction
Ce tutoriel a pour but d'être utilisé comme une première introduction à l'atelier Draft dans FreeCAD. Le tutoriel utilise une forme 2D pour créer un solide 3D, ce dernier étant réalisé par le biais de l'atelier Part. Il est recommandé au lecteur de travailler d'abord avec le tutoriel frère Créer une simple pièce avec l'atelier Part, qui crée le même modèle avec une technique différente, tout en couvrant les bases de l'interface utilisateur de FreeCAD. Ce tutoriel s'attend à ce que l'utilisateur soit familiarisé avec l'interface utilisateur et certains flux de travail disponibles dans FreeCAD. Le tutoriel est composé de telle sorte que le but n'est pas nécessairement de montrer la manière la plus efficace d'utiliser le programme, mais plutôt de faire prendre conscience au lecteur des différentes fonctionnalités disponibles dans FreeCAD, comment les utiliser, et où les trouver.

Le tutoriel couvre

 * Le modèle à réaliser
 * Création du profil 2D
 * Pourquoi l'extrusion peut échouer
 * Extrusion du profilé
 * Création du trou traversant
 * Réalisation d'une esquisse à partir du profil 2D
 * Qualité des modèles
 * Conclusion

Le modèle à réaliser




Création du profil 2D
Créez un nouveau document et enregistrez-le directement sous un nouveau nom. Changez la vue pour vue de dessus et passez à l' atelier Draft, votre écran devrait ressembler à celui ci-dessous. Si la grille n'apparaît pas, activez-la ou désactivez-la avec. Draft Basculer la grille.



Pour commencer le profil, dessinez un rectangle aléatoire sur le plan xy en cliquant sur 2 points dans la Vue 3D formant n'importe quelle diagonale d'un rectangle. Un panneau de tâches s'ouvre une fois la commande lancée. Cette fois, nous ne l'utiliserons pas du tout, mais vous pouvez bien sûr entrer directement les coordonnées du rectangle. Votre vue 3D devrait maintenant avoir un rectangle dessiné, similaire à l'image ci-dessous.



Lorsque l'on travaille dans l'atelier Draft, on dessine presque toujours sur un plan 2D. Ce plan 2D est appelé plan de travail, et, si les paramètres par défaut sont utilisés, il s'alignera toujours automatiquement sur la vue 3D courante. Ainsi, jusqu'à ce que le profil 2D soit terminé, il est préférable de conserver simplement la vue du dessus (position de la caméra) et de ne pas jouer avec la rotation de la vue. Si vous l'avez modifiée, il vous suffit de revenir à la vue du dessus avant de lancer une nouvelle commande dans l'atelier Draft.

La vue latérale de notre modèle terminé a un contour extérieur de 100 x 50 mm, et il serait bien que le coin inférieur gauche soit placé à la position zéro globale. Ceci peut être réalisé par l'intermédiaire de l'éditeur de propriétés. Assurez-vous que le Rectangle créé est sélectionné, puis changez la Position du rectangle en (0, 0, 0), modifiez la Hauteur à 50 mm et la Longueur à '100 mm comme dans les images ci-dessous.



Le rectangle est terminé et il devrait ressembler à ceci après avoir appliqué Tout afficher à la vue.



Ensuite, nous allons décomposer le rectangle en ses quatre bords, en sélectionnant d'abord le rectangle puis en lançant la commande Draft Désagréger, la face remplie disparaîtra et l'objet dans l'arborescence est maintenant une polyligne au lieu d'un rectangle, comme le montre l'image de gauche ci-dessous. En lançant Draft Désagréger une fois de plus, la polyligne sera décomposée en ses bords, comme le montre l'image du milieu ci-dessous.



L'observateur remarquera que l'icône de l'objet dans la vue en arborescence pour la polyligne s'est déjà transformée en une "boîte bleue". Cette boîte bleue est l'icône utilisée pour les objets géométriques génériques (les objets géométriques de l'atelier Part pour être précis, mais cela est pour les lecteurs avancés). Sélectionnez le bord vertical gauche et lancez la commande Draft Agréger, l'ancien bord aura maintenant une icône différente et a changé de label en Line. C'est maintenant un objet de l'atelier Draft où l'on peut modifier par exemple le point de départ et le point d'arrivée à travers l'éditeur de propriétés, ce qui n'est pas possible avec les objets arête.

Créer le congé
Commencez par sélectionner les bords du coin supérieur droit, utilisez le menu, Sélection par boîte, maintenez le  bouton gauche de la souris et faites glisser de droite à gauche et relâchez le bouton gauche de la souris. Lorsque l'on fait glisser de droite à gauche, la sélection résultante inclut tout ce qui se trouve entièrement ou partiellement dans la zone de sélection. Si l'on fait glisser de gauche à droite, seuls les objets entièrement compris dans la zone de sélection sont inclus dans la sélection résultante. La sélection réelle se produit lorsque le bouton gauche de la souris est relâché, et il n'y a pas d'aperçu de ce qui sera sélectionné.



Avec les bords du coin supérieur droit sélectionnés, lancez la commande congé dans l'atelier Draft. Cochez la case Supprimer les objets originaux et modifiez le rayon à 20 mm et appuyez sur.



Le congé est créé et votre modèle devrait maintenant ressembler à ce qui suit.



Créer le chanfrein
Pour réaliser le chanfrein, nous devons disposer d'une ligne avec la bonne inclinaison et aussi pouvoir la positionner correctement. Commençons par la position, qui est à la coordonnée (50, 50, 0). Dans le profil actuel, nous n'avons pas de point à cet endroit, alors créons-en un en faisant une ligne d'aide temporaire. Sélectionnez d'abord la ligne verticale gauche, puis créez la ligne d'aide en Dupliquer une sélection dans, Ligne001 est créée. Utilisez léditeur de propriétés et déplacez la Ligne001' de 50 mm dans la direction x en utilisant la propriété Placement. Dupliquez ensuite l'arête horizontale inférieure et modifiez l'angle de l'arête à 30 degrés, en utilisant à nouveau la propriété Placement. Le modèle devrait maintenant ressembler à l'image ci-dessous.



Ensuite, il faut déplacer la ligne angulaire en position. Pour cela nous utilisons Draft Déplacer ainsi que la fonctionnalité aimantation dans l'atelier Draft, plus spécifiquement l'aimantation terminaison. Assurez-vous d'abord que votre barre d'outils d'aimantation ressemble à celle ci-dessous.



Ensuite, sélectionnez la ligne angulaire, Edge001, appuyez sur Déplacer et un panneau de tâches s'ouvre.



Make sure that Copy is unchecked. Hover the mouse over the upper quarter of the angled line, once the white dot is displayed at the right spot and the end point symbol shows, click the LMB. Move the mouse to the upper quarter of the help line, once the white dot and end point symbol appear, click the LMB. The sequence is illustrated below.



The line is now in the correct position, but it is too long. To adjust the length Draft Trimex will be used. Click on the left part of the angled line, i.e. the part of Edge001 that is to be removed. Once the line is selected, press Trim and then click on the left-most vertical line, Line. The image below shows the Trim command invoked, and the pre-selected vertical line.



Also trim the left-most vertical line to form the lower corner of the chamfer. Here you probably need to do the trimming in 2 steps. The trim function can make an undesired flip, keeping the longest part of the object to be trimmed. In those cases, trim a shorter distance first by simply clicking in the 3D view for example halfway of your intended trim. The trim function accepts any click in the 3D view. If you get it wrong, just use Undo and  Refresh (the latter often called recompute) and try again.



To trim the upper horizontal edge, the Fillet needs to be downgraded so that the upper edge is its own object in the Tree View. If you attempt to trim it without first having done the downgrade, the trimming function attempts to trim the arc in the fillet. You may need to trim the line in steps to avoid the resulting trim to flip.

The profile is ready and shown below with the edges organized in a Group named Profile (or labeled to be precise in FreeCAD lingo), along with the help line deleted. Groups can be used to organize the features in your FreeCAD documents, its usage is similar to a folder structure on a computer’s file system. To move things in and out of the group, use drag and drop in the Tree View.



Why extruding can fail
Save the document. We will experiment in this paragraph and we want to be able to go back to the current model.

Let’s jump right in: select all the edges in the group Profile, and in the Part Workbench invoke the command  Extrude. A task panel opens, accept all the defaults and click.



That did not work out, but it sounds easy enough to fix the error, we just need to specify a direction. Click to get back to the task panel and select custom direction.



Accept the default z-axis and once more click.



We managed to make a fence like structure, judging from the Tree View every edge is treated separately. It is not the filled solid that we want. Hit Undo, and let’s try something else.

Scrolling all the way to the bottom of the Extrude task panel there is an option Create solid, check that option and click.



Everything disappeared, clearly that did not work either. Let’s go through why none of these ways are working. In the first case we got an error that the direction could not be determined. A flat face has a normal, i.e. direction, a line does not. Since from our second attempt we know that it worked when providing a direction, the error simply comes from trying to extrude a line without knowing a direction. The observant will say that an arc has a normal (direction), this is true. If you select only the edge that is the arc, FreeCAD will extrude it, also with default settings.

In the second case it worked, but we also got an extrusion for each edge we had in our selection. The resulting features however are not what we want, i.e. a solid.

In the third case we checked Create solid, and ended up with everything disappearing. The objects in the Tree View have a different icon as well, there is a white exclamation mark on a red background, that particular overlay icon means that the object has an error that has to be tended to. One can read up on the different types of overlay icons on the wiki.

Hovering over any of the Tree View objects with the overlay icon a tool tip is displayed, it says Wire is not closed.



In our case the error is not fixable. It is geometrically impossible to create a solid out of an extruded single line. An extruded line simply becomes a sheet, or shell in FreeCAD lingo. In other words, this is not a FreeCAD limitation, it is a fundamental outcome of geometrical theory. The reason why the 3D view goes completely blank is that the created features, or objects in the Tree View, have errors in the produced shape, and thus contain nothing to render. FreeCAD does however create the new document objects (in this case extrusions) and thus hides any geometry/object used for making the new document objects. That is why the screen goes blank when trying to make a solid out of a line, or lines.

The tool tip says it all, in order to extrude into a solid one needs a closed wire, or a face. A face is, per definition, simply a closed wire that is filled. One way to create a closed wire out of our profile edges is to select them all and apply Draft Upgrade. If applied once it becomes a wire, while at the same time it consumes the individual edges from the Tree View. If applied twice it becomes a face, either of those allows for a successful solid extrusion.

Before going on to the next paragraph: open the previous version of the document.

Extruding the profile
Another way to create the closed wire is with the Shape builder command from the Part Workbench, which allows for making a wire without consuming the individual edges. Part Shape builder is a powerful tool to create any geometric entity in FreeCAD that can be used further to create complex solids, the simplest example is creating a line between two vertices. Click Part Shape builder to bring up the task panel.



We can use either Wire from edges or Face from edges. Multiple selections have to be made with the key pressed down. Let’s use Face from edges, once that option is selected one can also select Planar, do that as well. Then select all edges in the profile, the order does not matter (in this case) and click, and then to come back to the Tree View. The face has been created.



Select the Face and invoke Part Extrude, set the extrusion length to 30 mm and click.



Creating the through hole
To make the through hole we need a cylinder correctly positioned to make a boolean cut with.

Create a cylinder, and position it correctly. In this case the radius is 5 mm, the height is set to 60 mm. For the placement, first it is rotated -90 degrees around the x-axis, then positioned at (65, -5, 15). The negative 5 in the y-direction is because the height is 10 mm longer than needed.



It does not hurt to make the height of the cylinder longer than needed. For a simple model like this it will not matter if the cylinder is the exact height of the profile. It is however good practice to avoid co-planar faces to prevent numerical errors in the geometric kernel that can sometimes result in strange effects, or failures in subsequent operations.

With a final boolean cut, and after changing the appearance of the resulting object, the model is completed.



Making a sketch out of the 2D profile
Using the Draft Workbench is one way of creating a 2D profile. In the Draft Workbench a wire can be made in 3D space. FreeCAD provides another tool to make 2D profiles – the Sketcher Workbench. Using a sketch is a more versatile way to create a 2D profile. Any 2D profile made in the Draft Workbench can be converted to an unconstrained sketch.

Start by hiding the Cut feature and make the edges in the profile visible. Select the edges and from the Draft Workbench press the toolbar button Draft to Sketch. You should see the same as in the image below.



Next, hide the original edges and double-click the Sketch object in the Tree View, bringing you to the following state, i.e. the Sketcher task panel opened.



This is how it looks when one edits a sketch. Since this is not a tutorial for using the Sketcher just go ahead and close it. If you want an introduction to sketching, which is a core workflow in any 3D parametric CAD, please follow the sister tutorial Creating a simple part with PartDesign.

With the Sketch closed and selected, from the Part Workbench use Extrude in the same way as before. The basic block of the simple model is ready once again.



Quality of models
Sooner or later when working with 3D parametric CAD you will come across a broken model, either one you have made yourself, or a model that you have imported. A broken model can work for its purpose, but more often than not, there are subsequent operations that simply will not work. To repair a broken model one has to know what to repair, this is where the built-in quality check tools in FreeCAD come in.

First let us check the quality of the recently created Extrude001. With the Part Workbench active, first select Extrude001 and then use the command Check geometry. Check all settings checkboxes except the top one, and click the button.



Our model is OK, no errors are reported. There is also a listing of the models content, or in FreeCAD lingo, the content of the shape, i.e. how it is put together from ground up. Here one can see that apparently to make a solid one also needs a shell, and the shell is made out of faces, and so on. In other words, you can create any solid by simply starting out by making points, or vertices, from those one makes edges, and from those one creates wires, and out of the wires one makes faces which are then stitched into a shell, from which one finally arrives at a solid. A solid can only be made from a watertight shell. A not watertight shell is a common source of troublesome CAD models, it can for example happen with imported geometry created in a different software, especially when using the commonly available neutral file formats.

Another check one can do is related to the Sketch. Close the task panel for the geometry check. Select the Sketch, expand Extrude001 in the Tree View if needed in order to see the sketch object. Switch to the Sketcher Workbench, use the command  Validate sketch, a task panel opens. In the task panel, click the button for Missing coincidences. It highlights and reports 6 of them, i.e. all the points where the edges meet.



Click in the pop-up dialog and then click the  button to heal the Missing coincidences. If you close the task panel, and go into edit mode of the Sketch, it reports 12 degrees of freedom, as opposed to the earlier 24. That was achieved through adding coincident constraints to the endpoints of the edges.

The observant reader notices that when using edges from Draft those had to be joined into a closed wire to make a solid extrusion, whereas in Sketcher that was apparently not needed. The logic here is that the sketch is one object, and the extrusion of one object is treated as if it was a closed wire (in this case).

Finally it should be pointed out that, although creating subsequent objects from sketches with open vertices can work, it is best practice to not have any, as well as to have a fully constrained sketch (as opposed to an under-constrained sketch). The reason why it works here is that the sketch is created from a Draft profile constructed in such a way that the endpoints of the edges match without any gaps. If you draw by hand in a sketch, and also try to match endpoints by hand, it is virtually guaranteed that endpoints will not match, i.e. the gaps (although not really visible on the screen) will be large enough that the geometric kernel cannot consider the edges to be geometrically joined.

Wrapping up
Having gone through the tutorial you have become somewhat familiar with the basic functionality of FreeCAD, along with the core workbenches Part and Draft. You are also aware of the existence of the Sketcher Workbench, which for many experienced users is the sole tool used to create 2D profiles later utilized in solid feature operations. The use of sketches is a core concept in the PartDesign Workbench. It is suggested that you learn sketches and PartDesign Workbench next if your focus is on creating solids. The sister-tutorial Creating a simple part with PartDesign makes the same model as this tutorial. If your focus is modeling buildings your next learning should be the Draft and Arch workbenches.

At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider contributing to FreeCAD, for example by improving the documentation.