FreeCAD BIM development news - January 2022

a screenshot of FreeCAD showing a mosaic of projects

Hi all,

Happy new year! Time for a new report on what's going on with BIM development in FreeCAD.

As a good new year resolution I made with Alexandre and Kurt, we decided we should try to blog more. I'd really like to return to posting once a month, like I managed before the pandemic. So let's start already!

As always, a big thank you to everybody who has been supporting me on Patreon, Liberapay or GitHub! I'm sorry to not have shown so much exciting stuff last year, also because the more I take on administrative work to do for FreeCAD, the less I code, but it's all part of the same effort to make FreeCAD better, more stable, more powerful, more integrated, more usable. Things are going well, every part of FreeCAD is bettering, and, as we have seen several times in the past, when one area or workbench receives less new features for a while, a lot of bug fixing and stability improvement happens. I think that's really what happened last year.

So, here we go for fresh news:

Better axis support in Techdraw and DXF

a screenshot of FreeCAD showing section marks rendered in the 3D view and on a TechDraw page

The Axis object, since a couple of months now, can be used to make section marks. This is now supported by both TechDraw and DXF export, so we now have a good easy solution, and we are again in a state where 100% of Draft/Arch output is supported in DXF files or on TechDraw pages.

Like I explained in the last report, I am more and more using what I called a BIM-Draft-TechDraw workflow when working with BIM models in FreeCAD. That is, you don't generate directly your TechDraw views from the 3D model, you first create Draft views, then place these views on a TechDraw page. This is similar to what you do in Revit, where you have an intermediary step where you place dimensions, annotations,... on your views.

Well, this is basically the same in FreeCAD, except that, at the moment, your intermediary 2D view lives in the same space as your 3D model. I'm still experimenting with how to best attack that.

At the moment we still need to place our section marks manually on the Draft views, which is now easy to do with axes, but now that the object exists and is supported well everywhere, we should soon be able to do something more automatic.

Allow to use QCAD to import/export DWG

a screenshot of FreeCAD showing the DWG preferences screen

The DWG importer/exporter of FreeCAD is a simple hack. It basically imports/exports to DXF first, which is an open and documented file format, and converts the result to/from DWG, using an external conversion utility.

So far, we have been relying on a free (but unfortunately not open-source) multiplatform application named ODA converter, which for the time being works well but, being not open-source, we never know if or when they will change the terms or discontinue offering the application.

Another option that has been added since many months in FreeCAD 0.19 is the use of LibreDWG. If the LibreDWG utility programs (dxf2dwg, dwg2dxf) were located on your system, FreeCAD would use them automatically.

Although LibreDWG is a great and commendable effort, reading a complex, undocumented, proprietary format like DWG is a herculean task. Therefore, the support to the DWG format offered by LibreDWG is partial, depending on your files some content might not be rendered properly. There are also other problems, such as the license which is incompatible with FreeCAD (so we cannot include it in the FreeCAD code), but enough has already been written about that...

If you are only exporting DWG files from FreeCAD, though, and not importing, LibreDWG works very well, as all the DXF entities produced by FreeCAD are supported.

But we now have a third option too,, which is QCAD. The DWG preferences page has also been upgraded so you can specify yourself which converter utility to use

I like QCAD a lot. It is a very good open-source 2D CAD application, it has excellent multiplatform support and is very well polished. I recommend it to everybody who needs to do only 2D work.

QCAD is an open-source application, but also has a paid, professional edition. The professional edition is the same as the open-source one, with a couple of plug-ins aimed at professionals, and it includes DWG support (the open-source version does only DXF).

If you have QCAD pro installed, you can now use it to perform the DXF/DWG conversion in FreeCAD. I would say this is the best of both worlds, as it has the same level of quality as ODA, but the same ease of use as LibreDWG, plus, you'd be supporting an open-source project by using it.

I would warmly recommend, if you need DWG support, to buy a copy of QCAD pro. The price is very, very honest, and it's the main revenue system of QCAD's author. I've been following the project for years and he is a fervent defender of the open-source model (even after QCAD got forked into LibreCAD), this is the way he managed to keep both sides running, and I really like this solution.

Draft texts are now used when using the C++ (new) DXF importer

The newer, faster (oh, SO MUCH faster) C++-based DXF importer is really fast (specially if you set it to join objects by layer in the preferences). Only annoying thing, up to now it was creating old-style App Annotations from texts, which didn't tap into the more powerful and easier Draft Text. This is now changed, so when using the new importer (which is set by default, unless you marked the "use legacy (python) importer" option in DXF preferences), you will now get much better text rendering.

On our way to proper BIM views

a screenshot of FreeCAD showing the new capture box around a Building Part

The Arch BuildingPart object has been extended so it can now also be used as a container for Draft views. Just place all the 2D elements belonging to a view (projections of 3D models, dimensions, texts, hatches, symbols, linework...) in a same BuildingPart, create a TechDraw Arch view using that BuildingPart, and you're done.

