FreeCAD 2D import

I made recently a couple of improvements to the Draft module of FreeCAD to ease the dwg import -> rework -> svg export workflow. This came after soem frustration with DraftSight, which doesn't print linewidths correctly when you are using layers to define linewidths, instead of old-fashioned colors and ctb files.

In FreeCAD, on the other hand, we now have quite precise control over that, and dxf/dwg import is becoming quite reliable. If - this is very important - your drawing is clean and well made (no overlapping lines, few layers, as many polylines as possible), there is almost no work needed in FreeCAD to render quite nice drawings. Basically, everything depends on the quality of your drawing. Bad drawing, bad performance in FreeCAD.

The following example is a sample of a plan I've been doing of an existing building, drawn in DraftSight:

That drawing has less than 10 layers, and all the walls (white lines) are polylines. To quickly make polylines in draftsight (and autocad), and close them where possible, isolate your layer, enter pe (Polyedit), m (multiple), select everything, enter, then j (join).

If you have the Teigha File Converter installed on your machine, you can now configure the path to its executable in the Draft preferences, and have FreeCAD import DWG files directly (it will internally convert them to DXF then import them with the standard dxf importer). If you did what I explained (clean, organized drawing), the import is fast and efficient (no error):

You have several options in the Draft preferences (this is the default). I added a new option to create Draft clones from dxf blocks, which reduces the filesize of the resulting FcStd file to almost the same as the input dxf file, and facilitates handling, because all clones use the same base shape. The base shape itself (the block definition) is there, but hidden.

Since imported objects are grouped by layer, although FreeCAD groups have no controls like autocad layers, it is easy to select all the contents of a group (right-clicking on them, in the Draft module, there is an option to select the contents), and change properties such as linewidth or draw style (hidden, dashdot, etc):

I also modified the Draft-to-Drawing tool so you can now use it on groups. So selecting the 6 groups in this drawing and pressing the Draft Drawing tool immediately places everything on a sheet, but creates only 6 view objects in the Drawing page, which makes it very easy to place them properly on the page, and set things like linewidth:

Since I made sure walls were closed polylines, they are imported as filled objects (faces). If you leave them in "Flat lines" display mode, these faces can be colored or hatched:

There is a new system to show hatching directly in the 3D view, but it is still buggy. On the Drawing page, on the other hand, it already works pretty well. It doesn't appear in the Drawing viewer (a limitation Qt), but if you press the "view in browser" button, the page is opened in the FreeCAD browser, which is based on webkit, which is among the best svg viewers available. There, the rendering is just perfect:

From there, all we need to do is export the page to a svg file, open it in inkscape to make a pdf file. FreeCAD also has a print dialog to print a pdf from the Drawing page, but it uses your system's pdf printer. Inkscape, however, is really the state of the art in that matter, and makes 100% perfect pdf prints.

Obviously you will stil find glitches, bugs and problems here and there, FreeCAD is still in early development after all, but we are slowly arriving to some usable-in-production state. Even using FreeCAD as a 2D CAD application like Autocad or Draftsight is not - and probably will never be - the focus, that doesn't mean that doing 2D with it will be bad or impossible. My aim is - like, i hope, most architects - to free myself of 2D drafting, as much as possible, but at the same time I know we'll still need to live with 2D for a long time, and maybe if we can reduce that 2D work to something minimal, then it can fit perfectly within FreeCAD's possibilities...

I also did some work on the Arch module, other post to come soon...