FreeCAD BIM development news - January 2019

Hi all,

This is the report of the BIM features I implemented in FreeCAD this month. As FreeCAD is still in feature freeze (as usual, the new release is taking more time than we planned, new bugs appear all the time and we definitely want to squash as many as possible), almost all of the development of this month went into the BIM workbench which is developed outside the FreeCAD core code, and therefore not subject to the feature freeze.

There is quite a lot of new stuff this month so I'll make it short. Thanks a bunch to everybody to helps this effort by sponsoring me on Patreon, Liberapay or directly via PayPal! Quite a lot of you are behind this since the early beginnings, almost two years ago, I am really deeply honoured by your trust.

Apologies for not having a video this month again, but I believe you won't feel hungry after reading this

Arc by 3 points

This is a very simple tool, that will make it to the Draft workbench too as soon as we are out of feature freeze. It simply allows you to create an arc by given three points through which the arc must pass, instead of the center, start and end points of the default Draft Arc tool. At the moment it produces an object that is not parametric, mostly because I still couldn't make my mind if internally, the resulting object should be the same as the current Draft one (that is, loose its midpoint parameter), or a different one with three vector properties.

Split IfcElements and Quantities

The IFC Elements manager has now been split into three different tools: Elements manager, quantities manager and properties manager. This is mostly to keep the code elegant and easy to dive in, it was becoming very big and complex, now each distinct functionality is in its own tool and python file, that will make it a lot easier to maintain and to extend.

The Elements manager continues just the same as before: It allows you to bulk-manage IFC types and materials of your BIM model, and quickly ensure that everything has the correct type and material.

IFC Quantities manager improvements

This is where you define which quantities will be explicitly exported to IFC. As I wrote in these pages earlier, quantities such as length or width or area of an object can be explicitly written in the IFC file, which makes it unnecessary for other BIM applications to analyse the geometry to know it. A spreadsheet, for example, would be able to quickly calculate quantities from an IFC file without having a geometry engine.

With the split of this functionality in its own tool, it also gained a bit more practicality, no more need to click items one by one, you can now select a bunch of objects, and press the column header to apply the setting to all selected objects.

IFC properties manager

The biggest change brought by the split of the Elements manager is that we now have a proper and decent bulk IFC properties editor. It was already possible to add IFC properties and property sets to individual objects, but that's very tedious if you want to apply some standards, such as, for example, add a Pset_WallCommon to all your walls. With this new tool, you can now easily add property sets or individual properties to any object, individually or together, edit the values of those properties, and search objects to check which one has or hasn't a given property or property set.

Classification manager improvements

The Classification manager tool has also received a good upgrade. Before, it only allowed you to give classes to materials, now it also allows you to bulk-classify all your BIM objects and gives a clear view of what is missing a class.

Note that the classification is still not exported to IFC, but as soon as we are out of feature freeze, that will be done.

Nudge tool

This is of course inspired by the similar tool in Revit, but I believe we've made something way more powerful here. The idea is that you can use the arrow keys of the keyboard (CTRL+arrows in FreeCAD) to move objects slightly, in any Cartesian direction. This is very useful when modelling details. In Revit, how far the objects get moved depends on your zoom level. In FreeCAD, we have two modes: a fixed one and an automatic one. Automatic mode works like Revit, but fixed mode will always move objects by a same distance that you can specify. This can therefore become extremely useful in other situations, for example moving walls, doors or windows 10 cm in any direction.

Additionally, the nudge tool is also able to perform other things: Rotate objects by 45° clockwise or counter-clockwise (CTRL+. or ,), and, if the selected objects are walls or structures, expand or shrink their extrusion distance (CTRL+Page Up or Page Down).

It also has a control in the status bar, from which you can set the nudge distance. Hovering the mouse over that control shows you all the keyboard shortcuts above.

Unclone tool

This new tool does the contrary of the Clone tool. It turns a cloned object into an independent copy. So far it only works for Arch/BIM objects that are clones of another, not for regular Draft Clone objects. Ultimately, the idea is to reach the same level of comfort as Blender, where it is very easy to play with all this, and you can unlink linked copies or re-link unlinked copies.

Note that if you have a column that is based on a profile, then you clone that column, then you unclone it, the new independent copy resulting from the uncloning will still use the same profile as the original column. So they don't become 100% fully independent objects. But I believe this is the most logical result of such tool. We probably need another one to separate things further...

A typical use case for this tool is when you want a cloned column to have a different height from its original, but still be based on the same profile (be of the same family, in revitspeak)

Reextrude tool

