
This collection of “virtual” pieces is used by programs as LDView, ldglite and l3p.
The leocad program uses its own “pieces” library, but is usually updated right after the LDraw parts library.
I updated the scripts for both packages and submitted the results to SlackBuilds.org, where they are waiting for approval.
In the mean time, you can get the script or the pre-built packages from my site.

The 0.75.2 release mainly resolves some bugs and crashes, but it needs the newer pieces library to work, so do update both packages!
I already submitted the new SlackBuild scripts and the pre-built packages can be downloaded from my site.
]]> http://underpop.online.fr/n/nielshorn/2011/06/slackware-packages-for-leocad/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/07/new-slackware-packages-for-lego-data-files-and-program/ http://underpop.online.fr/n/nielshorn/2010/07/new-slackware-packages-for-lego-data-files-and-program/#comments Sat, 17 Jul 2010 17:09:07 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=487 New pieces librariesLDraw.org released its second update for 2010 of the pieces library this month. As always, a short time afterwards the updated pieces library for LeoCAD was also released.
New LeoCAD version
A new version of LeoCAD (0.75.1) was also released, fixing the Minifig wizard that was broken in the previous Linux versions. With it, you can easily create minifigs using all possible combinations of arms, tools, etc. and insert the result in your model.
Here are some examples of what you can do with it:
Darth Vader
And after using l3p and povray to create a nice image:
Han Solo
And with some basic ray-tracing:
Downloading
The SlackBuilds have been submitted and are in the pending queue at SlackBuilds.org.
Pre-built packages can be found on my site…

