Страница произведения
Войти
Зарегистрироваться
Страница произведения

The FreeCAD interface


Жанр:
Опубликован:
19.10.2026 — 19.10.2026
Аннотация:
Нет описания
Предыдущая глава  
↓ Содержание ↓
↑ Свернуть ↑
  Следующая глава
 
 

The Draft snapping settings: http://www.freecadweb.org/wiki/index.php?title=Draft_Snap

The expressions system: http://www.freecadweb.org/wiki/index.php?title=Expressions

The IFC format: https://en.wikipedia.org/wiki/Industry_Foundation_Classes

IfcOpenShell: http://ifcopenshell.org/

IfcPlusPlus: http://ifcplusplus.com/

Inkscape: http://www.inkscape.org

Using spreadsheets

FreeCAD features another interesting workbench to explore: the Spreadsheet Workbench. This workbench allows to create spreadsheets such as those made with Excel or LibreOffice directly in FreeCAD. These spreadsheets can then be populated with data extracted from your model, and can also perform a series of calculations between values. Spreadsheets can be exported as CSV files, which can be imported in any other spreadsheet application.

In FreeCAD, however, spreadsheets have an additional utility: Their cells can receive a name, and can then be referenced by any field supported by the expressions engine. This turns spreadsheets into powerful control structures, where the values inserted in specific cells can drive dimensions of the model. There is only one thing to keep in mind, as FreeCAD prohibits circular dependencies between objects, a same spreadsheet cannot be used to set a property of an object and at the same time retrieve a property value from the same object. That would make the spreadsheet and the object depending on each other.

In the following example, we will create a couple of objects, retrieve some of their properties in a spreadsheet, then use the spreadsheet to directly drive properties of other objects. se

Reading properties

Start by switching to the Part Workbench, and create a couple of objects: a box, a cylinder and a sphere.

Edit their Placement property (or use the Draft Move tool) to place them a little apart, so we can watch better the effects of what we'll do:

Now, lt's extract some information about these objects. Switch to the Spreadsheet Workbench

Press the New Spreadsheet button

Double-click the new Spreadsheet object in the tree view. The spreadsheet editor opens:

The spreadsheet editor of FreeCAD, although it is not as complete and powerful as the more complete spreadsheet applications we listed above, has nevertheless most of the basic tools and functions that are commonly used, such as the possibility to change the aspect of the cells (size, color, alignment), join and split cells, use formulas such as =2+2, or reference other cells with =B1.

In FreeCAD, to these common behaviours, has been added one very interesting: The possibility to reference not only other cells, but other objects from the document, and retrieve values from their properties. For example, let's retrieve a couple of properties from the 3 objects we created above. Properties are what we can see in the properties editor window, under the Data tab, when an object is selected.

Let's start by entering a couple of texts in the cells A1, A2 amd A3, so we remember what is what later on, for example Cube Length, Cylinder Radius and Sphere Radius. To enter text, just write in the "Contents" filed above the spreadsheet, or double-click a cell.

Now let's retrieve the actual length of our cube. In cell B1, type =Cube.Length. You will notice that the spreadhseet has an autocompletion mechanism, which is actually the same as the expression editor we used in the previous chapter.

Do the same for cell B2 (=Cylinder.Radius) and B3 (=Sphere.Radius).

Although these results are expressed with their units, the values can be manipulated as any number, try for example entering in cell C1: =B1*2.

We can now change one of these values in the propertties editor, and the change will be immediately reflected in the spreadsheet. For example, let's change the length of our cube to 20mm:

The Spreadsheet Workbench page will describe more in detail all the possible operations and functions that you can use in spreadsheets.

Writing properties

Another very interesting use of the Spreadsheet Workbench in FreeCAD is to do the contrary of what we have been doing until now: Instead of reading the values of properties of 3D objects, we can also assign values to these objects. Remember, however, one of the fundamental rules of FreeCAD: Circular dependencies are forbidden. We can therefore not use the same spreadsheet to read and write values to a 3D object. That would make the object depend on the spreadsheet, which would also depend on the object. Instead, we will create another spreadsheet.

We can now close the spreadsheet tab (under the 3D view). This is not mandatory, there is no problem in keeping several spreadsheet windows open.

Press the New Spreadsheet button again

Change the name of the new spreadsheet to something more meaningful, suchas Input (do this by right-clicking the new spreadsheet object, and choosing Rename).

Double-click the Input spreadsheet to open the spreadsheet editor.

In cell A1, let's put a descriptive text, for example: "Cube dimensions"

