CAD Programs on Slackware – 4 – BRL-CAD | Niels Horn's Blog

Niels Horn's Blog

Random thoughts, tips & tricks about Slackware-Linux, Lego and Star Wars

CAD Programs on Slackware – 4 – BRL-CAD


BRL-CAD is an open-source solid modeling program originally created by the US Army Ballistic Research Laboratory, that later became the Army Research Laboratory. One of the original creators was Mike Muuss, who also invented the program that has probably been installed on more computers than anything else: the ‘ping’ utility. (Do check the source code for ping.c and you’ll find his name there as the author in December, 1983…)

BRL-CAD is described on its homepage like this:

BRL-CAD is a powerful cross-platform Open Source combinatorial Constructive Solid Geometry (CSG) solid modeling system that includes interactive 3D solid geometry editing, high-performance ray-tracing support for rendering and geometric analysis, network-distributed framebuffer support, image and signal-processing tools, path-tracing and photon mapping support for realistic image synthesis, a system performance analysis benchmark suite, an embedded scripting interface, and libraries for robust high-performance geometric representation and analysis.

As the description says, it includes a ray-tracing module to create good-looking images of your designs.

Building on Slackware

I found a SlackBuild script for BRL-CAD for Slackware 12.2 on but I had to change a few things to get it working.

First of all, the base directory (’<prefix>’) had to be changed to /opt/brlcad, as /usr caused some conflicts with existing libraries and man-pages. This was simple enough.
I also needed to write two patches: one to build it on 13.0, as it stumbled on a bug in gcc 4.3.3, and another to get it working on -current, because of the new libpng library that introduces some incompatibilities. This is the fun part of writing SlackBuilds :)

In the end, I included a .desktop file to include BRL-CAD in the menu, and two small scripts in /etc/profile.d/ to include the directory with the BRL-CAD binaries in the PATH variable.
The resulting SlackBuild script has been submitted and is currently awaiting approval.

My experience

BRL-CAD includes a “Geometry Editor” called ‘mged’ that is command-line based, and a GUI interface called ‘archer’. The latter is still under heavy development and did not work for me, neither on the stable Salckware 13.0, nor on -current. The svn repository has a modified version, but I wanted to stick to a stable release for now. Maybe the next version will work better.
But all documentation and tutorials are based on mged, so I was fine with this for now.

mged opens two windows: the “Command Window” and the “Graphics Window”.
The first tutorial shows how to create a simple mug in a few commands:

opendb mug.g
title MGED Tutorial Geometry
units in
in outside.s rcc 0 0 0 0 0 3.5 1.75
in inside.s rcc 0 0 0.25 0 0 3.5 1.5
in ring.s eto 0 2.5 1.75 1 0 0 1.45 .6 0 0 0.2
comb cup.c u outside.s - inside.s
comb handle.c u ring.s - outside.s
r mug.r u cup.c u handle.c
ae 35 25

Basically, what we do here is:

  1. Create a new geometry database file called “mug.g”
  2. Set the title
  3. Set the units to inches
  4. Create an “outside” and “inside” cylinder section
  5. Create a elliptical torus (”eto”) section called ring.s
  6. Create the combination called cup.c subtracting the inside cylinder from the outside
  7. Create the combination called handle.c subtracting the outside section from the ring section
  8. Create the region called mug.r as a union of the cup and the handle
  9. Show the result from an angle of 35 / 25 degrees

The result should be:

Now let’s do our first ray-tracing, with a few extra commands:

mater mug.r plastic 32 128 32 0
draw mug.r

These commands:

  1. Set the material of our mug to “plastic”, colored green (RGB 32 / 128 / 32)
  2. Zero the graphics window
  3. Redraw the mug
  4. Ray-Trace it

And this should be the result:

As an example of the possibilities, here is a slightly more complex model:
Or something more impressive:

These examples really only touch the surface of the possibilities that BRL-CAD has to offer. This CAD & modeling program has been in continuous development for over twenty years, and has a lot to offer – and completely for free.

Positive points:

  • A very solid and stable program, after more than 20 years of development
  • Includes ray-tracing module
  • Very complete documentation (reference cards, man-pages, tutorials, HTML), with several parts translated into Spanish

Negative points:

  • “Different”, command-line based interface, might not be for everyone


Bookmark and Share

