LDraw FAQ

0) About this FAQ

The questions and answers in this FAQ is mainly summaries of communication in the discussion group lugnet.cad.dev.

0a) Table of contents

0b) Locations of the FAQ

The LDraw FAQ will be posted to the discussion groups rec.toys.lego, lugnet.cad, and lugnet.cad.dev.

The FAQ can be downloaded/read at these URL's:

0c) Useful addresses

FAQ editor:
Jacob Sparre Andersen (jacob@ldraw.org)
Expert:
James Jessiman (July 25th, 1997, James passed away)

1) What is this LDraw thing?

LDraw is a DOS program that allows you to draw LEGO models, create building instructions for them, etc. - A LEGO-style Computer Aided Design system.

The current edition can generate a sequence of .bmp files (MS-Windows bitmaps), one for each step in a building instruction, from a LDraw .dat file.

You can edit LDraw files with the accompanying LEdit program or with your favourite text editor (the latter is said to be very hard, but I do it anyway. - Jacob).

It's free!

2) Where can I get a copy of LDraw?

You can download LDraw directly from James' Web site at <URL:http://www.ldraw.org/jessiman/ldraw/>, but I suggest that you go through the James Jessiman Memorial (<URL:http://www.ldraw.org/community/memorial/archive/official>) where you can get new collections of parts as well. You can also download LDraw from Bram Lambrecht's LDraw and LEdit tutorial.

3) Can I get the source code?

No!

But you can get the source code for LDLite (a Win32 replacement) at <URL:http://www.gyugyi.com/l3g0/ldlite/>.

4) What platforms does the program work on?

MS-DOS. Including DOS in OS/2, Win-95 and Win-NT.

There's no Mac and Unix versions.

But there is one in progress (see section 3).

5) Where can I find examples?

These documents contains LDraw'n models. Either as data files for LDraw or as processed images:

L3P Gallery (includes ray-traces):
<URL:http://home16.inet.tele.dk/hassing/l3pgal.html>
Jacob's LEGO building instructions:
<URL:http://jacob.sparre.dk/LEGO/Byggevejledninger/>
Space ship Black 'n' White:
<URL:http://www.ldraw.org/jessiman/lego/models/jsa/BLKWHT.HTML>
Various models:
<URL:http://lego.bldesign.org/>
RC Car and 4x4 with differentials:
<URL:http://www.nd.edu/%7Elego/grp2/www/4x4instr.htm>

6) Who made it?

James Jessiman. James passed away July 25th, 1997.

We are trying to continue James' work in the discussion group lugnet.cad.dev (see section 9). Many people are working on modelling more parts, and Paul Guygyi has written a LDraw clone for MS-Windows.

7) What does LEGO (the company) think of it?

According to Wouter Kooijman LEGO is very positive and supports the program.

8) Where can I ask questions about LDraw?

If you can't find the answer here, please ask on the discussion groups lugnet.cad or lugnet.cad.dev, and write a section for the FAQ based on the response.

9) Mailing list?!? What mailing list?

Until recently technical discussions regarding LDraw (and other LEGO related CAD packages) were located on the "LEGO-style Computer Aided Design" mailing list. This mailing list has been superceded by the discussion group lugnet.cad.dev. You can access the discussion group in three ways:

10) Other LEGO CAD programs

SimLego (see <URL:http://home2.swipnet.se/%7Ew-20413/simlego.htm>)
For making building instructions.
Development stopped 1997.06.23. The author, Tore Eriksson, said that "SimLego will never come close to LDraw".
Visio
Huw Millington has a parts library for this.
Paulo Caparica Junior's LDraw to DXF Converter (see <URL:http://www.geocities.com/Eureka/Gold/3269/>)
ld2vr (see <URL:http://perso.wanadoo.fr/paris.jean-pierre/LD2VR/>)
A LDraw to VRML compiler.
Matthew D. Bates' Track Designer (see <URL:http://ourworld.compuserve.com/homepages/train_depot/td.htm>)
A track lay-out program for MS-Win.

11) How can I convert a LDraw .dat file to a .bmp file?

If you want to convert the LDraw .dat file MY_MODEL.DAT to a sequence of .bmp files;

  1. Go to the catalog where the LDRAW.EXE file resides.
  2. Execute the command LDraw -MS MY_MODEL.DAT at the DOS command line.

You will find a sequence of .bmp files named MY_MOD01.BMP, MY_MOD02.BMP ... in the subdirectory BITMAP.

12) Can I use models as if they were pieces?

