Manual:Traditional modeling, the CSG way/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "* Maintenant, nous pouvons soustraire l'un de l'autre: Sélectionnez le '''premier''', c'est-à-dire celui qui va '''rester''' donc avec la touche CTRL enfoncée, sélectionne...")
(Created page with "Observez que l'objet nouvellement créé, appelé "Cut", contient toujours les deux cubes que nous avons utilisés comme les opérandes. En fait, les deux cubes sont toujours...")
Line 38: Line 38:
[[Image:Exercise_table_02.jpg]]
[[Image:Exercise_table_02.jpg]]


Observez que l'objet nouvellement créé, appelé "Cut", contient toujours les deux cubes que nous avons utilisés comme les opérandes. En fait, les deux cubes sont toujours présents dans le document, ils ont simplement été cachés et regroupés sous l'objet "Cut" dans l'arborescence. Vous pouvez toujours les sélectionner en développant la flèche à côté de l'objet "Cut" et, si vous le souhaitez, les rendre visibles à nouveau en cliquant droit sur eux ou en modifiant l'une de leurs propriétés.
Observe that the newly created object, called "Cut", still contains the two cubes we used as operands. In fact, the two cubes are still there in the document, they have merely been hidden and grouped under the Cut object in the tree view. You can still select them by expanding the arrow next to the Cut object, and, if you wish, turn them visible again by right-clicking them or change any of their properties.


* Now let's create the three other feet by duplicating our base cube 6 other times. Since it is still copied, you can simply paste (Ctrl+V) 6 times. Change their position as follows:
* Now let's create the three other feet by duplicating our base cube 6 other times. Since it is still copied, you can simply paste (Ctrl+V) 6 times. Change their position as follows:

Revision as of 21:22, 4 June 2017

CGS signifie Constructive Solid Geometry et décrit la manière la plus simple de travailler avec la Géométrie 3D solide, qui crée des objets complexes en ajoutant/enlevant des éléments de volumes en utilisant des opérations booléennes telles que l'union, la soustraction ou l'intersection de solides.

Comme nous l'avons vu plus tôt dans ce manuel, FreeCAD peut gérer de nombreux types de géométrie, mais le type préféré et le plus utile pour le genre d'objets 3D que nous voulons concevoir avec FreeCAD, c'est-à-dire les objets du monde réel, est, sans aucun doute, solide, la géométrie BREP, qui est principalement prise en charge par l’atelier Part (Part Workbench). Contrairement aux maillages de polygones (polygon meshes), qui sont fabriqués uniquement de points et triangles, les objets BREP ont leurs faces définies par des courbes mathématiques, qui permettent une précision absolue, peu importe l'échelle.

La différence entre les deux peut être comparée à la différence entre bitmap et images vectorielles. Comme pour les images bitmap, les maillons polygonaux ont leurs surfaces courbes fractionnées en une série de points. Si vous le regardez très près, ou que vous l'imprimez très grand, vous n’allez pas voir une surface courbe mais une surface facettisée. Dans les images vectorielles et les données BREP, la position de n'importe quel point sur une courbe n'est pas stockée dans la géométrie mais est calculée à la volée, avec une précision exacte.

Dans FreeCAD, toute la géométrie basée sur BREP est gérée par un autre logiciel open source, OpenCasCade. L'interface principale entre FreeCAD et le noyau OpenCasCade est l’atelier Part. La plupart des autres ateliers créent leurs fonctionnalités au dessus de l’atelier Part.

Bien que d'autres ateliers proposent souvent des outils plus avancés pour construire et manipuler la géométrie, puisqu'ils manipulent tous les objets Part, il est très utile de savoir comment ces objets fonctionnent en interne et peuvent utiliser les outils de Part car, plus simples, ils peuvent très souvent vous aider à contourner les problèmes que les outils les plus intelligents ne parviennent pas à résoudre correctement.

Pour illustrer le fonctionnement de l’atelier Part, nous modéliserons cette table, en utilisant uniquement des opérations CSG (à l'exception des vis, pour lesquelles nous utiliserons l'un des greffons (addons), et les dimensions, qui seront vues dans le chapitre suivant) :

