Maintained by: The LDraw.org Standards Committee
Author: The LDraw.org Standards Committee
Writers: William Howard [4]
Contributors: Many
Purpose [5]
LDraw Files [6]
Numeric Precision and Format [7]
Co-planar Tolerance [8]
Duplicate Line Types [9]
Overlapping and Intersecting Line Types [10]
Matrix restrictions [11]
Colour restrictions [12]
META Commands [13]
Header Meta Commands [14]
Body Meta Commands [15]
Generated line types [16]
Sticker Shortcuts [17]
Line Termination [18]
Purpose
This document describes additional restrictions to the LDraw File Format 1.0.0 specification for official parts. Unless contradicted by this document all details within the LDraw File Format 1.0.0 specification apply to official parts.
LDraw Files
Numeric Precision and Format
Co-planar Tolerance
A quad (line type 4) must be planar, meaning that if it is split into two triangles, both triangles will be co-planar with each other. There are always two ways to split a quad into two triangles, and both must result in co-planar triangles. The triangles are considered co-planar if the angle between their surface normals is less than or equal to 3 degrees, however, an angle of less than 1 degree is strongly recommended, especially for large quads where the "warp" can be seen in the part at normal viewing magnifications. (Note: Parts already in the library or certified on the tracker are not to be re-submitted just to fix any co-planar violations.)
Duplicate Line Types
Identical sub-files (line type 1) are not permitted.
Identical lines and conditional lines are not permitted. The order of end points is not considered when checking for identical lines (line types 2 and 5). Control points are not considered when checking for identical conditional lines (line type 5).
Identical triangles and quads are not permitted. The ordering of vertex points is not considered when checking for identical polygons (line types 3 and 4).
Overlapping and Intersecting Line Types
All or part of a line (line type 2) may not overlap all or part of any other line (line type 2).
All or part of a conditional line (line type 5) may not overlap all or part of any other conditional line (line type 5).
Part (but not all) of a conditional line (line type 5) may overlap all (but not part) of a line (line type 2).
Lines (line type 2 or 5) may intersect any other line (line type 2 or 5).
Every effort must be made to remove overlapping co-planar polygons (line type 3 or 4). Where overlapping polygons are unavoidable, the overlap must be kept to the absolute minimum.
Every effort must be made to remove intersecting (non co-planar) polygons (line type 3 or 4). Where intersecting polygons are unavoidable, the intersection(s) must be kept to the absolute minimum.
Note: Primitives that overlap/intersect other primitives or polygons (line type 3 or 4), provided that the overlap is small, are considered acceptable. The intention is not to force part authors to in-line primitives. However, there may be some cases where it is better to use (say) a 3-8cyli and a quad than a 1-2cyli; case-by-case decisions are left to the parts review process.
Matrix restrictions
The matrix specified for sub-files (line type 1) must not be singular nor contain columns or rows of all zeros.
Colour restrictions
Polygons (line types 3 and 4) must not use colour 24.
Lines (line types 2 and 5) should not use colour 16.
META Commands
(See also List of Official META Commands [20].)
Official parts must conform to the Official Library Header Specification [21].
Only the following meta commands are permitted in the body of official parts:
Legacy parts may not conform to these rules. Legacy parts (including those already on the Parts Tracker) should not be edited solely for the purpose of making them conform. However, if the part is changed for any other reason, non-conformant lines must be updated.
Generated line types
Lines and polygons generate by a utility program (such as LSynth) must conform to this specification. The meta commands used to generate the line types may be left in the part file provided they are correctly commented out. It is desirable to add a comment to mark the end of the generated section.
Sticker Shortcuts
Shortcuts that consist of one part (which may be a composite part) and one or more stickers are allowed in the official library. Such shortcuts will have a filename consisting of the part number for the part, followed by a "d", followed by a two-digit number that starts at 01 and increases with each new part/sticker shortcut. If the sticker is applied to a composite part, the full composite part filename will be used before the d. For example, the first sticker added to part 30185c01.dat would have a filename of 30185c01d01.dat. The following restrictions apply:
Line Termination
All lines in the file must use the standard DOS/Windows line termination of <CR><LF> (carriage return/line feed). The last two bytes of the file must be <CR><LF>. (In other words, there must be a <CR><LF> line terminator at the end of the last line in the file.)