FreeCAD-manual

An experiment at reorganizing the contents of the FreeCAD wiki in an easier, friendlier book-like manner. The manual is now hosted on the FreeCAD wiki

View the Project on GitHub yorikvanhavre/FreeCAD-manual

Traditional modeling - the CSG way

CSG stands for Constructive Solid Geometry and describes the most basic way to work with solid 3D geometry, which is creating complex objects by adding and removing pieces to/from solids by using Boolean operations such as union, subtraction or intersection.

As we saw earlier in this manual, FreeCAD handles many types of geometry, but the preferred and most useful type, which is solid geometry, also called BREP geometry, is mainly handled by the Part Workbench. Unlike polygon meshes, which are made only of points and triangles, BREP objects have their faces defined by mathematical curves, which permit absolute precision, no matter the scale.

Difference between mesh and brep geometry

The difference between the two can be compared to the difference between bitmap and vector images. As with bitmap images, polygon meshes have their curved surfaces subdivided in a series of facets. If you zoom in very closely, or print it very large, you will see, not a curved but a faceted surface. In both vector images and BREP data, the position of any point on a curve is not stored in the geometry but calculated on the fly, with exact precision.

In FreeCAD, all BREP-based geometry is handled by another piece of open-source software, OpenCasCade. The main interface between FreeCAD and the OpenCasCade kernel is the Part Workbench. Most other workbenches build their functionality on top of the Part Workbench.

Although other workbenches often offer more advanced tools to build and manipulate geometry, they all actually manipulate Part objects. It is very useful to know how these objects work internally, and to use the Part tools since, being simpler, they can very often help you to work around problems that the more intelligent tools fail to solve properly.

To illustrate the working of the Part Workbench, we will model this table, using only CSG operations (except the screws, for which we will use one of the add-ons, and the dimensions, which we will see in the next chapter):

Complete table

In this exercise, we will assume some default settings. Feel free to adjust to your liking if you feel so:

Modeling the metallic feet

We will now obtain two overlapping high boxes, one 8mm apart from the other:

The first objects

First foot complete

Observe that by expanding the newly created object called “Cut” in the model tree, it 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. You can still see and select them from the model tree, and, if you wish, turn them visible again by right-clicking them and select Toggle Visibility. You can also still change any of their properties or use them as operands in other subsequent operations.

the four feet

You might now be 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, one particular modeling method might not work out the way we want, and we almost always have the possibility to try other methods.

We should now have obtain four rods crossing the L-shaped feet.

the cylinders to subtract

If anything in your model doesn’t look like the image above, review the cylinders placements:

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. It is a good habit to take to always make sure objects to subtract or unite are always a little bit longer or shorter, in order to avoid coinciding faces.

the pierced feet

Do not forget to save your file often. A benefit of incremental saving is that if the next step becomes too spoiled, you can abandon it with an Exit without Saving and restart from a known valid point.

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. For example if you decide the table should be workbench height, you can go back and change the cube heights to 90cm. In FreeCAD, we often refer to this pile as “modeling history”, since it in fact carries all the history of the operations you did.

In FreeCAD and other feature-based modelers, the concepts of 3D object and 3D operation tend to blend into the same thing. The “Cut” we did above is at the same time an operation, and the 3D object resulting from this operation. In FreeCAD you will therefore often see these called “features” rather than “objects” or “operations”.

Modeling the tabletop

the tabletop

Notice that, although the legs are 8mm thick, we placed our table top 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. And this 2mm spacing is so small that it would not affect the cutting dimensions of the different pieces. It can be considered a “tolerance value”.

Placing the screws

a selected hole

the placed screw

By now frequent incremental file saves should have become a second nature, it is highly recommended to keep this good habit in next chapters of this book.

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:

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 attachment of the feet to the tabletop is probably too weak. You might want to add reinforcing pieces, or 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…

FreeCAD files carry a license field, located, among other useful information, under File → File Properties. You can specify here a sharing-friendly license such as Creative Commons, which legally allows other people to reuse your file, while preserving some of your rights, such as being identified as the author of the file.


Downloads

Read more