Niels Horn's Blog

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

CAD Programs on Slackware – 4 – BRL-CAD

Introduction

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 SlackBuilds.org 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:
04_brlcad_mug_01

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

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

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:
04_brlcad_mug_02

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

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

Links

Bookmark and Share
 

CAD Programs on Slackware – 3 – FreeCAD

Introduction

The second CAD program I decided to test on Slackware was FreeCAD. As the name implies, this one is completely free, which interested me :)
The description on their homepage describes the idea and purpose of this program:

FreeCAD is a general purpose 3D CAD modeler. The development is completely Open Source (GPL & LGPL License). FreeCAD is aimed directly at mechanical engineering and product design but also fits in a wider range of uses around engineering, such as architecture or other engineering specialties.

FreeCAD features tools similar to Catia, SolidWorks or Solid Edge, and therefore also falls into the category of MCAD, PLM, CAx and CAE. It will be a feature based parametric modeler with a modular software architecture which makes it easy to provide additional functionality without modifying the core system.

Building on Slackware

Building FreeCAD on Slackware was quite a challenge. It needs several dependencies, and not all were readily available:

  • xerces-c was available on SlackBuilds (this one was easy)
  • Coin, Pivy and SoQt were only available in older versions for Slackware 12.2, so I had to update their SlackBuilds (already submitted and approved)
  • OpenCASCADE was not available at all, and was a challenge to build on Slackware by itself. It takes quite a few hours (and several gigabytes of space!) to build it even on a modern machine, so – if you prefer – get a pre-compiled package from the link at the end of this post

After building all the dependencies, it was time to build the actual FreeCAD package.
The biggest challenge was figuring out the correct “./configure” switches for it to find the needed libraries and include files, but after that it built without mentionable difficulties.
For those using “-current” versions (as opposed to the stable 13.0 versions) of Slackware, a patch to the acinclude.m4 file to use the newer boost libraries is needed.

My experience

A pleasant surprise was that FreeCAD starts with a splash screen with a “tip-of-the-day” and after that shows a page with links to where you can get more help:

03_FreeCAD_01_help
There is a wiki available of the homepage of FreeCAD, with some basic tutorials.

I tried a very basic design, combining a box and a cone and creating some fillets:

03_FreeCAD_02_sample

Then I downloaded a somewhat more complicated design from the OpenCASCADE gallery to see what it looks like in FreeCAD:

03_FreeCAD_02_carter

Positive points:

  • Completely Free, Open Source
  • Based on the very stable OpenCASCADE framework

Negative points:

  • Designed for 3D modeling, not so much for 2D designs
  • Still a work-in-progress. It simply does not have that “complete” feeling yet
  • Has quite a few dependencies to build or install it

Links

Bookmark and Share
 

CAD Programs on Slackware – 2 – VariCAD

Introduction
As I wrote in my previous post, looking for a CAD program that runs on Slackware, I decided to check out VariCAD. VariCAD is proprietary software (which means you have to buy it to use it), but they have a fully working Linux version. According to its homepage:

VariCAD is a 3D/2D CAD system for mechanical engineering. In addition to standard tools for 3D modeling and 2D drafting, the CAD system provides support for parameters and geometric constraints, tools for shells, pipelines, sheet metal unbending and crash tests, assembly support, libraries of standard mechanical parts (ANSI, DIN) and symbols, mechanical part calculations and tools for working with bills of materials (BOM) and title blocks. VariCAD supports STEP, STL, IGES, DWG and DXF file formats.

Especially the part about the several formats it supports interested me, so I wanted to get it working on Slackware.

Building on Slackware

VariCAD is not “open” software, so there is no compiling involved. It comes in either the RPM or DEB format as packages to be installed on Red Hat or Debian or look-alikes. There was no pre-built Slackware package, so I decided to write a small SlackBuild script to transform the RPM package into a Slackware package.
VariCAD offers both 32- & 64-bits versions so take care to download the correct file for your architecture. The downloaded version can be installed and used for 30 days. After this period – if you like the program and want to continue using it – you will have to buy a valid license. There is no need to reinstall the program and your designs will not be lost, you just will need to enter the license-key.

