One common scientific task is designing new hardware to help make measurements. A powerful tool to help with this design work is a Computer Aided Design system, or CAD software. Several tools are available on Linux for doing CAD work. In this article, I take a look at LibreCAD (http://www.librecad.org).
LibreCAD started as an extension of QCad. For a short while, it was called CADuntu, before finally being named LibreCAD. It should be available as a
package in most distributions.
In Debian-based distributions, you can install it with the command:
sudo apt-get install librecad
And, you always can install it from source if you want the latest and greatest features.
Once LibreCAD is installed, you can launch it from the application launcher for your desktop, or you can run the librecad command
Figure 1. When you start LibreCAD the first time, you need to set some initial options.
[
UPFRONT
]WWW.LINUXJOURNAL.COM / NOVEMBER 2014 / 25
from a terminal. The first time you start LibreCAD, you will be greeted with a welcome window (Figure 1).
Here, you will be presented with the ability to set options for the default unit, the GUI language and the command language. Once you set those options, you will see a blank canvas where you can start your new project (Figure 2). The main window is the actual drawing canvas where you can set up your design. On the left-hand side, you should see a palette of drawing tools. On the right-hand side,
you will see two smaller windows containing the layer list and the block list for your design.
If you already have done some design work, you can import that work into LibreCAD. You can insert an image to your design by clicking the menu item FileAImportAInsert Image.
LibreCAD can handle most common file formats. If you had been working with another CAD program and have a DXF file of that work, you can
import it by clicking on the menu item FileAImportABlock (Figure 3). This option also handles CXF files, in case
Figure 2. LibreCAD starts up with a blank canvas, ready for your new project.
26 / NOVEMBER 2014 / WWW.LINUXJOURNAL.COM
[
UPFRONT
]you were using those.
You may have a text file with raw point data for the object you are trying to draw. If so, you can click on the menu item FileAImportARead ascii points. This will pop up an option window where you can define what the points represent and how to treat them. You even can import GIS data from a shape file with the menu item FileAImportAshape file.
Now you should be ready to start designing your project. Clicking the icons in the palette on the left-hand side opens a new palette with
Figure 3. You can import DXF files from lots of places.
Figure 4. You can set options for new layers added to your project.
[
UPFRONT
]WWW.LINUXJOURNAL.COM / NOVEMBER 2014 / 27
multiple options for each of the categories. For example, if you click on the circle icon, you will see a new palette giving you the option to draw circles with either two points on the circumference, a point at the center and one at the circumference or a circle that fits within a triangle, among many other options.
The other icons in the drawing palette also provide tools for
drawing many other components, such as lines, arcs and splines. All of these items are drawn on the
default layer that you get with a new project. You can add a new layer by clicking the plus icon in the top pane on the right-hand side. This will pop up a new option window where you can set things like the layer name and the drawing color for the new layer (Figure 4).
Figure 5. You can set several options when you add a multi-line text object.
28 / NOVEMBER 2014 / WWW.LINUXJOURNAL.COM
[
UPFRONT
]You can toggle visibility of the various layers by clicking the eye icon to the right in the layer list.
When you have a layer set the way you want it, you can make it uneditable by clicking on the lock icon for that layer. That way, you won’t accidentally change it while you work on other layers.
If you need to add labels explaining parts of your design, you can click on the multi-line text option in the tool palette. This will
pop up a window where you can enter the text and set options like font and color (Figure 5).
Once you have the basic objects drawn on your project, you can use the many modification tools available to fine-tune your drawing or to generate more complex
objects based on some modification of one of the basic types. These modifications are available under the Modify menu item. You can do things like scaling, mirroring,
Figure 6. You can set several options for scaling an element of your drawing.
WWW.LINUXJOURNAL.COM / NOVEMBER 2014 / 29
[
UPFRONT
]rotating and moving.
Using these tools, however, isn’t very intuitive. Say you want to scale an element of your drawing. The first thing you will want to do is to click on the ModifyAScale menu item. You next will notice that the command-line box at the bottom of the window has changed, asking you to “Select to scale”. You then need to click on the element you want to scale, say a line element, and press the Enter key. The command-line window then will change to saying
“Specify reference point”. LibreCAD scales based on a reference point to
act as a point of perspective, so go ahead and click on a point. This will pop up an option window where you can set things like the scaling factor and whether it is isotropic (Figure 6).
When you click OK, LibreCAD will apply the modification and refresh the drawing.
You also can change the properties of the different elements, which may be needed to clarify parts of special interest. To do this, you need to click on the ModifyAProperties menu
item, and then click on the element in question. This will pop up a dialog box where you can edit properties that
Figure 7. You can change both the display properties of your circle as well as the physical properties.
[
UPFRONT
]apply for that element type (Figure 7).
When you have finished your
design, you will want to share it with others. The default file format is the Drawing Exchange Format (.dxf).
LibreCAD supports versions 2007, 2004, 2000, R14 and R12. If you need to, you also can save it as an LFF Font file (.lff), a QCad file (.cxf) or a Jww Drawing file (.jww). If you just want a simplified output, you can click on the FileAExport menu item and save it in one of a large number of image file formats. With these options, you should be able to share your design
with most people.
Hopefully, this article has shown you enough to help you decide whether LibreCAD might be a good fit for your next design project. If so, you can find even more information on the LibreCAD Wiki and forum. A great deal of examples are available on the Internet that will show you just what is possible with a good CAD system. And, because these examples are available in DXF files, you can load them in LibreCAD and play with the possibilities.
—JOEY BERNARD