LDraw

From Wikipedia, the free encyclopedia
Jump to: navigation, search
LDraw
Web address Official website
Slogan Unknown
Commercial? No
Type of site
Unknown
Registration Free
Created by LEGO and the James Jessiman
Current status Online
A racecar created with LDraw

LDraw is a system of free software tools for modeling Lego creations in 3D on a computer. The LDraw file format[1] and original program were written by James Jessiman, although the file format has since evolved. He also modeled many of the original parts in the parts library, which is under continuous maintenance and extension by the LDraw community. In 1997, Jessiman died.[2] Since then, a variety of programs have been written that use the LDraw parts library, and file format. LDraw models are frequently rendered in POV-Ray, a free 3D ray tracer.

LDraw file format[edit]

The LDraw format can divide a model into steps so that the building instructions can be incorporated into the design, and also allows for steps that rotate the camera and even move parts around in an elementary fashion. It also allows for models to be incorporated in the construction of larger models to make design easier. This also makes the file format space efficient: instead of specifying the polygons of every single stud of a specific brick for example, a shared stud file is included multiple times with transformation applied.

Parts, models, sub-models and polygons are all treated the same and are not specific to Lego models (only the parts library is). The format could be used to store any type of 3D model. Some have created bricks of other building systems for use with LDraw.

LDraw files specifying basic single parts or sub-primitives usually have the extension .dat, Lego models consisting of multiple bricks have the extension .ldr, models consisting of multiple parts and sub-models are called *.mpd.

The file format uses plain text data.

Example part[edit]

0 Brick  2 x  2
0 Name: 3003.dat
0 Author: James Jessiman
0 !LDRAW_ORG Part UPDATE 2002-03
0 !LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt
 
0 BFC CERTIFY CCW
 
0 !HISTORY 2001-10-26 [PTadmin] Official Update 2001-01
0 !HISTORY 2002-05-07 [unknown] BFC Certification
0 !HISTORY 2002-06-11 [PTadmin] Official Update 2002-03
0 !HISTORY 2007-05-07 [PTadmin] Header formatted for Contributor Agreement
0 !HISTORY 2008-07-01 [PTadmin] Official Update 2008-01
 
1 16 0 4 0 1 0 0 0 -5 0 0 0 1 stud4.dat
 
0 BFC INVERTNEXT
1 16 0 24 0 16 0 0 0 -20 0 0 0 16 box5.dat
 
4 16 20 24 20 16 24 16 -16 24 16 -20 24 20
4 16 -20 24 20 -16 24 16 -16 24 -16 -20 24 -20
4 16 -20 24 -20 -16 24 -16 16 24 -16 20 24 -20
4 16 20 24 -20 16 24 -16 16 24 16 20 24 20
 
1 16 0 24 0 20 0 0 0 -24 0 0 0 20 box5.dat
 
1 16 10 0 10 1 0 0 0 1 0 0 0 1 stud.dat
1 16 -10 0 10 1 0 0 0 1 0 0 0 1 stud.dat
1 16 10 0 -10 1 0 0 0 1 0 0 0 1 stud.dat
1 16 -10 0 -10 1 0 0 0 1 0 0 0 1 stud.dat

The above code defines the basic 2×2 brick. It consists of a five-sided box (box5.dat, outside) and an inverted five-sided box (inside), the connection between those two, consisting of four quads (the four lines starting with 4), the four studs on top of it (stud.dat) and the long hollow stud in the inside (stud4.dat).

All lines in an LDraw file are either empty or start with a command number, where 0 means no command (though over time, some lines starting with 0 followed by specific text in capitals also got a meaning as meta commands). The command 1 for example includes a subfile. It specifies the file's path and a transformation matrix that should be applied to it, as well as its color (where 16 means "use the color that was used when including the current file"). Command 4 specifies a four-sided polygon. There are also commands that define 2D lines. Such lines give the parts a clear contour even in non-shaded orthographic renderings.

Example model[edit]

The following code specifies a simple pyramid model with three layers made of 2 x 4 bricks (brick # 3001) with changing color and a 2 x 2 brick on top.

0 Pyramid
0 Name: pyramid.dat
0 Author: James Jessiman
 
 1 1 -40 -24 60 1 0 0 0 1 0 0 0 1 3001.dat
 1 1 40 -24 60 1 0 0 0 1 0 0 0 1 3001.dat
 1 1 60 -24 0 0 0 1 0 1 0 -1 0 0 3001.dat
 1 1 40 -24 -60 1 0 0 0 1 0 0 0 1 3001.dat
 1 1 -40 -24 -60 1 0 0 0 1 0 0 0 1 3001.dat
 1 1 -60 -24 0 0 0 1 0 1 0 -1 0 0 3001.dat
0 STEP
 1 4 -20 -48 40 1 0 0 0 1 0 0 0 1 3001.dat
 1 4 40 -48 20 0 0 1 0 1 0 -1 0 0 3001.dat
 1 4 20 -48 -40 1 0 0 0 1 0 0 0 1 3001.dat
 1 4 -40 -48 -20 0 0 1 0 1 0 -1 0 0 3001.dat
0 STEP
 1 14 0 -72 20 1 0 0 0 1 0 0 0 1 3001.dat
 1 14 0 -72 -20 1 0 0 0 1 0 0 0 1 3001.dat
0 STEP
 1 0 0 -96 0 1 0 0 0 1 0 0 0 1 3003.dat
0 STEP

Peeron and LDraw[edit]

The LEGO set and parts database hosted at the website www.peeron.com lists parts available as 3D CAD models in the LDraw parts library, with correctly colored images rendered from these models. The Peeron and LDraw team work together to clarify unclear part numbers, colors and names, sometimes using information provided by The LEGO Group[3]

See also[edit]

References[edit]

  1. ^ OrionP (25 April 2004). "The LDraw File Format Standards". LDraw.org. Retrieved 30 January 2012. 
  2. ^ OrionP (8 November 2003). "James Jessiman Memorial". LDraw.org. Retrieved 30 January 2012. On July 25, 1997, James Jessiman passed away. 
  3. ^ Holly-Wood (22 August 2007). "LDraw Steering Committee Notes 2007/2008". LDraw.org. Retrieved 30 January 2012. 

Further reading[edit]

  • Courtney, Tim; Bliss, Steve; Herrera, Ahui (2003). Virtual LEGO: the official LDraw.Org guide to LDraw tools for Windows. San Francisco: No Starch Press. ISBN 978-1-886411-94-4. 
  • Clague, Kevin (2002). LEGO Software Power Tools: including LDraw, MLCad, and LPub. Rockland, Mass: Syngress. ISBN 978-1-931836-76-0. 

External links[edit]