In cell B1, write =5mm (using the = sign makes sure the value is interpreted as a unit value, not a text).

Now to be able to use this value outside the spreadsheet, we need to give a name, or alias, to the B1 cell. Right-click the cells, click Properties and select the Alias tab. Give it a name, such as cubedims:

Press OK, then close the spreadsheet tab

Select the cube object

In the properties editor, click the little expression icon at the right side of the Length field. This will openthen expressions editor, where you can write Spreadsheet001.cubedims. Repeat this for Height and Width:

You might wonder why we had to use "Spreadsheet001" instead of "Input" in the expression above. This is beacause each object, in a FreeCAD document, has an internal name, which is unique in the document, and a label, which is what appears in the tree view. If you uncheck the appropriate option in the preferences settings, FreeCAD will allow you to give the same label to more than one object. This is why all operations that must identify an object with absolutely no doubt, will use the internal name instead of the label, which could designate more than one object. The easiest way to know the internal name of an object is by keeping the selection panel (menu Edit->Panels) open, it will always indicate the internal name of a selected object:

By using cell aliases in spreadsheets, we are able to use a spreadsheet to store "master values" in a FreeCAD document. This can be used, for example, to have a model of a piece of certain dimensions, and to store these dimensions in a spreadsheet. It becomes then very easy to produce another model with different dimensions, it is just a matter of opening the file and changing a couple of dimensions in the spreadsheet.

Finally, note that the constraints inside a sketch can also receive the value of a spreadsheet cell:

You can also give aliases to dimensional constraints (horizontal, vertical or distance) in a sketch (you can then use that value from outside the sketch as well):

Download

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

Read more

The Spreadsheet Workbench: http://www.freecadweb.org/wiki/index.php?title=Spreadsheet_Module

The Expressions engine: http://www.freecadweb.org/wiki/index.php?title=Expressions

Creating FEM analyses

FEM stands for Finite Element Method. It is a vast mathematical subject, but in FreeCAD we can resume it as a way to calculate propagations inside a 3D object, by cutting it into small pieces, and analyzing the impact of each small piece over its neighbours. This has several uses in the engineering and electomagnetism fields, but we will look here more in depth at one use that is already well developed in FreeCAD, which is simulating deformations in objects which are submitted to forces and weights.