Yes. The .dat files just have to be stored in the MODELS subdirectory. You refer to them by the file name (no path specification), just as with the pieces (whose .dat files are found in the PARTS subdirectory).

13) How can I insert comments in the .dat files?

In LEdit:

  1. Insert a new piece.
  2. Pick /Edit Line-Type Comment
  3. Type in your comment.
  4. The piece line will change to a comment line.

In a text editor: Start the line with a zero.

14) How can I get the pieces to line up?

I'll list various peoples suggestions.
Jacob

Jeremy H. Sproat suggests:

I start with the 3-D view, then go to two of the "normal" views to line the puppy up. If I'm putting a piece in among a bunch of others and my view is obstructed, it helps to turn on the "Stop at cursor" option.

If I'm putting in a piece that needs to go at an odd angle, and there is already another piece at the same angle, I load the .dat file into a text editor and copy and paste the line of the first piece. I then load it into LEdit and move it around.
Sproat

Bram Lambrecht suggests:

I check a couple of different views to check sometimes. I usually use James' method: hit down, so that all but the studs are visible. If the fit is correct, bring the piece up the correct number of moves.
Bram Lambrecht

15) How can I turn a hinge from one step in the instructions to the next?

  1. Draw the model up to the step before where the piece changes.
  2. Add the step commands to the .dat file, including the last one.
  3. Add a '0 CLEAR' command at the end of the file.
  4. Copy everything before the last step command to after the clear command, so that you have the model repeated.
  5. Remove the step commands from the latter half of the file.
  6. Change the orientation of the hinge in the latter half of the file.

If you use LEdit, you will have to exit it, to do step 3 to 4/5 in a text editor.

16) What's the most recent edition of the LDraw package?

You can find links to the package itself, and to the L-CAD parts collections at <URL:http://www.ldraw.org/library/updates/>. The last collection of new parts is from December 1999.

There is a tutorial for LDraw and LEdit at <URL:http://www.thinkquest.org/library/lib/site_sum_outside.html?tname=205>.

External units:

Tore Eriksson's LDraw Launcher (see <URL:http://home2.swipnet.se/%7Ew-20413/ldlaunch.htm>)
Jacob Sparre Andersen's Fractal landscape generator for DOS, OS/2, and AIX (see <URL:http://jacob.sparre.dk/meyer/LEGO/V%E6rkt%F8j/#landskaber>):
9th of May 1997.
Jacob Sparre Andersen's file joiner and splitter for DOS, OS/2, Linux, and AIX (see <URL:http://jacob.sparre.dk/meyer/LEGO/V%E6rkt%F8j/#MPD.Files>):
20th of June 1997.
Program for creating Bezier curves for LDraw: (see <URL:http://www.math.uio.no/~fredrigl/technic/ldraw-mode/bezier-curve/>):
Tore Eriksson's bitmap to LDraw converter (see <URL:http://home2.swipnet.se/%7Ew-20413/bmp2dat.htm>):
June 14th 1997
Lutz Uhlmann's LDraw to POV-Ray converter (see <URL:http://www.el-lutzo.de/lego/files.html>):
January 5th 1999
Lars C. Hassing's LDraw to POV-Ray converter (see <URL:http://home16.inet.tele.dk/hassing/l3p.html>):
January 3rd 1999
Tore Eriksson's LDraw vector drawing program (see <URL:http://home2.swipnet.se/%7Ew-20413/ldd.htm>)
July 15th 1997.

You should always remember to have a look at the overview of LDraw resources at the James Jessiman Memorial (see <URL:http://www.ldraw.org/community/memorial/archive/ldraw>).

17) What does the numbers that follow the "-a" parameter mean?

The first three numbers determine the position along the screen X axis. The first one is how much the model X axis affects the position. The next one is how much the model Y axis affects the position and the last one is how much the model Z axis affects the position.

So:

Screen X = Model X * First number +
           Model Y * Second number + 
           Model Z * Third number

The next three numbers are for the screen Y axis and finally the last three are for the screen Z axis. I.e.:

Screen Y = Model X * Fourth number +
           Model Y * Fifth number +
           Model Z * Sixth number

Screen Z = Model X * Seventh number +
           Model Y * Eighth number +
           Model Z * Ninth number

The screen Z axis is not really drawn. It is only used to determine which piece is visible and which piece isn't.

The screen X axis goes to the right, the Y axis goes down, and the Z axis goes away from you (into the screen).

18) Why don't the -MS and -MP options draw the last step of my model?