Creating the SlackBuild was quite straight-forward and I managed to submit it to SlackBuilds.org in just a couple of hours. It can be downloaded here.
Basically it unpacks the RPM, puts the documentation, desktop- and icon-file in the standard Slackware location. It also corrects the permissions on the directory where the license key will be stored, so that you do not need to run VariCAD (and X) as root to enable the program.

My experience

VariCAD comes with a complete tutorial which teaches all the basic steps to create a three-dimensional model, either starting with a two-dimensional drawing or directly in 3D-mode. The steps are easy to follow, even for someone not used to CAD programs (like me).

This is a screenshot from VariCAD in action:
02_VariCAD_Sample_01

From this example I created the 2D drawings:
02_VariCAD_Sample_02

And here is an image of a 3D model I created with VariCAD:
02_VariCAD_hn
Conclusion

Positive points:

  • Very complete, professional package
  • Both 2D & 3D drawing and modelling
  • Easy to follow, step-by-step tutorial
  • Simple to install using the SlackBuild and the RPM package

Negative points:

  • Not for free – needs a license after the 30-day trial period
  • I could not find a direct way to create an image file from the 2D drawing (printed to PDF and converted it with the GIMP)

Links

Bookmark and Share
 

CAD Programs on Slackware – 1

History

Many years ago (talking about the mid/late 80s) I worked at a company that used AutoCAD for 2D construction designing. This was done on Sun Graphical Workstations that were networked together using a Thick Ethernet coaxial cable and a Unix file and print server. I learned a lot about shell scripting, network configuration, lpr / lpd printing, access permissions, terminal configurations, etc.
I didn’t understand much of what the architects and engineers designed, as I was more interested in the technology behind it all. But I remember that the whole IT setup was expensive: software licensing, specialized hardware (off-the-shelf Intel boxes couldn’t do yet what Sun could at the time), highly skilled network administrators (I was only a junior at the time), etc.
After a while, I changed jobs and moved into the financial administration business, where I learned other skills, many of which I still use on a daily basis…

Recently I regained interest in CAD programs, as a relative asked me to take a look at two files he received at his company that he was unable to open. It turned out that they were created by specialized 3D modeling software that costs thousands of dollars and runs only on Windows (he uses Slackware, of course!).
For someone who needs to open a file like that maybe once or twice a year, it’s not a wise investment.

So I started looking around for cheaper (preferably free) software that could open these files and display them on Slackware. It turned out that the formats used for those files were closed and exclusive, but those commercial programs can save their files in some open standards, like STEP or IGES. So my quest for a working, cheap/free CAD system for Slackware had started!

2D vs. 3D

Back when I worked supporting AutoCAD, all that was done was 2D designing: buildings, floor plans, etc. There were “layers” in the designs, but nothing was visualized in 3D. Even the expensive Sun Workstations did not have the graphical capabilities needed for that. But things have changed and nowadays, even reasonably priced desktop systems – with a modern graphics card – can do impressive 3D modeling using the right software.
Some programs are specialized in 2D designing, others in 3D, some can do both very well.
To clarify the difference between 2D designing and 3D modeling, here is a simple example of both (both images were created with the trial version of VariCAD):

This image is a drawing of a simple piece in 2D

This image is a drawing of a simple piece in 2D


And this is the same piece modeled in 3D

And this is the same piece modeled in 3D

Selected programs

So I wanted a program than can match the following requirements:

  • Works or can be made to work on Slackware Linux
  • Is free or affordable (meaning not in the $thousands range)
  • Can read some of the open formats like STEP or IGES
  • Ideally does both 2D & 3D, but if it’s really good at one of the two, or is really cheap (or free), I’ll consider it as well