Créez un nouveau document (Ctrl + N ou menu Fichier -> Nouveau document), passez à l’atelier Part, et commencez par le premier pied :

  • Appuyez sur le bouton Boîte
  • Sélectionnez la boite obtenue, puis définissez les propriétés suivantes (dans l'onglet Données):
    • Longueur: 80mm (ou 8cm, ou 0.8m, FreeCAD fonctionne dans n'importe quelle unité)
    • Largeur: 80mm
    • Hauteur: 75cm
  • Dupliquez la boîte en appuyant sur Ctrl + C puis sur Ctrl + V (ou menu Edition -> Copier et coller)
  • Sélectionnez le nouvel objet qui a été créé
  • Changez sa position en modifiant sa propriété de placement :
    • Position x: 8mm
    • Position y: 8mm

Vous devriez obtenir deux boîtes hautes, à une distance de 8 mm l'une de l'autre :

  • Maintenant, nous pouvons soustraire l'un de l'autre: Sélectionnez le premier, c'est-à-dire celui qui va rester donc avec la touche CTRL enfoncée, sélectionnez l'autre, qui sera soustrait (l'ordre est important) et appuyez sur le bouton Soustraction (soustraction booléenne)  :

Observez que l'objet nouvellement créé, appelé "Cut", contient toujours les deux cubes que nous avons utilisés comme les opérandes. En fait, les deux cubes sont toujours présents dans le document, ils ont simplement été cachés et regroupés sous l'objet "Cut" dans l'arborescence. Vous pouvez toujours les sélectionner en développant la flèche à côté de l'objet "Cut" et, si vous le souhaitez, les rendre visibles à nouveau en cliquant droit sur eux ou en modifiant l'une de leurs propriétés.

  • Now let's create the three other feet by duplicating our base cube 6 other times. Since it is still copied, you can simply paste (Ctrl+V) 6 times. Change their position as follows:
    • cube002: x: 0, y: 80cm
    • cube003: x: 8mm, y: 79.2cm
    • cube004: x: 120cm, y: 0
    • cube005: x: 119.2cm, y: 8mm
    • cube006: x: 120cm, y: 80cm
    • cube007: x: 119.2cm, y: 79.2cm
  • Now let's do the three other cuts, selecting first the "host" cube then the cube to be cut off. We now have four Cut objects:

You might have been thinking that, instead of duplicating the base cube six times, we could have duplicated the complete foot three times. This is totally true, as always in FreeCAD, there are many ways to achieve a same result. This is a precious thing to remember, because, as we will advance into more complex objects, some operations might not give the correct result and we often need to try other ways.

  • We will now make holes for the screws, using the same Cut method. Since we need 8 holes, two in each foot, we could make 8 objects to be subtracted. Instead, let's explore other ways and make 4 tubes, that will be reused by two of the feet. So let's create four tubes by using the Cylinder tool. You can again, make only one and duplicate it afterwards. Give all cylinders a radius of 6mm. This time, we will need to rotate them, which is also done via the Placement property:
    • cylinder: height: 130cm, angle: 90°, axis: x:0,y:1, position: x:-10mm, y:40mm, z:72cm
    • cylinder001: height: 130cm, angle: 90°, axis: x:0,y:1, position: x:-10mm, y:84cm, z:72cm
    • cylinder002: height: 90cm, angle: 90°, axis: x:-1,y:0, position: x:40mm, y:-10mm, z:70cm
    • cylinder003: height: 90cm, angle: 90°, axis: x:-1,y:0, position: x:124cm, y:-10mm, z:70cm

You will notice that the cylinders are a bit longer than needed. This is because, as in all solid-based 3D applications, boolean operations in FreeCAD are sometimes oversensitive to face-on-face situations and might fail. By doing this, we put ourselves on the safe side.

  • Now let's do the subtractions. Select the first foot, then, with CTRL pressed, select one of the tubes that crosses it, press the Cut button. The hole will be done, and the tube hidden. Find it in the tree view by expanding the pierced foot.
  • Select another foot pierced by this hidden tube, then repeat the operation, this time Ctrl+ selecting the tube in the tree view, as it is hidden in the 3D view (you can also make it visible again and select it in the 3D view). Repeat this for the other feet until each of them has its two holes:

As you can see, each foot has become a quite long series of operations. All this stays parametric, and you can go change any parameter of any of the older operations anytime. In FreeCAD, we often refer to this pile as "modeling history", since it in fact carries all the history of the operations you did.

Another particularity of FreeCAD is that the concept of 3D object and the concept of 3D operation tend to blend into one same thing. The Cut is at the same time an operation, and the 3D object resulting from this operation. In FreeCAD this is called a "feature", rather than object or operation.

  • Now let's do the tabletop, it will be a simple block of wood, let's do it with another Box with length: 126cm, width: 86cm, height: 8cm, position: x: 10mm, y: 10mm, z, 67cm. In the View tab, you can give it a nice brownish, wood-like color by changing its Shape Color property:

Notice that, although the legs are 8mm thick, we placed it 10mm away, leaving 2mm between them. This is not necessary, of course, it won't happen with the real table, but it is a common thing to do in that kind of "assembled" models, it helps people who look at the model to understand that these are independent parts, that will need to be attached together manually later.

Now that our five pieces are complete, it is a good time to give them more proper names than "Cut015". By right-clicking the objects in the tree view (or pressing F2), you can rename them to something more meaningful to yourself or to another person who would open your file later. It is often said that simply giving proper names to your objects is much more important than the way you model them.

  • We will now place some screws. There is nowadays an extremely useful addon developed by a member of the FreeCAD community, that you can find on the FreeCAD addons repository, called Fasteners, that makes the insertion of screws very easy. Installing additional workbenches is easy and described on the addons pages.
  • Once you have installed the Fasteners Workbench and restarted FreeCAD, it will appear in the workbenches list, and we can switch to it. Adding a screw to one of our holes is done by first selecting the circular edge of our hole:

  • Then we can press one of the screw buttons of the Fasteners Workbench, for example the EN 1665 Hexagon bolt with flanges, heavy series. The screw will be placed and aligned with our hole, and the diameter will automatically be selected to match the size of our hole. Sometimes the screw will be placed inverted, which we can correct by flipping its invert property. We can also set its offset to 2mm, to follow the same rule we used between the tabletop and the feet:

  • Repeat this for all the holes, and our table is complete!

The internal structure of Part objects

As we saw above, it is possible in FreeCAD to select not only whole objects, but parts of them, such as the circular border of our screw hole. This is a good time to have a quick look at how Part objects are constructed internally. Every workbench that produces Part geometry will be based on these:

  • Vertices: These are points (usually endpoints) on which all the rest is built. For example, a line has two vertices.
  • Edges: the edges are linear geometry like lines, arcs, ellipses or NURBS curves. They usually have two vertices, but some special cases have only one (a closed circle for example).
  • Wires: A wire is a sequence of edges connected by their endpoints. It can contain edges of any type, and it can be closed or not.
  • Faces: Faces can be planar or curved, and can be formed by one closed wire, which forms the border of the face, or more than one, in case the face has holes.
  • Shells: Shells are simply a group of faces connected by their edges. It can be open or closed.
  • Solids: When a shell is tightly closed, that is, it has no "leak", it becomes a solid. Solids carry the notion of inside and outside. Many workbench rely on this to make sure the objects they produce can be built in the real world.
  • Compounds: Compounds are simply aggregates of other shapes, no matter their type, into a single shape.

In the 3D view, you can select individual vertices, edges or faces. Selecting one of these also selects the whole object.

A note about shared design

You might look at the table above, and think its design is not good. The tightening of the feet with the tabletop is probably too weak. You might want to add reinforcing pieces, or simply you have other ideas to make it better. This is where sharing becomes interesting. You can download the file made during this exercise from the link below, and modify it to make it better. Then, if you share that improved file, others might be able to make it even better, or use your well-designed table in their projects. Your design might then give other ideas to other people, and maybe you will have helped a tiny bit to make a better world...

Downloads

Read more