You have to insert a step command at the end of the .DAT file. [This problem should have been solved in the present version of LDraw/LEdit.]

19) What do I do when LEdit crashes?

Stop editing your .DAT files in Notepad! Or at least, stop making mistakes when you do edit them. [Says Steve]

19a) - when you try to get the on-screen parts list

Run MAKELIST to regenerate the file PARTS.LST. [This problem should have been solved in the present version of LDraw/LEdit.]

19b) - with the message "Graphics error: Invalid device driver file (EGAVGA.BGI)"

There are two possible reasons for this. Either

  1. you have copied another version of the file "EGAVGA.BGI" on top of the one delivered in the LDraw package,
    or
  2. you run LEdit in/from a catalog where you keep another version of "EGAVGA.BGI" than the one delivered in the LDraw package.

In the first case, you will have to reinstall all of LDraw (run the installation programs with the option -y to speed up the process). In the latter case, you should try to run LEdit from the catalog LDraw and LEdit are installed in.

20) What is the .DAT file format?

.DAT files are text (yes, you can edit them in EDIT or Notepad or your favourite text editor). Each line is a single command, and each line is independent. The commands are (mostly) very simple, there are only a few different commands. Specific commands are identified by the first number on the line, which is called the line-type. The contents and format of the rest of the line depend on the line-type. I do not know of any length-limit on command lines.

Line types

Each line in the .DAT file is a single command. The first number on each line is the line type, valid values are 0 through 5, with the following meanings:

0:
comment or meta-command
1:
Part-file reference
2:
Line
3:
Triangle
4:
Quadrilateral
5:
Draws a line between the first two points, if the last two points are on the same side of that line.

If the line type for a line is not a valid value, the line is ignored.

Meta-commands require a keyword to follow the line-type. These keywords must be in all-caps, and you should assume that if the meta-command doesn't require more information, you shouldn't give it any additional information.

Commands

Here is a complete (as far as I know) list of LDraw drawing- and meta-commands:

And here are the details of each command. Meta-commands are listed first, with the "real" commands after. The command-names are wholly made up by me, I don't have any "official" names for these things.

Model Title.
The descriptive name of the model- or part-file.
Line format:
0 title-text
where title-text is whatever you want to name your model.
This is a meta-command, sort of. If the first line in a .DAT file has line-type 0, the remainder of that line will be considered the title for the file (at least for parts files). This overrides any meta-commands on the line.
Step meta-command.
Marks the end of a building step.
Line format:
0 STEP
This command will cause LDraw to stop until you press <enter>, and it will cause LDraw to save the current image into a bitmap file in the ldraw\bitmap directory. These two effects are controlled by the -M command line option (see ldraw.doc for info on -M).
Write meta-command.
Displays a message at the top of the screen.
Line format:
0 WRITE message-text
or:
0 PRINT message-text
where message-text is whatever you want displayed on the screen.
The displayed message is not saved in the image-bitmap files.
Clear meta-command.
Clears the screen.
Line format:
0 CLEAR
Useful for advanced model files. Don't forget to redraw all the parts you just erased by using this command.
Pause meta-command.
Causes LDraw to stop until you press <enter>.
Line format:
0 PAUSE
This is like the Step command, but it does not save bitmaps, and it is not affected by the -M command line option.
Save meta-command.
Causes LDraw to save the current image in a bitmap.
Line format:
0 SAVE
This is also like the Step command, but it does not cause LDraw to pause, and it is not affected by the -M command line option.
Part command.
Inserts a part defined in another .DAT file.
Line format:
1 colour x y z a b c d e f g h i part.dat
where
Parts may located in the p\, parts\, or models\ subdirectories (under the ldraw\ directory). They may also be located in the current directory. James has arranged the directories so that p\ contains elements that are intended to be used as part of elements (such as stud.dat). The parts\ directory contains finished parts, ready to be used in construction models. And the models\ directory contains construction models.
Part files can also include Part commands. There don't seem to be a specific limit to how deep these references can go.
Line command.
Draws a line between two points.
Line format:
2 colour x1 y1 z1 x2 y2 z2
where
Triangle command.
Draws a filled triangle between three points.
Line format:
3 colour x1 y1 z1 x2 y2 z2 x3 y3 z3
where
Quadrilateral command.
Draws a four-sided, filled shape between four points.
Line format:
4 colour x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4
where
Optional-Line command.
Draws a line between the first two points, if the projections of the last two points onto the screen are on the same side of an imaginary line through the projections of the first two points onto the screen.
Line format:
5 colour x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4
where Here is an example using the optional line command. If we try to approximate a (cylindrical) stud with a hexagonal prism we have something like this:
             1___________2
            /             \
           /               \
         6/                 \3
         |\                 /|
         | \               / |
         |  \5___________4/  |
          \  |           |  /
           \ |           | /
            \|___________|/