As always, shortly after this release, the LeoCad pieces library was also updated, to version 3506.
Both packages can be downloaded from my site.
]]> http://underpop.online.fr/n/nielshorn/2010/04/new-ldraw-leocad-library-packages-for-slackware/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldglite/ http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldglite/#comments Wed, 27 Jan 2010 20:06:52 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=146 Another package has been updated, this time for ldglite version 1.2.4It’s a simple version update that corrects some small bugs.
As always, packages can be downloaded from my site while the SlackBuild is in the pending queue.
The updated Slackware package (~ 14MB) can be downloaded from my site.
]]> http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-leocad_pieces/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldraw_data/ http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldraw_data/#comments Fri, 15 Jan 2010 23:45:28 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=130 I built a new package with LDraw_data for Slackware, containing the latest (200903) library from ldraw.org. Check my site for the pre-built while the SlackBuild is in pending. ]]> http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldraw_data/feed/ 0 http://underpop.online.fr/n/nielshorn/2009/12/lgeo-slackware-package-available/ http://underpop.online.fr/n/nielshorn/2009/12/lgeo-slackware-package-available/#comments Thu, 31 Dec 2009 14:19:00 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/blog/?p=68 After some requests, I created a Slackware package with the lgeo parts library. It can be downloaded from my site.If you prefer, you can download the library from the author’s website and use the SlackBuild to create your own package.
]]> http://underpop.online.fr/n/nielshorn/2009/12/lgeo-slackware-package-available/feed/ 0 http://underpop.online.fr/n/nielshorn/2009/12/updated-ldraw_data-package-available/ http://underpop.online.fr/n/nielshorn/2009/12/updated-ldraw_data-package-available/#comments Fri, 25 Dec 2009 14:40:00 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/blog/?p=67 I created an updated package with the LDRAW Library of Lego pieces that includes all parts up to September, 16th, 2009.The “unix-complete” file from ldraw.org has not been updated for years, so this package was based on the Windows file “complete.zip” but can be used without any problems under Slackware.
As always, the package can be downloaded from my site.
]]> http://underpop.online.fr/n/nielshorn/2009/12/updated-ldraw_data-package-available/feed/ 0 http://underpop.online.fr/n/nielshorn/2009/12/lego-pov-ray-on-linux/ http://underpop.online.fr/n/nielshorn/2009/12/lego-pov-ray-on-linux/#comments Thu, 24 Dec 2009 18:58:00 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/blog/?p=66 Some time ago I promised to give some basic instructions on how to create nice images of Lego constructions with POV-Ray on Linux. Now that Christmas is arriving, I finally found some time to convert my own instructions into something that can almost be called a “tutorial”
What will you need:
- LeoCAD – to “build” your constrution
- (optional) a viewer program, like LDView or ldglite
- l3p – to convert the .ldr (LDRaw) file to .pov (POV-Ray)
- (optional) The “lgeo” parts collection
- POV-Ray – the “Ray-Tracer program”
If you use Slackware, you can find packages for all of these on my site and SlackBuilds for all except 3 on www.slackbuilds.org. For many other Linux distributions packages are available in their repositories.
First step – Build something!
If you do not have any LDraw file yet with a Lego creation, then now is the time to make one.
As an example for this tutorial, I built a little penguin, based on the instructions here, with LeoCAD:
Save your creation with LeoCAD as a “.ldr” file (”File” – “Save as” from the menu). The resulting file in my case was:
0 Model exported from LeoCAD 0 Original name: Penguin.lcd 1 14 -50.00 -0.00 -60.00 -0.00 0.00 1.00 -0.00 1.00 -0.00 -1.00 -0.00 -0.00 3002.DAT 1 15 -50.00 -24.00 -60.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT 1 15 -50.00 -48.00 -60.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT 1 0 -50.00 -24.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT 1 0 -70.00 -48.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT 1 0 -30.00 -48.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT 1 0 -50.00 -72.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT 1 14 -50.00 -72.00 -70.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3003.DAT 1 0 -50.00 -96.00 -50.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3003.DAT 0
The file can be downloaded from my site as well.
Second step – View your model with ldglite or LDView
This step can be skipped, but it is a nice test to check if the programs can find all the LDRAW parts on your computer. LeoCAD uses its own parts library, so being able to view it there does not necessarily mean that the LDRAW library is accessible.
This is how the penguin looks like in ldglite, a simple but very fast program to visualize your creations:
A second option is to use LDView, a very nice and very complete program to visualize your creations. It creates a more realistic view of the model, with some shading effects:
Third step – Ray-Tracing
So the images created by LDView are nice. But we want something even better! Enter POV-Ray, a very professional Ray-Tracing program that is completely free.
It “traces” light-rays, by tracing paths of “light particles” from one or more light sources, bouncing off surfaces and reflecting into the lens of a camera.
So we define the position and colors of the light sources, the position and angle of the camera, the types of surfaces (smooth, reflective, rough, etc.), etc.
Sounds complicated? Well, there is a very nice utility called l3p that tries to do most if it automatically to help us get started. l3p reads an “ldr” file, guesses the best position and angle for the camera so that the whole creation will fit in the image, and sets up three light sources around the model. Then it creates a .pov file that can be read by POV-Ray.
l3p needs to know where the LDRAW library is stored on your computer. This can be set by the LDRAWDIR environment variable like:
$ export LDRAWDIR=/usr/share/LDRAW
Put this in your start-up script like ~/.bash_profile (if you use bash for a shell).
Enough theory, let’s create our first .pov file:
$ l3p -o Penguin.ldr
This reads the “Penguin.ldr” file we created and writes a “Penguin.pov” file in the current directory.
I used just one option – “-o” – which instructs l3p to overwrite Penguin.pov if it already exists, since we’ll perform various tests before we get the final result.
Now let’s run POV-Ray to transform the .pov file into an image:
$ povray +OPenguin.png +FN +P Penguin.pov
The options here mean:
- +OPenguin.png – Output will be Penguin.png
- +FN – Format will be a PNG file
- +P – Pause after creating the image, showing the result on the screen
The result should look like this:
For a first test, it’s just about “OK”… But we can do better than this!
Since in most tests we’ll run l3p and povray as a sequence, we’ll put both commands on one line like this:
$ l3p <options> && povray <options>
The “&&” means that the next command is only executed if the previous terminated without error.
So let’s try:
$ l3p -b -o Penguin.ldr && povray +OPenguin.png +FN +W640 +H480 +P Penguin.pov
What did we add:
- -b – add a standard blue background to replace the black void
- +W640 – Create the image with a width of 640 pixels instead of the standard 320
- +H480 – and a height of 480 pixels instead of 240
The result should look like this:
Let’s improve the image a bit more:
$ l3p -b -q4 -bu -o Penguin.ldr && povray +OPenguin.png +FN +W640 +H480 +A +P Penguin.pov
The new options are:
- -q4 – Quality level 4, this includes the “Lego” name on the studs
- -bu – Create “bumps”, this makes the surfaces more “uneven”, or more realistic
- +A – Anti-aliasing, this prevents those “jagged edges”
This should be the result:
Advanced options
As I wrote in the beginning, l3p automatically guesses the best position and angle for the camera and light sources. But we can change them as we please.
Let’s try something:
$ l3p -b -q4 -bu -cg40,45 -cpct10 -f -o Penguin.ldr && povray +OPenguin.png +FN +W640 +H480 +A +P Penguin.pov
I included two new options:
- -cg40,45 – Put the camera at “globe” positions 40° latitude and 45° longitude (the default is 30,45 so we put it a bit “higher”)
- -cpct10 – move the camera back 10%, so that the object is not so close to the edges of the image
- -f – put a “floor” under the penguin instead of letting it float in the sky, so that we can see the shadows of the light sources
Here is the result:
You can play around with the position of the light sources using the “-lg” option. I’ll leave this as an exercise!
There are many more advanced options to try. Type “l3p” without any options to see the complete list! If you have a good tip, feel free to post a comment so that I can learn something new.
Using the lgeo library
The images we created with the standard l3p + povray combination look quite good, but when we enlarge the images, the pieces look a bit unrealistic, with edges that are too sharp, etc.
Enter the “lgeo” library of pieces…
The lgeo pieces are specially designed for use with POV-Ray, with more realistic edges, surfaces, etc. l3p can automatically replace all LDRAW pieces with lgeo pieces if a substitute is available (any many are available, at least for the more “standard” pieces).
We just need to include the “-lgeo” parameter (and have the lgeo library installed and “readable” by povray – this needs some configuration…).
This created a nice image of our Penguin at a larger size:
$ l3p -b -q4 -bu -cg40,45 -cpct10 -f -lgeo -o Penguin.ldr && povray +OPenguin.png +FN +W1280 +H960 +A +P Penguin.pov
And this is the result (click on the image to see the full-scale picture):
As you can see, the studs and the edges look more realistic in this picture.
Have fun!
]]> http://underpop.online.fr/n/nielshorn/2009/12/lego-pov-ray-on-linux/feed/ 2