This tool allows you to select a face of an object, and recreate the object as an extrusion (structure or wall) of the selected face. This is above all useful when you are dealing with a non-parametric object, such as a STEP file or even an IFC file that you imported in "Simple Part Shapes" or "Non-parametric Arch objects" mode, which are many levels of magnitude faster than the "Full Arch objects" mode.

So this allows you, for example, to import a large IFC model as non-parametric, and turn only the objects you wish to edit into extrusions. And it gives you finer control too over which face should be the base of extrusion. It also allows you to change the extrusion direction of an object. Or, imagine you made a slab by drawing a rectangle on the ground floor and extruding it vertically. But suddenly you realize you need to give a special profile to that slab. "Damn!", you think, "I wish I had drawn the profile of this slab instead, and extruded it horizontally". Now it's a piece of cake: Reextrude the slab, then edit its (new) profile.

If the face you selected has only straight edges, it gets reconstructed as a Draft Wire, which really turns the object fully editable. If there are curves or holes, it stays as a non-parametric face (for now...)

At the moment, there is no test yet to check if the face you selected can indeed produce the correct object when extruded. If you select a face of an object that is not a linear extrusion, it won't give correct results.

Convert tool

Before, if you clicked for example the wall tool with a structure selected, instead of creating a wall, the selected structure would be turned into a wall. This was a really annoying behaviour, you always needed to make sure everything was deselected when using an Arch/BIM tool.

Now that behaviour has been changed so pressing the wall (or any other Arch/BIM button) will always create a new object, regardless of what is selected (if a planar 2D object is selected, though, the behaviour continues the same: The BIM object uses it as a base).

So, in order to be able to perform the same operation as before (turn a structure into a wall, for example), this Convert tool has been added. Select an object, click Convert, and choose into which other object it must be turned.

However, since a couple of months now, all Arch/BIM objects are able to take any IFC type/role, such as wall, column, etc.. regardless of the FreeCAD type. So this tool is actually already unnecessary, I just added it to not remove any functionality without providing an alternative one.

Also, in an ongoing discussion on the FreeCAD forum (come and participate!), we are now playing with the idea of semantically separating the geometry creation tool (which basically performs an extrusion) from its BIM purpose (wall, column, beam...). I find the idea highly interesting. You would basically have a tool to extrude a linear object into a wall-like object with thickness, another that extrudes a profile along a path or direction (structures), a third one that produces "embeddable" objects (windows, doors..), etc. These tools would not be called Wall, Structure, Window anymore, but something like Linear Extrusion. Profile Extrusion. etc. You would give the type you want (Wall, Structure, Window..) to the result of any of those tools. This is much more like IFC works, and is actually something very annoying in other BIM apps, where you cannot make a wall the way you want, it needs to fit in what the wall tool can do.

There are still unresolved questions, such as the different properties/attributes (A wall should have a height, width, height, what happens if you suddenly turn it into a roof), but there is a very interesting pull request coming, which starts addressing this aspect, with a completely dynamic model, where the FreeCAD properties of Arch/BIM objects can change on the fly.

Of course, we are here speaking of the inner, "core" module (Arch, currently), not necessarily what the user would see. I believe that for user-friendliness, we still need a wall button, a column button, etc... That's exactly where the separation between a "core" module (Arch) and a more "user-friendly" module layered on top of it (BIM) becomes interesting.

References with shapes off

The Reference tool gained a new ability, which begins to turn it into something really interesting and flexible. Up to now, when you created a reference object, the shape of the object you were referencing would be stored into the host file too. This is the standard way of working of FreeCAD: Shapes are stored into the file, so when you open a file, parametric objects don't need to be recalculated, they just take the shape that was stored. Otherwise loading times would quickly explode.

Now, you have the option to drop the shape when turning the visibility of a reference object off. It provokes an additional loading time every time you turn it back on, but it drastically reduces the file size and initial file load time. And there is no limit anymore on the quantity and complexity of referenced models, as long as you don't turn them all on at the same time. That is, until we implement the next step, the ability to use a "lightweight" version instead of the full shape...

Clean trash

By right-clicking the BIM trash (that gets created when you use the "Send to trash" right-click command in the BIM workbench), you now have a new "Clean trash" option, which deletes all its objects that are not used anymore by any other. Objects that are still in use are not deleted. (You can do so simply by deleting the Trash, if you absolutely want)

Defaults: Turntable, thumbnails

When using the BIM Setup dialog, a couple more defaults are now set: File thumbnails are turned on, and the orbit mode of the FreeCAD 3D view is set to Turntable, which is how it works in all other BIM apps. Many people not used to other 3D modelling apps didn't realise the default Trackball mode could be changed...