resulting in the following drawing:
             1___________2
            /             \
           /               \
         6/                 \3
         |\                 /|
         | \               / |
         |  \5___________4/  |
          \                 /
           \               /
            \_____________/

Colours

Colours are outlined in LEDIT.DOC. Two special values are 16 and 24. 16 is the 'current colour', i.e., whatever colour was specified on the type 1 line which caused the current line to be executed. Colour 24 is a complementary colour to the current colour, usually the bright/dark complementary shade. So if the current colour is dark blue, colour 24 would give bright blue.

Also, colours 256 through 511 are dithered. So if you want to combine colours J and K, figure your colour value as

colour = (J * 16) + K + 256

The complementary colour of J is used as the complementary colour of the dithered value. So you can control the edge colour (somewhat) by switching J and K.

Line type 1's format is:

Line Format:
1 colour x y z a b c d e f g h i part.dat

Fields a through i are orientation & scaling parameters, which can be used in 'standard' 3D transformation matrices. Fields x, y and z also fit into this matrix:

    | a d g 0 |
    | b e h 0 |
    | c f i 0 |
    | x y z 1 |

so that every point (x, y ,z) gets transformed to (x', y', z') :

    x' = a*x + b*y + c*z + x
    y' = d*x + e*y + f*z + y
    z' = g*x + h*y + i*z + z

or, in matrix-math style:

                                    | a d g 0 |
    | X' Y' Z' 1 | = | X Y Z 1 | x  | b e h 0 |
                                    | c f i 0 |
                                    | x y z 1 |

21) How can I make ray-traced images of LDraw models?

There are two tools for converting LDraw models to the format of the ray-tracer POV-Ray. L2p is based on Lutz Uhlmann's very detailed parts library, LGEO. It is available for DOS and Linux. L3p is based on the LDraw parts library. Only available for DOS.

Lutz Uhlmann's LGEO tutorial

Lutz Uhlmann's LGEO tutorial can be found at <URL:http://www.el-lutzo.de/lego/tutorial.html>.

Jacob's quick recipe for making ray-traced images of LDraw models

  1. Convert your LDraw .DAT files to POV-Ray .INC files with L2P:
    > l2p -i -v -t -l my_model.dat my_model
    
    It is important that you process sub-models as well, because L2P simply converts a reference to a .DAT sub-model to a reference to a .INC sub-model.
  2. Make a copy of the scene file Lutz has included in the package (l2p_test.pov):
    > copy l2p_test.pov my_model.pov
    
  3. Edit the fourth line in your new scene file (the one that says: #include "l2p_test.inc"). It should refer to the .INC file for your model instead:
    #include "lg_color.inc"
    #include "lg_defs.inc"
    
    #include "my_model.inc"
    
  4. Run POV-Ray with the new scene file. This is how I do it in Linux. There are probably some minor differences when you do it in DOS:
    > povray +L/usr/lib/povray/include/ +Llgeo/ +Imy_model.pov
    
    The first +L refers to the POV-Ray libraries, the second +L refers to the LGEO library, and the +I refers to the scene file.

Bram's additions for Win95 users

In the windows version instead of writing a long command line, you need to go to Edit Rendering Settings and add the command line options (+L).

22) How does one map a bitmap onto a LDraw object?