This entry was posted on Sunday, May 9th, 2010 at 20:41 and is filed under CAD, Slackware. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “CAD Programs on Slackware – 4 – BRL-CAD”

  1. Sean Says:

    Thanks for the fantastic write up on BRL-CAD! It was a nicely succinct introduction with a focus on the more salient points.

  2. Niels Horn Says:

    You’re welcome! :)
    I’m still “discovering” the program, going through the tutorials, and it really impresses me.

  3. Wally Gerassimoff Says:

    What changes did you make to the brlcad.SlackBuild? It goes virtually to the end but exit on this:

    /bin/sh ../../libtool –silent –mode=link gcc -pedantic -W -Wall -Werror -Wno-long-long -O2 -march=i486 -mtune=i686 -pipe -fno-strict-aliasing -fno-common -fexceptions -ggdb3 -D_FORTIFY_SOURCE=2 -w -L/usr/local/lib -pipe -fno-strict-aliasing -fno-common -fexceptions -ggdb3 -D_FORTIFY_SOURCE=2 -w -o argv.lo avs.lo backtrace.lo badmagic.lo basename.lo bitv.lo bomb.lo brlcad_path.lo cmd.lo cmdhist.lo cmdhist_obj.lo color.lo convert.lo crashreport.lo dirent.lo dirname.lo endian.lo fchmod.lo fgets.lo fnmatch.lo fopen_uniq.lo getopt.lo globals.lo hash.lo hist.lo hook.lo htond.lo htonf.lo image.lo interrupt.lo ispar.lo kill.lo lex.lo linebuf.lo list.lo log.lo magic.lo malloc.lo mappedfile.lo mread.lo mro.lo observer.lo parallel.lo parse.lo printb.lo process.lo ptbl.lo quote.lo rb_create.lo rb_delete.lo rb_diag.lo rb_extreme.lo rb_free.lo rb_insert.lo rb_order_stats.lo rb_rotate.lo rb_search.lo rb_walk.lo semaphore.lo simd.lo stat.lo str.lo tcl.lo temp.lo units.lo vers.lo vfont.lo vlb.lo vls.lo whereis.lo which.lo xdr.lo
    /bin/sh ../../libtool –silent –mode=link gcc -pedantic -W -Wall -Werror -Wno-long-long -O2 -march=i486 -mtune=i686 -pipe -fno-strict-aliasing -fno-common -fexceptions -ggdb3 -D_FORTIFY_SOURCE=2 -w -L/usr/local/lib -pipe -fno-strict-aliasing -fno-common -fexceptions -ggdb3 -D_FORTIFY_SOURCE=2 -w -o -rpath /opt/brlcad/lib -version-info 19:1 -no-undefined -ltcl8.5 -lpng -lm -lc -lpthread
    gcc -DHAVE_CONFIG_H -I. -I. -I../../include -DPREFIX=\”/opt/brlcad\” -I/usr/local/include -DBRLCADBUILD=1 -I../../include -I../../src/other/openNURBS -pedantic -W -Wall -Werror -Wno-long-long -O2 -march=i486 -mtune=i686 -pipe -fno-strict-aliasing -fno-common -fexceptions -ggdb3 -D_FORTIFY_SOURCE=2 -w -c `test -f ‘htester.c’ || echo ‘./’`htester.c
    /bin/sh ../../libtool –silent –mode=link gcc -pedantic -W -Wall -Werror -Wno-long-long -O2 -march=i486 -mtune=i686 -pipe -fno-strict-aliasing -fno-common -fexceptions -ggdb3 -D_FORTIFY_SOURCE=2 -w -L/usr/local/lib -pipe -fno-strict-aliasing -fno-common -fexceptions -ggdb3 -D_FORTIFY_SOURCE=2 -w -o htester htester.o -ltcl8.5 -lpng -lm -lc -lpthread
    /usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../i486-slackware-linux/bin/ld: cannot find -lz
    collect2: ld returned 1 exit status
    make[2]: *** [htester] Error 1
    make[2]: Leaving directory `/tmp/SBo/brlcad-7.16.10/src/libbu’
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/tmp/SBo/brlcad-7.16.10/src’
    make: *** [all-recursive] Error 1

  4. Niels Horn Says:

    Are you building this on Slackware 13.1 or -current?

    On 13.1 it should work without a problem…

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

It may take some time for your comment to appear, it is not necessary to submit it again.