Creating LDraw Parts

  Introduction | File Format | Primitives | Numbers | Patterned Part Numbers | Meta Statements | Errors

Creating LDraw Parts: LDraw file format

FAQ for LDraw file types
Everything you wanted to know about the different kinds of files in the LDraw Parts Library

What's with 'file types'? Aren't they all just DAT files?
Yes, all the files in the LDraw Parts Library are DAT files. But different files are included in the library for different reasons. Different rules sometimes apply to different files.

What are the different file types?
The main four types of files are:

  • Parts
    • Simple parts
    • Complete/composite parts
    • Modelling Shortcuts
    • Modelers' Subparts
    • Official Number/Color Shortcuts
  • Subparts
  • Primitives
  • Hi-Res Primitives

What are subparts, when should they be used, and how are they numbered?
A: Subparts may be used for four purposes, and in all cases are stored in the \s subdirectory and referenced from a main part with a type 1 line.

        1 <colour> 0 0 0 x 0 0 0 y 0 0 0 z s\nnnnSnn

  • A part has many patterned versions
    Example: the minifig torso, see 973.dat and s\973s01.dat.
    The plain (non-decorated) regions of the part are created as a subpart, which is referenced (with a type 1 line) by the main part file and each of the decorated part files. The subpart would be named by appending S01 to the main part file name.
  • The part has a high degree of symmetry
    Example: some of the wheels, such as 2593.DAT.
    As a way of reducing the size of the part files, the repeated region is created as a subpart and referenced several times by the main part file. Multiple subparts may be utilised if needed. Such subparts are typically numbered by appending Snn to the main part file name.
  • A patterned part contains areas which need a dithered colour
    Example: the Black Falcon shield, see 3846P43.DAT, S\3846P43A.DAT, and S\3846P43B.DAT.
    Due to a limitation of the original LDraw program dithered colours are only correctly rendered when used on a type 1 line. Such subparts are numbered by uniquely modifying the patterned part number (e.g. nnnnPnnA or nnnnAnn)
  • Some elements are shared between several parts
    Example: the Wolfpack flag 2335P44.DAT and shield 3846P44.DAT.
    Such subparts are also numbered by uniquely modifying the patterned part number, but may be referenced from more than one base part file.

Is file size really important?
Hard drives may be cheap, but bandwidth is not. Most people still connect to the Internet through dial-up modems. And many people have to pay by the minute while they are connected. Reducing the size of part files not only reduces the space required to store parts, it also reduces the time it takes to download the parts.



  Introduction | File Format | Primitives | Numbers | Patterned Part Numbers | Meta Statements | Errors

Original documentation by LDraw.org. Edited by Steven.