Use BMP2LDRAW, BMP2DAT or Tore's LDraw vector drawing program (see the answer to question 16) to create a .DAT file with just the image.

Copy the DAT file for the part you are going to add the bitmap to from the Parts catalog to the Models catalog, and give it a new name.

Insert the bitmap as a part in the new DAT file. Translate and rotate the bitmap part as appropriate. B

23) How can I get a clear brick in LDraw?

Colour 47 (clear white) works pretty good.

See section 27 for more information on colours.

24) How can I create a part that is not yet in LDraw?

First check if somebody else are working on the part. You can do that on the parts tracker (see <URL:http://home.swipnet.se/~w-20413/ttracker/ttracker.htm>). Steve Bliss, Jaco van der Molen, and Tore Eriksson present different approaches to creating parts, and Manfred Moolhuysen has some detailed advice for using the predefined subparts (without studying math). But first of all, you should check out which primitives are available (at <URL: http://www.ldraw.org/community/memorial/archive/FAQ/Primitives_Reference>).

When you have finished the part, you should check it for technical mistakes with l3p -check, and then send it to parts@ldraw.org so it can be included in the L-CAD parts distribution.

Steve Bliss writes:

Hmm. "Directions for making parts". Hmm. I can't think of directions, so much as advice. I don't really see how there could be a 1-2-3 cookbook approach. But here are some thoughts:

When you model a part, you need to think in terms of vertices, edges and surfaces. Your part-file has to provide one or more commands for each edge and surface. You need to specify these edges and surfaces by the XYZ position of their vertices. So you have to measure out where the vertices are. The trick with lego parts is that they are (typically) built around the familiar sizes of studs and plates (and bricks). So you often measure parts by comparing them to other parts (like simple bricks and plates).

The typical way to start drawing a part is to examine the .DAT file for a similar part. At least, that's the way *I* do it. ;-) Doing an LEDIT xxxx.DAT will let you step through each line in the part-file, so you can see what the effects are. And how other people have built their parts.

Here are some suggestions on what you should check out as you get started:

  1. Study the LDraw language section of the LDraw FAQ. Become very familiar with the formats, and what they do.
  2. Expertise with computer graphics methods is very helpful. You should at least be comfortable with the concepts of rotating, translating, and scaling, even if you aren't comfortable with the theory behind them.
  3. Forget about LEdit, except as a sometimes buggy way of stepping through the part-files you create. Notepad will be your friend for creating new parts. I also use Excel, LDraw Add-On's Inliner, and the little Torus Generator I wrote. If you find another tool that is helpful for parts-modelling, I'd like to know!
  4. Learn what's in the ldraw\p\ directory. This directory contains a number of subpart files that are useful in different parts. STUD.DAT is used in almost every LDraw part in existence (and most of the others use STUD2.DAT). The other files are useful "synthetic primitives", such as rings, discs, cylinders, and spheres. Some of them are LEGO-specific, such as PEGHOLE.DAT, and some are very general, such as 1-4DISC.DAT (BTW, the '1-4' means 1/4).

What kind of instructions/information would you like to see? I'd be happy to answer questions (and I'm sure others would as well), but I don't have time to write up a big list of instructions right now. Tips I can provide, but I hate throwing off a bunch on context-free information which may or may not be relevant.

Tip #1: The LDraw standard for positioning is to center the piece on X=0 and Z=0. Usually, the top of the part (excluding studs) is set to Y=0.

Tip #2: Look for repeated elements in a part, which you can write up as a sub-part file. I find long lists of LDraw commands to be very confusing. Using subparts can shorten the file, and make things more comprehensible. In writing my chain-saw blade, my final version used 10 custom files. I used the inliner utility to combine all these files before publishing.

Tip #3: Use the 0 command-line to insert as many comments as you want. You can always remove them before publishing, if you don't want everyone to see your notes. This can really help to organise long files, making it easier to go back and fix sections later.