Obtaining such simulation is done in FreeCAD with the FEM Workbench. It involves different steps: Preparing the geometry, setting its material, performing the meshing (division into smaller parts, like we did in the Preparing objects for 3D printing chapter, and finally calculating the simulation.

Preparing FreeCAD

The simulation itself is done by another piece of software, that is used by FreeCAD to obtain the results. As there are several interesting open-source FEM simulation applications available, the FEM Workbench has been made to be able to use more than one. However, currently only CalculiX is fully implemented. Another piece of software, called NetGen, which is responsible for generating the subdivision mesh, is also required. Detailed instructions to install these two components are provided in the FreeCAD documentation.

Preparing the geometry

We will start with the house we modelled in the BIM modeling chapter. However, some changes have to be made to make the model suitable for FEM calculations. This involves, basically, discarding the objects that we don't want to include in the calculaiton, such as the door and window, and joining all the remaining objects into one.

Load the house model we modeled earlier

Delete or hide the page object, the section planes and the dimensions, so we stay only with our model

Hide the window, the door and the ground slab

Also hide the metal beams from the roof. Since they are very different objects from the rest of the house, we will simplify our calculation by not including it. Instead, we will consider that the roof slab is directly placed on top of the wall.

Now move the roof slab down so it rests on top of the wall: Edit the Rectangle object that we used as a base of the roof slab, and change it's Placement->Position->X value from 3.18m to 3.00m

Our model is now clean:

The FEM Workbench can currently calculate deformations on one single object only. Therefore, we need to join our two objects (the wall and the slab). Switch to the Part Workbench, select the two objects, and press the Fuse. We now have obtained one fused object:

Creating the analysis

We are now ready to start a FEM analysis. Let's switch to the FEM Workbench

Select the fusion object

Press the New Analysis button

A new analysis will be created and a settings panels opened. Here you can define the meshing parameters to be used to produce the FEM mesh. The main setting to edit is the Max Size which defines the maximum size (in millimeters) of each piece of the mesh. For now, we can leave the default value of 1000:

After pressing OK and a few seconds of calculaiton, our FEM mesh is now ready:

We can now define the material to be applied to our mesh. This is important because depending on the material strength, our object will react differently to forces applied to it. Select the analysis object, and press the New Material button.

A task panel will open to allow us to choose a material. In the Material drop-down list, choose the Concrete-generic material, and press OK.

We are now ready to apply forces. Let's start by specifying which faces are fixed into the ground and can therefore not move. Press the Fixed Constraint button.

Click on the bottom face of our building and press OK. The bottom face is now indicated as unmovable:

We will now add a load on the top face, that could represente, for example, a massive weight being spread on the roof. For this we will use a pressure constraint. Press the Pressure Constraint button.

Click the top face of the roof, set the pressure to 10MPa (the pressure is applied by square millimeter) and click the OK button. Our force is now applied:

We are now ready to start the calculation. Select the CalculiX object in the tree view, and press the Start Calculation button.

In the task panel that will open, click first the Write .inp file button to create the input file for CalculiX, then the Run CalculiX button. A few moments later, the calculation will be done:

We can now look at the results. Close the task panel, and see that a new Results object has been added to our analysis.

Double-click the Results object

Set the type of result that you want to see on the mesh, for example "absolute displacement", tick the show checkbox under Displacement, and move the slider next to it. You will be able to see the deformation growing as you apply more force:

The results displayed by the FEM workbench are of course currently not enough to perform real-life decisions about structures dimensionning and materials. However, they can already give precious information about how the forces flow through a structure, and which are the weak areas that will bear the more stress.

Downloads

The file created during this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/fem.FCStd

Read more

The FEM Workbench: http://www.freecadweb.org/wiki/index.php?title=Fem_Workbench

Installing required FEM components: http://www.freecadweb.org/wiki/index.php?title=FEM_Install

CalculiX: http://www.calculix.de/

NetGen: https://sourceforge.net/projects/netgen-mesher/

Creating renderings

In computer talk, a rendering is a word used to describe a nice image produced from a 3D model. Of course, we could say that what se see in the FreeCAD 3D view is already nice. But anybody who saw a recent Hollywood movie knows that it is possible to produce images with a computer that are almost undistinguishable from a photograph.

Of course, producing such photo-realistic images requires a lot of work, and a 3D application that offers specific tools for that, such as precise controls for materials and lighting. FreeCAD being an application more geared towards technical modeling, it doesn't feature any advanced rendering tool.

Fortunately, the opens-source world offers many applications to produce realistic images. Probably the most famous one is Blender, which is very popular and widely used in the movies and gaming industries. 3D models can very easily and faithfully be exported from FreeCAD and imported into Blender, where you can add realistic materials and illumination, and produce the final images or even animations.

Some other open-source rendering tools are made to be used inside another application, and will take care of doing the complex calculations to produce realistic images. Through its Raytracing Workbench, FreeCAD can use two of these rendering tools: POV-Ray and Luxrender. POV-Ray is a very old project, and is considered a classical raytracing engine, while Luxrender is much newer, and is categorized as an unbiased renderer. Both have their strengths and weaknesses, depending on the type of image one wants to render. The best way to know is to look at examples on both engines websites.

Installation

123 ... 789101112
Предыдущая глава  
↓ Содержание ↓
↑ Свернуть ↑
  Следующая глава



Иные расы и виды существ 11 списков
Ангелы (Произведений: 91)
Оборотни (Произведений: 181)
Орки, гоблины, гномы, назгулы, тролли (Произведений: 41)
Эльфы, эльфы-полукровки, дроу (Произведений: 230)
Привидения, призраки, полтергейсты, духи (Произведений: 74)
Боги, полубоги, божественные сущности (Произведений: 165)
Вампиры (Произведений: 241)
Демоны (Произведений: 265)
Драконы (Произведений: 164)
Особенная раса, вид (созданные автором) (Произведений: 122)
Редкие расы (но не авторские) (Произведений: 107)
Профессии, занятия, стили жизни 8 списков
Внутренний мир человека. Мысли и жизнь 4 списка
Миры фэнтези и фантастики: каноны, апокрифы, смешение жанров 7 списков
О взаимоотношениях 7 списков
Герои 13 списков
Земля 6 списков
Альтернативная история (Произведений: 213)
Аномальные зоны (Произведений: 73)
Городские истории (Произведений: 306)
Исторические фантазии (Произведений: 98)
Постапокалиптика (Произведений: 104)
Стилизации и этнические мотивы (Произведений: 130)
Попадалово 5 списков
Противостояние 9 списков
О чувствах 3 списка
Следующее поколение 4 списка
Детское фэнтези (Произведений: 39)
Для самых маленьких (Произведений: 34)
О животных (Произведений: 48)
Поучительные сказки, притчи (Произведений: 82)
Закрыть
Закрыть
Закрыть
↑ Вверх