After some initial research, I decided to check out the following programs:

  1. VariCAD: Commercial software, but seems to be very complete (2D + 3D) and has a fully supported Linux version
  2. FreeCAD: Free, open source, 3D, can read IGES & STEP, but seems to be a work-in-progress
  3. BRLCAD: Free, open source, 3D, created by the US Army for designing tanks, can read IGES
  4. QCAD: Commercial (but less then $50,00) + limited free “community” edition, 2D only

My findings about each program will be published in future posts on this blog.
If I can get a program to work on Slackware, I’ll submit the SlackBuild script to SlackBuilds.org, so that it becomes available for everyone to try out.

Bookmark and Share
 

New LDraw / LeoCad Library packages for Slackware

partsVersion 2010-01 of the LDraw parts library was released recently, so I created a new easy-to-install Slackware package for it.
As always, shortly after this release, the LeoCad pieces library was also updated, to version 3506.

Both packages can be downloaded from my site.

Bookmark and Share
 

RRDtool 1.4.3 released

RRDtoolLast week RRDtool 1.4.3 was released. It solves several minor bugs in the previous 1.4.2 version and adds a few new options. See here for the updated change log.

I updated the SlackBuild script and submitted it to SlackBuilds.org. Pre-built packages for Slackware 32+64 bits and ARMedslack can be downloaded from the usual page.

Bookmark and Share
 

Zabbix 1.8.2 packages for Slackware

zabbixA new version for Zabbix – the open source enterprise monitoring solution – was released yesterday. This new version (1.8.2) solves some bugs in the previous version and introduces some new features and improvements. For the complete announcement, check this link.

I submitted the new SlackBuilds for the server and agent parts to SlackBuilds.org. Pre-built packages for the agent daemon for Slackware can be downloaded from my site, including a new package for ARMedslack.

Bookmark and Share
 

New(er) version of FBReader released

The guys that are developing FBReader are releasing so many updates that it is difficult to keep my SlackBuild and packages up-to-date! :)

ico_fbreaderOnly a few days ago I mentioned the new 0.12.7 version and they’re already at 0.12.9
The new version resolves some bugs and improves the Smashwords library support. The code is also compatible with the newest gcc compilers now.

As always, the updated SlackBuild is in the pending queue on SlackBuilds.org and the new packages for Slackware (32 & 64-bits) and ARMedslack can be downloaded from my site.

Bookmark and Share
 

Most downloaded files

I created several packages for Slackware that can be downloaded from my site. Of course, some are more popular than others. To have some idea what people actually download from my pages, I created a counter that increases whenever someone requests a file. These counters started on August 30th, 2009.
I planned to create a simple page to show something like a “Top 10″ or whatever, but never managed to do it. So today, out of curiosity, I took a look at the MySQL table containing the counters, and the result was:

  1. Hex-Ed – a small (~80k) Hex Editor for Windows
  2. Sudoku.xls – an Excel macro to solve puzzles
  3. bmp2xls.zip – a silly program to convert bitmaps to spreadsheets
  4. bal_local – a script to balance to internet connections
  5. slackware-1.01.tar.gz – the oldest Slackware version still around
  6. sls-1.03_x_series.tar.gz – the X series for Slackware or SLS
  7. Elevator.ldr – a Lego drawing of an elevator
  8. leocad-* – a drawing program for Lego
  9. Opleggertje – an Excel macro for a simple card game
  10. hercules-* – the mainframe emulator

It is interesting to see that the top three files are old Windows projects from a couple of years ago.
Hex-Ed was last updated in the beginning of 2007, but has been downloaded over a thousand times since august… My Slackware packages only get in the tens or hundreds of downloads :)

Bookmark and Share
 

New version of FBReader released

ico_fbreaderA new version of FBReader, an e-book reader with functions to download books from some popular sites, has been released.
Version 0.12.7 is mainly a bug-fix release, but it also add some extra support for ePub files.

The new SlackBuild script is in the pending queue on SlackBuilds.org and pre-built packages for Slackware 32-bits, 64-bits and ARMedslack can be downloaded from my site.

Bookmark and Share