Tip #4: Notepad is not very good. Wordpad is better. You may have another editor you like even more.

I can't think of anything else right now. Ask lots of questions.

Steve

Jaco van der Molen writes:

  1. I made a drawing on paper of the basic points and started mapping these coordinates.
  2. Next I used Excel (yes, MS Excel) to define the coordinates of all other points and combined these into lines and faces.
  3. To finish the job, I used Editpad to remove the tabs and replace them by spaces and there I had it!

Sjaacko

Tore Eriksson writes:

While making a part, I often use different colours so that I can easily see what areas are still to be covered, if a polygon came out right, and which one didn't.

You can find an example at <URL:http://www.ldraw.org/community/memorial/archive/FAQ/25a.gif>.

When everything is done, it's easy to set all to colour 16 or 24.

Tore

Manfred Moolhuysen writes:

Examining the existing part file of a basic lego brick also helps you to understand how part files are made.

Most of them use subparts, handy primitive shapes like cylinders, circles, disks, and the studs that are on top of or inside the bricks. You find all the available subparts in the subdirectory P.

The line:

   1 16 0 8 0 -6 0 0 0 -12 0 0 0 6 4-4cyli.dat

means you are including a full cylinder wall, a tube with both ends open. The other #-#cyli.dat subparts are useful if you want just a part of a cylinder wall, say 3-4cyli.dat for a 270 degrees cylinder part.

The numbers 0 8 0 tells LDraw to place the cylinder base centred at the point (X = 0, Y = 8, Z = 0), just like the placing of normal parts.

The 9 numbers following represent combined information about the dimensions of the cylinder and its orientation in space. In mathematics it is called a transformation matrix, but luckily for us we can tackle this in a "you don't have to know math" way.

To put it simply:

In this example the cylinder radius is 6 units (= diameter 12). the two numbers 6 are responsible for that. If those two numbers were not equal the result would have been a "squeezed" pipe with an oval cross-section. The 12 says the cylinder is 12 units high or long.

I have worked out a simple way to deal with the orientation of subparts, without getting my mind in a numerical twist:

You see, no math at all. It also works for all the other subpart types.

Some examples and detailed instructions:

Create this file, in the LDRAW\MODELS directory:

0
1 16 0 0 0 6 0 0 0 12 0 0 0 6 4-4CYLI.DAT
0

and name it TEST.DAT. View it in LDRAW and see the result.

now change the file in:

0
1 16 0 0 0 6 0 0 0 24 0 0 0 6 4-4CYLI.DAT
0

View the result in LDRAW again. You will see the cylinder is twice as long
now.

now change the file in:

0
1 16 0 0 0 12 0 0 0 24 0 0 0 12 4-4CYLI.DAT
0

View the result in LDRAW again. You will see the cylinder is twice as wide
now.

now change the file in:

0
1 16 50 24 20 12 0 0 0 24 0 0 0 12 4-4CYLI.DAT
0

View the result in LDRAW again. You will see the cylinder has been moved to
a different spot.

Now you have an idea what the numbers do if you change them:

position 3,4 and 5 were 50 24 20 and control the insertion point of the
subpart.
position 6 to 14 were 12 0 0 0 24 0 0  0 12 and control the size of the
subpart.

Changing the order and the signs of the last 9 numbers turns your cylinder,
so it is pointing in another direction. This is what you do in LEDIT.

first change file TEST.DAT back in:

0
1 16 0 0 0 12 0 0 0 24 0 0 0 12 4-4CYLI.DAT
0

We set the numbers on positions 3,4 and 5 to 0 0 0, so the cylinder will
turn around its insertion point.

Start LEDIT, press the ESCAPE-key, press F (stands for file) and L
(for load) Type the file name: TEST.DAT.

line:
1 16 0 0 0 12 0 0 0 24 0 0 0 12 4-4CYLI.DAT
is in the middle of the three lines displayed at the top of the screen. the
line above reads START and the line under reads END.

Press ESCAPE again, Press T (for turn) and X (for x-axis).
Type the angle: 90

On the screen it seems the cylinder has disappeared, but if you press PAGE-UP followed by PAGE-DOWN the cylinder is redrawn in its new position. As you can see the cylinder is laying on its belly now.