To ease the whole process of adding 2D elements to Building Parts, the Building Part object has gained a new feature, that I called autogroup. This consists of 4 new properties, under the View tab: Box (to turn auto-grouping on/off), Size (to specify the size of the capture box), AutoSize (to calculate the size automatically based on the contents) and Margin (to add a margin when auto-sizing).

When auto-grouping is active, a capture box is displayed in the 3D view, around the BuildingPart contents. Any new Draft or Arch object created withing the limits of the capture box are added automatically to that BuildingPart.

So we can now spread our 2D projections around a document, organise everything neatly, and start drawing. Everything will fall neatly and magically where it belongs.

Is this useful? I am not sure yet, let's see if people start using it. But this is all part of small upgrades that make the whole "3D-model-to-2D-documentation" process faster.

Fixed level display unit

a screenshot of FreeCAD showing levels with correct arch units

A small insignificant update, but BuildingParts, when used as levels, will now display levels correctly when their unit if set to "arch", the same way we do with Dimensions.

Flip wall direction

a screenshot of FreeCAD showing the new option in right-click menu of walls

Another pretty small update, but something I struggle with all the time. Walls now have a right-click menu entry to flip their direction between left and right (this, obviously, has no effect if the wall Align property is set to "Center").

A new documentation system (Work in progress)

a screenshot showing the FreeCAD wiki and a markdown version side by side

There is quite some time I'm working on this, and I think it's mature enough for you folks to have a peek, so here goes the whole story:

Although there is a pretty good online documentation, the current help system in FreeCAD is cumbersome: It is incomplete, untranslated, badly formatted, and doesn't export well to other formats such as PDF or EPub. For us developers, it's equally annoying: It uses the not very friendly Qt Help system, which is based on a very simplified version of HTML, and we need to have a big, fat 300Mb blob file in the FreeCAD source code, which is a bad compilation of the most useful pages of the wiki. This compilation is done by a semi-automatic script which doesn't translate the wiki pages very well.

Plus, the MediaWiki software that we use for the FreeCAD wiki is increasingly hard to maintain and back up, and some of the plugins we use (to manage translations, for example), are always in danger of not working anymore.

We need a better system, which shows directly the contents of the wiki to the FreeCAD user, allows them to choose between an online, offline or a translated version, reduces our dependence on additional software, renders and integrates nicely both in the FreeCAD interface and in different formats such as PDF or Epub, is versionable so we can tag a certain state of the documentation to a specific FreeCAD version, and ideally integrates with translation platforms like we use already for the FreeCAD interface.

We use more and more markdown everywhere in FreeCAD. For MediaWiki users, using Markdown is a very, very small step, as the two languages are extremely similar, it translates and renders amazingly well to all kinds of formats, it is easily versionable, and most online hosting platforms such as github or gitlab offer a pretty comfortable editing interface, as good as the MediaWiki one.

But we don't want to migrate arbitrarily at once. We would loose many of the long-time contributors of the wiki, and the translation platforms out there (crowdin, transifex,...) still have a pretty bad support of Markdown. The world is not ready

So I designed a system in two parts:

  1. A script that translates the entire FreeCAD wiki to markdown pages. The script can also keep this version up to date, so it can be run for as long as we need to, while the wiki is still in use. When we are ready, we would just stop using the script and start editing the markdown version directly. That script is also able to do more advanced things such as rebuilding API documentation directly from the FreeCAD source code. There is more work needed here, mostly to classify and better group the Markdown files into subdirectories, but the base is there. Each translation is a complete copy of the original, english version, which is well suited for translation platforms, and can also be extended much, for example by providing automatic translation for the missing parts.

  2. A FreeCAD module designed to replace the whole FreeCAD Help system: The Help menu and the "What's this?" button. It has a preferences page (found under menu Edit -> Preferences -> General -> Help), which allows to choose where you want to get the documentation from : online version (the new markdown version or the wiki itself), offline version (a copy or clone of the markdown repository, basically a folder containing markdown files), or a translated version (by just giving the correct path to the translated version), and how you want it displayed: In your desktop browser, in a FreeCAD tab, or in a standalone (but dockable) dialog window.

a screenshot of FreeCAD showing the documentation presented in different ways

The advantages are many: Everything is now file-based, so it does not rely on any software anymore, it can be managed with Git, so the backup problem is also solved (there are many, many up-to-date copies, same as the FreeCAD source code), a certain state of the documentation can be tagged and linked to a certain FreeCAD version, documentation updates that are not yet available in stable versions can be done in branches, the whole content can be used on translation engines, and is easily to render and style as nice, beautiful HTML, PDF , EPub and basically anything else.

It is easy to test, if you are interested: Just download or clone the module in your FreeCAD Mod directory, restart FreeCAD, and optionally set the preferences. Then, you show a specific help page with this command in the Python console:

import Help"Draft Line")"Part Extrude")

Later on we can tie this into the FreeCAD Help system so it all uses the Help module, and finally ditch the older blob-based system.

For now, my course of action is to try to have most people to look at this and test, and get convinced