Ungroup, select group contents

Two more options were added when right-clicking an element in the tree: Ungroup, if you right-click an object that is inside a group or Building Part, which will remove the object from its host, and Select group contents, if you right-click a group or Building Part.

Material manager context options

The new materials manager of the BIM workbench also gained some new tools. There are two new buttons to automatically merge duplicated materials (a same material name with 001, 002,... at the end), and to delete all unused materials.

By right-clicking any material in the list, you can now also rename it, duplicate it, delete it, merge it with another one.

IFC Preflight tool

I am not sure this is a very good name yet, it can change... This new tool allows to perform several tests on your model, for IFC compatibility, such as verifying some IFC requirements, or checking that the geometry of all your objects is valid, or checking specific things that might give problems in other BIM applications (specially the one-BIM-application-that-shouldn't-be-named...)

The idea of this tool is also to be very didactic, and give plenty of information about how things should be done properly when working with IFC.

Toolbars reorganization

I changed a bit the grouping of the toolbars and menus in the BIM workbench. It now works like this:

There are still visual inconsistencies there (icons that create objects should all be yellow, icons that modify existing objects should all be blue, etc) that we'll address on the way, but I think this is much more logical. Tell us what you think!

Base movement discussion

We have another interesting discussion about the behaviour of BIM objects based on another one, such as a 2D baseline or profile. As you know, both the base object and the BIM object have a Placement property. When you move the BIM object, the placement of the BIM object changes, but not the placement of the base object. This is logical, as other objects might use the same base, that would change too if the base was moved.

However, the effect of this is that the BIM object is not on top of its base object anymore. If you turn both on, they appear at different places.

Other workbenches, such as PartDesign, solve this by preventing you from moving the result object directly. You need to move the base sketch if you want to move the object that is built from it. I don't think that would be good to do that in BIM, though.

Ultimately, we're probably let the user choose, by adding a property that, if turned on, will in fact move the base object when you move the BIM object.

IFC diffing

I kept the best for the end. This is currently still developed in a macro, because it still needs some work and fine-tuning, but it already works well, feel free to give it a shot.

Diffing is a concept that is used a lot in programming, and is a very, very interesting feature when you work with version control systems (such as Git, which is what we use at FreeCAD).

Basically, when you change a file, it shows you in a very clear way what has been changed between two versions of the file: lines that have been added (in green), and lines that have been removed (in red). You can actually compare just about any two files that way, not only two versions of the same file.

With BIM, as with 2D CAD before, it is always very hard to know what changed in a file. Usually it requires the person who made the changes to mark them somehow (the traditional "revision cloud" that were added on drawings to tell "this has been changed since last version").

However, the IFC format introduces many tools to be able to assess more reliably what has changed and what not. The most fundamental one is a unique ID that is given to all objects in the file. Most BIM applications nowadays, when importing an IFC file, will store the ID of each object, and use it when exporting the file back to IFC. So we have a way to know with certainty, between two IFC files, which objects are the same, regardless of anything else that might have changed (geometry, properties, etc).

So now our job is simple: Take two BIM models. A same ID exists in both models? It's the same object. It exists in the newer model but not in the older one? It has been added since then. It doesn't exist anymore in the newer model? It has been deleted.

That's basically what the macro above does. It takes two FreeCAD models (you can just open two IFC files in it), and paints in red all the deleted objects, and in green all the newly added objects.

For all the others, that exist in both files, it does the following checks: Has the volume of the object changed? Has its bounding box dimensions or position changed? Has its center of gravity changed? If any of these is true, we can reasonably assume the geometry of the object has changed, and the object is painted in yellow.

If all these tests give no difference, we can reasonably assume the geometry of the object has not changed. It would be very hard to modify the geometry of an object and not have any of the above characteristics change.

The macro also checks for other things, but it doesn't paint the objects, since their geometry is still the same:

The object name

The material

The IFC properties

So at the end of the process, you have a clear view of what has changed between the two files, and, exactly like with code, you can choose the best strategy to adopt: Will you just take the new file and discard the old one? Or will you only copy over the new objects and change the modified ones by hand? Each case is usually a different case.

Like with version control systems, the macro is able to do a series of changes automatically to the old file, to reflect the state of the new file, for example update the materials, or rename the objects whose name has changed. Most complex changes, such as geometry changes, will still require you to decide what to do manually.

That's it for this month, hope you liked the new developments, and stay tuned for more!

Cheers

Yorik