First save the file: press the ESCAPE-key, press F (for file) and S (for save). Then open it in your text editor or in windows and cut and paste the line in the file where you need it.

If you turn the subpart around Z instead of X it is turned into another direction. Turning around Y is just like spinning the cylinder around its center, you see no difference at all.

If your file has more than one subpart in it, you can select the one you are going to turn with the PAGE-DOWN and PAGE-UP keys. It must be the middle one of the 3 lines displayed at the top of the screen.

Now try to do something similar with RECT.DAT, make the file

0
1 16 0 0 0 40 0 0 0 1 0 0 0 20 RECT.DAT
0

Just start to play and fiddle a little bit with the numbers on positions 6, 10 and 14, and see what results you get.

M. Moolhuysen

25) How can I find the numbers for a view in LDraw?

  1. Fire up LEdit.
  2. Choose the front view (/VF).
  3. Rotate the default piece until it's sitting the way you want to view.
  4. Look at the part-line in the top of screen (between the START and END lines).
  5. Write down the 6th through 14th numbers (everything after the 1 0 0.0 0.0 0.0).
  6. Exit LEdit.
  7. Run LDraw with the command LDRAW -a6th,7th,8th,...,14th file.dat (using the numbers you wrote down after the -a option).

26) Where does LDraw look for files

LDraw looks for .DAT files in the following catalogs, in the order they are listed.

  1. The current catalog.
  2. The P catalog.
  3. The PARTS catalog.
  4. The MODELS catalog.

27) What is the colour code for ... ?

The following list is based on the documentation for LDraw, on discussions on the L-CAD mailing list, and on a compilation of RGB colour values by Todd Lehman (LDraw is not using the RGB values listed here). I have added some <red, green, blue, alpha> codes for rendering transparent parts in POV-Ray and other ray-tracing packages. Most of them are copied from Lutz Uhlmann's LGEO package.

Black
LDraw: 0
RGB: 51 51 51
Blue
LDraw: 1
RGB: 0 51 178
Bright green
LDraw: 418
RGB: 0 191 89
Brown
LDraw: 6
RGB: 102 51 0
Chrome
LDraw: 383
RGB: 204 204 204
Cyan
LDraw: 11
Dark cyan
LDraw: 3
Dark grey
LDraw: 8
RGB: 102 102 88
Dark pink
LDraw: 5
RGB: 255 51 153
Dark red (like from set 10019, Star Wars Rebel Blockade Runner)
LDraw: 323
Electrical contacts
LDraw: 494 (yellow)
RGB: 204 204 204 (chrome)
Flesh (from Duplo figures)
RGB: 250 163 157
LDLite: 28
Glow in the dark
RGB: 224 255 176
LDLite: 21
Gold
LDraw: 334
RGB: 240 176 51
Green
LDraw: 2
RGB: 0 127 51
Grey
LDraw: 7
RGB: 153 153 153
Light blue
LDraw: 9
RGB: 0 128 255
Light gray (like from Mosaic)
LDraw: 503
RGB: 230 227 218
Light green
LDraw: 10
RGB: 51 255 102
POV-Ray: <0.20, 1.00, 0.40>
Light purple
RGB: 224 204 240
LDLite: 20
Light red
LDraw: 12 (or 463)
RGB: 255 201 196
Light yellow (Belville)
LDraw: 495
RGB: 255 255 128
LDLite: 18
Light yellowish-green
LDLite: 27
RGB: 229 255 168
Lime green (Blacktron II)
RGB: 173 221 80
Magenta
LDraw: 5
Mint green (Belville)
LDraw: 431
Orange
LDraw: 462
LDLite: 25
Pastel green
RGB: 102 240 153
LDLite: 17
Pink
LDraw: 13
RGB: 255 176 204
Purple
RGB: 153 51 153
LDLite: 22
Purple blue
RGB: 76 0 204
LDLite: 23
Red
LDraw: 4
RGB: 204 0 0
Sand blue
LDraw: 379
RGB 159 178 191
Sand green
LDraw: 378
RGB: 159 204 180
Sand red (dull red, bruise, dusty rose, gray-red)
LDraw: 335
RGB: 212 163 157
Sand violet
LDraw: 373
RGB: 175 150 180
Silver
LDraw: 383
RGB: 204 204 204
Tan
LDraw: 382
RGB: 204 170 102
LDLite: 19
Teal (as in CyberMaster)
LDraw: 3
Transparent (white)
LDraw: 47
RGB: 255 255 255
POV-Ray: <1.00, 1.00, 1.00, 0.90>
Transparent dark blue
LDraw: 33
RGB: 0 0 153
POV-Ray: <0.00, 0.00, 0.94, 0.90>
Transparent dark grey
LDraw: 32
POV-Ray: <0.40, 0.40, 0.40, 0.90>
Transparent green
LDraw: 34
RGB: 0 80 24
POV-Ray: <0.00, 0.83, 0.00, 0.90>
Transparent green-yellow (?)
LDraw: 42
RGB: 204 255 0
POV-Ray: <0.80, 1.00, 0.00, 0.90> or <0.85, 1.00, 0.00, 0.85>
Transparent light blue
LDraw: 41
RGB: 153 192 240
POV-Ray: <0.75, 0.90, 1.00, 0.95>
Transparent orange
RGB: 255 102 0
POV-Ray: <1.00, 0.68, 0.00, 0.80>
LDLite: 57
Transparent red
LDraw: 36
RGB: 204 0 0
POV-Ray: <1.00, 0.20, 0.00, 0.90>
Transparent yellow
LDraw: 46
RGB: 240 196 0
POV-Ray: <0.99, 0.96, 0.00, 0.90>
White
LDraw: 15
RGB: 255 255 255
Yellow
LDraw: 14
RGB: 255 229 0

