LEGO CAD on Linux

Installing and using LDGLite

This page explains how you can get started viewing building instructions for LEGO models coded in the LDraw format. Visit ldraw.org for general information on LDraw and related programs.

The LDraw Parts Library

First we download and install the LDraw parts library:

user$ cd /tmp
user$ wget http://hugin.ldraw.org/LEGO/Byggevejledninger/Linux/ldraw-library.tar.gz
...
user$ su
Password:
root$ cd /usr/local/share/
root$ tar xzvpf /tmp/ldraw-library.tar.gz
...
root$ exit
exit
user$

Mesa

The next step is to install Mesa (if you haven't installed it yet):

user$ cd /tmp
user$ wget http://download.sourceforge.net/mesa3d/MesaLib-3.4.tar.bz2
...
user$ bunzip2 MesaLib-3.4.tar.bz2
user$ tar xf MesaLib-3.4.tar
user$ wget http://download.sourceforge.net/mesa3d/MesaDemos-3.4.tar.bz2
...
user$ bunzip2 MesaDemos-3.4.tar.bz2
user$ tar xf MesaDemos-3.4.tar
user$ cd Mesa-3.4
user$ ./configure
...
user$ make
...
user$ su
Password:
root$ make install
...
root$ exit
exit
user$ cd ..
user$ rm -rf Mesa-3.4

LDGLite

And at last you should install LDGLite:

user$ cd /tmp
user$ wget http://www.geocities.com/dheyse/ldglitesrc0_7_3.zip
...
user$ unzip -uoa ldglitesrc0_7_3.zip
...
user$ cd ldglite
user$ make -f makefile.linux
...
user$ su
Password:
root$ chown root.root l3glite ldglite readme.txt
root$ mv l3glite ldglite /usr/local/bin
root$ mv readme.txt /usr/local/share/ldraw/ldglite.readme
root$ exit
exit
user$ cd ..
user$ rm -rf ldglite

Now you should be ready to run ldglite, but since the LDraw library has been placed differently from what LDGLite expects, you have to set the environment variable LDRAWDIR to that directory (/usr/local/share/ldraw). You can do that in your runtime configuration scripts, just before you run ldglite, or you can create a script that sets LDRAWDIR and then calls ldglite. I have chosen the last of these three solutions:

user$ su
Password:
root$ cat > /usr/local/bin/ldglite-run << THE-END
? #!/bin/tcsh
? setenv LDRAWDIR /usr/local/share/ldraw
? /usr/local/bin/ldglite \$*
? THE-END
root$ chmod a+x /usr/local/bin/ldglite-run
root$ exit
exit
user$

Testing

You could use Tux for a test run, either by hooking LDGLite into Netscape or by downloading the model file and running ldglite-run with it as a command line argument.

In Netscape, you choose the menu Edit -> Preferences, open the category Navigator -> Applications, and click on the New... button. Fill out the form that pops up as the image below and click OK.

Description: Multi-part LDraw file -- MIMEType: application/x-multi-part-ldraw -- Application: /usr/local/bin/ldglite-run -v3 %s

Click on the New... button one more time, and fill the form out again, but this time with the description LDraw file and the MIME type application/x-ldraw. After clicking OK in the Preferences window, Netscape should show a LEGO Tux when you click on tux.mpd.

If you download tux.mpd, then ldglite-run tux.mpd should run LDGLite and show the building instructions for a LEGO Tux.

Play well.

Colophon

Written by:
Jacob Sparre Andersen <jacob@sparre-andersen.dk>
Latest update:
December 29th 2000