Manual:Traditional modeling, the CSG way/it

CGS sta per Geometria solida costruttiva e descrive il modo più semplice per lavorare con la geometria solida 3D, con cui si creano oggetti complessi con l'aggiunta e la rimozione di pezzi a o da solidi usando le operazioni booleane, come unione, sottrazione o intersezione.

Come si è visto in precedenza in questo manuale, FreeCAD è in grado di gestire diversi tipi di geometria, ma il tipo preferito e più utile per gli oggetti 3D che vogliamo progettare con FreeCAD, cioè gli oggetti del mondo reale, è, senza dubbio, il solido, la geometria BREP che viene gestita principalmente dall'ambiente Part. A differenza dei poligoni mesh, che sono fatti solo di punti e triangoli, gli oggetti BREP hanno le loro facce definite da curve matematiche che permettono una precisione assoluta, a prescindere dalla scala.



La differenza tra i due può essere paragonata alla differenza tra le mmagini bitmap e quelle vettoriali. Come nelle immagini bitmap, le mesh poligonali hanno le loro superfici curve frazionate in una serie di punti. Se si guardano da molto vicino, o si stampano molto grandi, non si vede una curva, ma una superficie sfaccettata. Invece nelle immagini vettoriali come con i dati BREP, la posizione di un punto di una curva non viene memorizzata nella geometria, ma calcolata al volo, con assoluta precisione.

In FreeCAD, tutta la geometria basata su BREPd è gestita da un altro pezzo di software open-source, OpenCasCade. L'interfaccia principale tra FreeCAD e il kernel OpenCasCade è l'ambiente Parte. La maggior parte degli altri ambienti costruiscono la loro funzionalità sull'ambiente Parte.

Anche se altri ambienti offrono spesso degli strumenti più avanzati per costruire e manipolare la geometria, dato che in realtà manipolano tutti degli oggetti Parte, è molto utile sapere come questi oggetti lavorano internamente, ed essere in grado di utilizzare gli strumenti di Parte, poiché, essendo più semplici, spesso possono aiutare a risolvere dei problemi che gli strumenti più intelligenti non riescono a risolvere in modo corretto.

Per illustrare il funzionamento dell'ambiente Parte, modelliamo questo tavolo, utilizzando solo operazioni CSG (tranne le viti, per cui useremo uno degli addons, e le dimensioni che vedremo nel prossimo capitolo):



Crere un nuovo documento (Ctrl + N o il menu File -> Nuovo documento), passare all'ambiente Parte, e cominciare con la prima gamba:


 * Premere il pulsante [[Image:Part_Box.png|16px]] Box
 * Selezionare il box, quindi impostare le seguenti proprietà (nella tabella Dati):
 * Lunghezza: 80mm (o 8cm, o 0.8m, FreeCAD opera in qualsiasi unità)
 * Larghezza: 80mm
 * Altezza: 75cm
 * Duplicare il box premendo Ctrl+C poi Ctrl+V (o menu Modifica -> Copia e Incolla)
 * Selezionare il nuovo oggetto che è stato creato
 * Cambiare la sua posizione modificando la sua proprietà Placement:
 * Posizione x: 8mm
 * Posizione y: 8mm

Si dovrebbe ottenere due parallelepipedi, uno scostato dall'altro di 8 millimetri:




 * Ora possiamo sottrarre uno dall'altro: Selezionare il primo, vale a dire quello che rimane, poi,con il tasto CTRL premuto, selezionare il secondo, quello da sottrarre (l'ordine è importante) e premere il pulsante [[Image:Part_Cut.png|16px]] Taglio:



Osservare che l'oggetto appena creato, chiamato "Cut", contiene ancora i due cubi usati come operandi. In realtà, i due cubi sono ancora lì nel documento, sono semplicemente stati nascosti e raggruppati sotto l'oggetto Cut nella vista ad albero. È ancora possibile selezionarli espandendo la freccia accanto all'oggetto Cut, e, se lo si desidera, renderli nuovamente visibili e cliccarli con il tasto destro per modificare le loro proprietà.


 * Ora crere le altre tre gambe duplicando il cubo di base 6 altre volte. Dato che è ancora copiato, si può semplicemente incollarlo (CTRL + V) 6 volte. Cambiare la loro posizione con la seguente:
 * 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


 * Ora fare gli altri tre Tagli, selezionando prima il cubo "ospite", quindi il cubo da tagliare. Ora abbiamo quattro oggetti Cut:



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 [[Image:Part_Cylinder.png|16px]] 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 simlpy 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 proprty. 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 tighly 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 aggegates 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 reforcing 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


 * The file produced in this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/table.FCStd

Read more


 * The Part Workbench
 * The FreeCAD addons repository
 * WBThe Fasteners Workbench