Edge colours

In LDraw colour number 24 refers to a contrast/complement colour for the current colour (number 16).

Notice that complementing is not reversible for colour numbers 6, 7, 14, and 15.

Surface Edge
0 8
1 9
2 10
3 11
4 12
5 13
6 0
7 8
8 0
9 1
10 2
11 3
12 4
13 5
14 8
15 8

28) Runtime Error 200 ???

LEdit crashes with runtime error 200 on some fast machines. Some delay routines which use a fixed value to count down just resolve to fast on these machines. There is a solution to this problem at <URL:http://www.ldraw.org/community/memorial/archive/rte200fx>.

If you can read German, you can also go to <URL:http://www.heise.de/ct/ftp/ctsi.shtml> and download bppatch.zip, which will do this job for you. <URL:http://membres.lycos.fr/jmy51/bug/download.html> has the same explanation, but in French.

29) Runtime Error 003 ???

The hidden message in this code is "path not found". It occurs if the path to LDraw contains "long" (more than eight letters) catalog names. The problem can be solved by moving LDraw to a directory named C:\LDraw.

30) Can I get LDraw to put the BMP files somewhere else?

No, but you can move the files with a command like this:

   C:\LDRAW> move BITMAPS\MODEL-01.BMP D:\Where\I\Want\My\Pictures

31) What is the parts voting procedure?

Part voting is democratic and is handled by Steve Bliss. Steve is very respected by the group, so sometimes he makes decisions on ideas that don't warrant a vote (or basically gives us the final word). Primitives are handled by a committee.

32) What are the MIME types for LDraw and MPD files?

LDraw files:
application/x-ldraw
Multi-part DAT files (MPD):
application/x-multi-part-ldraw
LDLite files:
application/x-ldlite

The web server jacob.sparre.dk, which hosts the FAQ has been configured by adding:

    AddType application/x-ldraw            dat
    AddType application/x-multi-part-ldraw mpd
    AddType application/x-ldlite           ldlite

to the file /etc/httpd/conf/httpd.conf (it's Apache). Most people prefer to use three letter extensions, so the LDLite line should probably read:

    AddType application/x-ldlite           ldl

33) Runtime Error 216 ??? (LEdit)

When LEdit breaks down and writes "Runtime Error 216", it is likely to be because your model file contains more than 1000 lines. When you model file is that long it is a good idea to split the model into sub-model, which from the main model looks just like individual LEGO bricks.


Even though I try to, I can't know everything, so please write me, if you have corrections or additions to the FAQ.
Jacob
<jacob@ldraw.org>

Latest update: 17th of June 2002.