Getting started with 2D CAD drafting

From Wiki.OSArch
Revision as of 00:05, 17 January 2022 by Duncan (talk | contribs)

Computer Aided Drafting (CAD) in 2D is an important part of many design workflows, some would say legacy workflows. It is a digital extensions of hand made technical drawings.

The problem

The field of 2D CAD within the AEC industry is currently dominated by AutoCAD, and in particular, the proprietary DWG file format. Heavy reliance on AutoCAD, along with the tight control that parent company Autodesk exerts over the proprietary DWG file format, both stifles innovation and perpetuates proprietary software in our industry. In contrast open formats support users freedom.

To make the switch away from proprietary software and file formats, there are two key ways in which you can make a difference in the industry. The first is by requesting and producing the open DXF format instead of the proprietary DWG format. The second is by switching from AutoCAD to another software entirely.

Switch from DWG to DXF

Drawing Exchange Format (DXF) is an open format that provides many similar features to Drawing (DWG). In general, DXF is much more widely supported and has much better cross-platform support. It is extremely easy to switch. Almost all CAD software has the ability to read and write DXF, so it is simply a manner of making it a habit to use one instead of the other. It is also usually a good idea to specify DXF as a digital deliverable in contracts. Most BIM projects currently specify IFC as an OpenBIM format, but neglect to also specify DXF as an open format.

If a DWG file is provided, and it is not possible to ask for the provider to provide a DXF instead, you have a few options. The first is to open the DWG with QCAD or LibreCAD, and then convert it to a DXF yourself. Of the two, QCAD's support for DWG far surpasses LibreCAD, but unfortunately relies on Open Design Alliance (ODA).

FreeCAD 0.19 linux version (appimage) can import DWG files based on LibreDWG library, and eventually export with this format too. To install this library on Windows version see this FreeCAD documentation.

Another CAD program using the LibreDWG library is SolveSpace. It can import DWG files up to some extend (even saved as AutoCAD 2013) and export them as DXF (2007), PDF or SVG.

If it is not possible to submit DXFs for a project, for example if a client specifically request only DWGs and you are unable to convince them otherwise (though there may be little technical reason for them to do so), QCAD may be used to save DWGs. LibreCAD is unable to create DWGs, at the moment.

If you have a lot to convert, or if the conversion is unsatisfactory, or if you use neither LibreCAD or QCAD (such as if you are using Blender or programmatically generating DXFs), as a fallback option you may use the proprietary ODA File Converter, or the proprietary ODA Online Converter. Although this is proprietary software, it is mentioned on the OSArch wiki because the Open Design Alliance (ODA) has debatably helped improve access the open data standards in the AEC industry due to their work in reverse engineering the DWG file format, and the ODA library is also used in QCAD under the hood, and it is cross-platform.

A comparison table is provided to help people learn the difference between the two formats. See also the more general File format comparison

Feature DWG DXF
The majority of basic drafting, including lines, text, dimensions, hatching, colours, and layers Supported Supported
Easy to use cross-platform and across all CAD tools Not supported. DWG is inconvenient to use with free software as well as cross-platform. Users are usually required to use proprietary software to use DWG. Supported
Storage in ASCII for open data parsing Not supported Supported
Storage in binary for efficient file sizes Supported Supported (Note: A common misconception is that DXF is only ASCII. DXF actually has an ASCII and a Binary variant)
3D lines and points, common in survey drawings Supported Supported (Note: A common misconception is that DXF does not support 3D. This is not true)

Converting from PDF to DXF

In many cases, 2D drafting sheets can be found under PDF format. For these cases you can convert these files to DXF files, suitable for further edition with CAD software. Inkscape 1.0 has options to open and save both PDF and DXF files. To work as converter, Inkscape can open a PDF file and with the function "Save a copy" you will have the option of Save as type: Desktop Cutting Plotter (AutoCAD DXF R12 and R14) format. It is important to notice that the original PDF must be a vector drawing (no bitmap). Also, Inkscape 1.0 can open files with AutoCAD DXF R13 extension. Note: R14 support splines (curves), but R12 only support straight lines. It is recommended to check this post for more information.

As an option you can use Scribus to open a PDF file to be exported as SVG file. Then you can open the SVG file to save it as DXF format with Inkscape. On the other hand, you can follow this tutorial using Inkscape and pstoedit.

Switching to free/libre software

While there are very advanced free/libre 3D geometry applications, there are very few 2D applications.

  • QCAD Community Edition is the most feature rich libre/free software for 2D CAD. It is multi platform and supports a typical 2D CAD workflow.
  • QCAD Professional is the paid version of QCAD with a few more functions. Buy QCADE professional supports the development of QCAD Community Edition.
  • LibreCAD is a free/libre 2D CAD software. It is a fork from QCAD v2 and has seen gradual development.
  • FreeCAD has three workbenches useful for 2D drafting, Sketcher, Draft & Techdraw. TechDraw is the most advanced and sees most development.
  • SolveSpace can import DWG files up to some extend (even saved as AutoCAD 2013). It has some basic 2D drawing tools to do some edition. Finally it can export the files as DXF (2007), PDF or SVG.
  • ZCAD is a small 2D CAD program that can open DXF files and has a few edition tools. You can save as DXF, PDF ad SVG. ZCAD is in beta development.
  • LX-Viewer (Linux Drawing Viewer) is a program that will allow you to open, view, print DXF files. But it cannot edit files.
  • Inkscape & Krita have been used by some for drafting. You can use Inkscape as PDF/DXF converter, for editing drawings and presentation improvement. And then, export a final PDF/DXF file.
  • Libre Office Draw can open DXF files version 2004 or earlier, but it cannot make complex editions. It exports PDF/SVG format (no DXF/DWG support).
  • CadZinho is a very new 2D CAD project.

See also