Programs add their own type 0 lines to LDraw files. A reader that does not know a line
treats it as a comment. The file format specification asks that a new command begin with
! and the name of the program that introduced it, in capitals
(0 !LDPARSER EXAMPLE), and many older commands do neither. The commands below
are listed under the program whose source or documentation shows what it does with them.
Matching is case-sensitive unless stated. The commands of MLCad, LPub3D and LDCad have
their own pages: MLCad commands,
LPub3D commands and
LDCad commands.
LeoCAD
LeoCAD keeps its data under 0 !LEOCAD. Other 0 lines it does
not know are kept and written back. Positions and matrices in PIECE PIVOT
and SYNTH CONTROL_POINT are in LDraw coordinates; key positions and
rotations of pieces, cameras and lights are stored in LeoCAD’s own Z-up axes, where
LDraw (x, y, z) is (x, z, −y).
Model
Line after 0 !LEOCAD | Meaning |
|---|---|
MODEL AUTHOR text | Author of the model. |
MODEL DESCRIPTION text | Description. |
MODEL COMMENT text | One line of the comment; the lines are joined in order. Of these three the current writer emits only this one. |
MODEL ASSET_SOURCE base64 | An absolute folder, as base64 of its UTF-8 path, in which to look for files the model uses. May repeat. |
MODEL ASSET_SOURCE_PRIORITY SOURCE | Do not prefer the folder of the current file over those folders. |
CLIPBOARD PROJECT uuid | Identifies the project that placed data on the clipboard. |
LeoCAD’s published list also has MODEL NAME name,
MODEL BACKGROUND COLOR r g b,
MODEL BACKGROUND GRADIENT r1 g1 b1 r2 g2 b2 and
MODEL BACKGROUND IMAGE [TILE] NAME file (an image tiled at its
own size with TILE, otherwise stretched). The source version examined here
does nothing with these four.
Pieces
These apply to the next type 1 line.
Line after 0 !LEOCAD PIECE | Meaning |
|---|---|
STEP_HIDE step | The piece is not shown from this step on. |
HIDDEN | The piece is hidden. |
PIVOT x y z a b c d e f g h i | The centre and axes of rotation of the piece, written like the numbers of a type 1 line. |
POSITION x y z | Position. |
POSITION_KEY step x y z | Position key frame; this is the form written. |
ROTATION a b c d e f g h i | Rotation matrix. |
ROTATION_KEY step a b c d e f g h i | Rotation key frame; this is the form written. |
Cameras
Several keywords may share a line. NAME takes the rest of the line and
completes the camera. Defaults given by LeoCAD’s documentation: field of view 30
degrees, near plane 25, far plane 50000.
Keyword after 0 !LEOCAD CAMERA | Meaning |
|---|---|
HIDDEN | The camera is hidden. |
ORTHOGRAPHIC | Orthographic projection instead of perspective. |
FOV degrees | Field of view. |
ZNEAR d, ZFAR d | Clipping distances. |
POSITION x y z | Where the camera is. |
TARGET_POSITION x y z | What it looks at. |
UP_VECTOR x y z | Its up direction. |
POSITION_KEY, TARGET_POSITION_KEY, UP_VECTOR_KEY step x y z | Key frames of the three. |
NAME name | Name; must come last. |
The writer of the version examined puts no space after HIDDEN, so a hidden
camera comes out as HIDDENNAME … or
HIDDENORTHOGRAPHIC NAME …, which its own reader does not split.
Lights
Lines begin 0 !LEOCAD LIGHT. TYPE t NAME name
ends a light; t is POINT, SPOT,
DIRECTIONAL or AREA, and quotes are removed from the name.
Numeric settings also have a key-frame form NAME_KEY step values.
| Keyword | Default | Meaning |
|---|---|---|
SHADOWLESS | The light casts no shadow. | |
POSITION x y z | Position. | |
ROTATION (9 numbers) | Orientation. | |
COLOR r g b | 1 1 1 | Colour. |
BLENDER_RADIUS | 0 | Radius for Blender. |
BLENDER_ANGLE | 0.526° (stored in radians) | Angle of a directional light for Blender. |
BLENDER_POWER | 10; 1 if directional | Power for Blender. |
AREA_SIZE_X, AREA_SIZE_Y | 250 | Size of an area light. |
AREA_SHAPE s | RECTANGLE, SQUARE, DISK or ELLIPSE. | |
POVRAY_POWER | 1 | Power for POV-Ray. |
POVRAY_FADE_DISTANCE, POVRAY_FADE_POWER | 0, 0 | POV-Ray light fading. |
SPOT_CONE_ANGLE | 80 | Cone of a spotlight. |
SPOT_PENUMBRA_ANGLE | 0 | Soft edge of a spotlight. |
POVRAY_SPOT_TIGHTNESS | 0 | POV-Ray spotlight tightness. |
POVRAY_AREA_GRID_X, POVRAY_AREA_GRID_Y | 2, 2 | POV-Ray area-light grid. |
POV-Ray export, groups and synthesized parts
The POV_RAY lines are written only when a value differs from its default.
Line after 0 !LEOCAD | Meaning |
|---|---|
POV_RAY HEADER_INCLUDE_FILE path, FOOTER_INCLUDE_FILE path | Files included at the top and bottom of the export; dropped if unreadable. |
POV_RAY FLOOR_AXIS n | Floor axis 0 to 2; default 1 (y). |
POV_RAY FLOOR_COLOR_RGB r g b | Floor colour; default 0.8 each. |
POV_RAY FLOOR_AMBIENT n, FLOOR_DIFFUSE n | Floor finish; default 0.4 each. |
POV_RAY EXCLUDE_FLOOR, EXCLUDE_BACKGROUND | Leave the floor or background out. |
POV_RAY NO_REFLECTION, NO_SHADOWS | Turn reflections or shadows off. |
POV_RAY USE_LGEO | Use the LGEO part models. |
GROUP BEGIN name … GROUP END | Pieces between belong to the group; blocks nest, and a repeated name is the same group. |
SYNTH BEGIN … SYNTH END | Brackets the control points of a flexible or synthesized part; they apply to the following type 1 line. |
SYNTH CONTROL_POINT x y z a b c d e f g h i scale | One control point: position, orientation and scale. |
LDView
| Line | Meaning |
|---|---|
0 !LDVIEW BBOX_IGNORE BEGIN, END, NEXT | The lines of the block, or the next line, are left out of the bounding box that sets the default view distance. |
0 !OBI SET token, 0 !OBI UNSET token | Sets or clears a token. Used only when the !OBI option is on; the words after !OBI may be in either case and tokens are folded to lower case. |
0 !OBI NEXT colour [IFSET token | IFNSET token] | Draws what the next action line draws in colour, with edge colour 0. With a condition, only if the token is set or not set. |
0 !OBI START colour [IFSET token | IFNSET token] … 0 !OBI END | The same for every line up to END; overrides stack. colour is a code, or a colour name with _ for each space. |
0 ~lsynth constraint | The part is not shrunk when seams are drawn. |
0 STEP…, 0 ROTSTEP… | Any case. Each counts as a step; rotation angles are ignored. |
0 L3P IFPOV, IFNOTPOV, ELSEPOV, ENDPOV | Conditional blocks for POV-Ray export; comment text inside a POV block is copied into the .pov file. |
0 COLOR code name edge r g b a r2 g2 b2 a2 | Old colour definition: edge colour number, then two RGBA colours for dithering. |
LDView also still recognises older forms of official lines, such as
0 ~Moved to, 0 Author and the type lines used before
!LDRAW_ORG.
LDGLite
Transformation blocks
Each form opens a block that its own END line closes.
| Opening line | Effect on the enclosed lines |
|---|---|
0 TRANSLATE x y z | Moves them. |
0 ROTATE angle ax ay az | Rotates them by angle degrees about the line from the origin through (ax, ay, az). |
0 SCALE s | Scales them. |
0 TRANSFORM x y z a b c d e f g h i | Applies a translation and 3 × 3 matrix, as if the lines were in a sub-file placed by a type 1 line. |
LDGLite also has an early texture form,
0 !TEXMAP x1 y1 z1 x2 y2 z2 x3 y3 z3 file with
0 !: lines, 0 !TEXMAP FALLBACK and
0 !TEXMAP END, which differs from the official
!TEXMAP.
Steps, buffers and colours
| Line | Meaning |
|---|---|
0 STEP, 0 CLEAR | End a step; erase what has been drawn. |
0 BUFEXCHG A STORE | Remembers the drawing state of the model. Only buffer A, and only in the top-level model. |
0 BUFEXCHG A RETRIEVE | Recalls that state. The redraw that would follow is disabled in the version examined. |
0 GHOST line | Recognised, but the rest of the line is not drawn. |
0 COLOR code name inverse r g b a r2 g2 b2 a2 (or COLOUR) | Redefines a colour; all values are required. |
0 !FADE percent | Turns fading on at that percentage (a command of LPub3D). |
0 !SILHOUETTE width colour | Turns outlines on; with one number only, turns them off (also LPub3D). |
!COLOUR definitions are read only when NAME,
CODE, VALUE, EDGE and the optional
ALPHA come in that order.
The older parser
LDGLite contains a second parser derived from the original ldlite, used
when the default one is not selected. It adds these commands.
| Line | Meaning |
|---|---|
0 STEP, 0 PAUSE, 0 SAVE, 0 CLEAR, 0 WRITE text (or PRINT) | The original program commands. |
0 COLOR code name and 9 numbers | Defines a colour. |
0 COLORNAME name colour (or COLOURNAME) | Gives a name to a colour. |
0 POINT name x y z | Defines a named point. |
0 MATRIX name and 9 numbers | Defines a named matrix. |
0 FILE name | Starts an embedded file. |
0 TRANSLATE, ROTATE, SCALE, TRANSFORM | Block transformations as above. |
LSynth
LSynth reads a model, replaces each marked block of constraint parts with generated hose
or band parts, and keeps its definitions in lsynth.mpd. It also accepts
0 WRITE x in place of 0 x.
In a model
| Line | Meaning |
|---|---|
0 SYNTH BEGIN type colour | Starts a block. type is a hose or band type, or a product name. The line may also hold NAME= (name of a separate output sub-file) and GROUP= (MLCad group for the generated parts); LENGTH= and UNITS= are looked for and not used. |
0 SYNTH END | Ends the block of constraint parts; synthesis happens here. |
0 SYNTH INSIDE, OUTSIDE, CROSS | In a band, how it is to run around the constraints at this point. |
0 SYNTH HIDE, 0 SYNTH SHOW | Whether the following constraint parts are written commented out (with a leading 0) or shown. |
0 SYNTH SYNTHESIZED BEGIN … END | Written around the generated parts. |
0 SYNTHESIZED BEGIN … 0 SYNTHESIZED END | The earlier form; skipped when the block is generated again. |
0 SYNTH HOSE_RES bend twist | Largest bend and twist from one hose segment to the next. |
0 SYNTH BAND_RES value | Resolution of bands. |
0 GHOST line | A ghosted constraint is used, and the output is ghosted. |
0 MLCAD BTG group | Group membership; carried over to the generated parts. |
0 GROUP … | MLCad group lines inside a block are tolerated. |
0 ROTATION C…, 0 COLOR… | Skipped. |
0 LPUB PLI BEGIN SUB part colour … 0 LPUB PLI END | Written around a block that makes a known product, so that a parts list shows the one part. |
In lsynth.mpd
| Definition | Content up to 0 SYNTH END |
|---|---|
0 !VERSION major.minor | Version of the definition file; a warning is given if it differs from the program’s. |
0 SYNTH PART product nickname method | One line: a product and the type that makes it. |
0 SYNTH BEGIN DEFINE name HOSE fill diameter stiffness twist | Three type 1 lines for the start, middle and end segments; a further one gives an alternate middle segment. fill is STRETCH, FIXED or FIXEDn with n above 1. |
0 SYNTH BEGIN DEFINE name BAND fill scale threshold | Type 1 lines for the tangent and arc parts; with fill FIXED3 (instead of STRETCH or FIXED) two more for the start and end transitions. |
0 SYNTH BEGIN DEFINE name PULLEY fill scale threshold | The same shape of block for a pulley chain. The version examined tests the part lines the wrong way round here. |
0 SYNTH BEGIN DEFINE HOSE CONSTRAINTS | Type 1 lines naming the parts usable as hose constraints, with their offsets and orientations. The number in the colour position is a flag: if it is not 0, a constraint of this part that ends a hose is turned around. |
0 SYNTH BEGIN DEFINE BAND CONSTRAINTS | The same for band constraints, with a radius in the colour position. |
Bricksmith reads lsynth.mpd too, for its menus. It takes the
SYNTH PART lines, the names and fields of the HOSE and
BAND definition lines and the two constraint blocks, and does not read
PULLEY definitions. In product, hose and band names it shows underscores
as spaces. A constraint gets its menu text from the comment line before it: for a hose
what follows - Type , with the quotation marks removed, and entries whose
text then holds no hyphen are left out; for a band what follows // .
Bricksmith
| Line | Meaning |
|---|---|
0 STEP | Ends a step. |
0 ROTSTEP x y z [REL | ABS | ADD] | Ends a step and sets the view rotation in degrees; the angles are applied in z, y, x order. Without a type it is REL. |
0 ROTSTEP END | Ends a step and ends the rotation. |
0 SYNTH BEGIN type colour … 0 SYNTH END | An LSynth block. |
0 SYNTH SHOW, HIDE | Visibility of the constraints; SHOW is what is written. |
0 SYNTH INSIDE, OUTSIDE, CROSS | Band direction. |
0 SYNTH SYNTHESIZED BEGIN … END | The generated parts; saving them is optional. |
0 //, 0 WRITE, 0 PRINT | Kept as comment or message lines. |
Importers and web viewers
LDCad’s own lines are on the LDCad commands page.
| Program | Commands it acts on besides the official ones |
|---|---|
| ImportLDraw (Blender) | SYNTH SYNTHESIZED BEGIN / END and !LDCAD GENERATED mark generated parts; STEP and ROTSTEP count steps; !LEOCAD PIECE HIDDEN and STEP_HIDE, !LEOCAD GROUP and !LEOCAD CAMERA are applied. |
| ExportLdraw (Blender) | STEP, SAVE, CLEAR, PRINT / WRITE text; !LDCAD GROUP_DEF and GROUP_NXT; !LEOCAD GROUP and CAMERA; the texture lines of Stud.io. |
| buildinginstructions.js | ROTSTEP x y z [type] and ROTSTEP END; 0 !BRICKHUB_INLINED [value]; an older embedded-data form 0 !DATA START … END; !LDCAD GENERATED marks a part; other !LPUB, !LDCAD and !LEOCAD lines are carried as header lines; the file keyword 0 file is accepted in lower case. |
| three.js LDrawLoader | None: it reads the official !LDRAW_ORG, !COLOUR, !CATEGORY, !KEYWORDS, FILE, BFC, STEP and Author: and ignores the rest. |
Stud.io lines
Textures
BrickLink’s Studio writes textures with its own lines. The layout here is what two open-source readers, ExportLdraw and buildinginstructions.js, expect.
| Line | Meaning |
|---|---|
0 PE_TEX_PATH n… | Which geometry the next texture belongs to: -1 is this file; otherwise a path down the sub-file tree, each number an index counted from 0 over the lines of types 1, 3 and 4 of one file. A last index that is a polygon names that polygon. |
0 PE_TEX_INFO base64 | The last field is a PNG picture in base64. |
0 PE_TEX_INFO x y z a b c d e f g h i minu minv maxu maxv base64 | The long form of 17 fields: the transformation of a projection box, the texture coordinate range, then the picture. |
0 PE_TEX_NEXT_SHEAR | Comes before a PE_TEX_INFO line and marks it. What the mark changes is not established; ExportLdraw’s own notes call it unknown. |
| Type 3 line with six more numbers | Texture coordinates u v for the three corners, after the usual fields. |
The buildinginstructions.js viewer takes texture coordinates from triangles only and reads none from quadrilaterals. How Studio writes them for a quadrilateral is unknown.
BrickLink item number
A user of the LDraw forums reports (2026) that Studio shows the available colours of a
custom part only if its header names the BrickLink item, on the line directly after
0 Author::
0 BL_Item_No 5272pb01
5272pb01 is a part
number.Connection points in Part Designer files
Part Designer, Studio’s part editor, saves its .part files as readable
text in which connection points are 0 PE_CONN lines. No official
description exists. This reading comes from forum users who changed values in such
files and watched the result (2024 and 2025):
0 PE_CONN group element a b c d e f g h i x y z zlength xlength cells
| Field | Reported meaning |
|---|---|
| group element | A group number and an element number within it. Groups 2 and 3 are described as the main ones of stud-based parts. Another user lists ID numbers that pair counterparts (2 and 3 for technic pin hole and pin, 6 and 7 for axle hole and axle with 9 for an axle with a stop, 10 and 11 for round hole and bar, 12 and 13 for clip and bar) without saying which of the two fields holds them. |
| a … i | A 3 × 3 matrix, the identity for many elements. |
| x y z | The position of the element. One user says .part files measure in studs, unlike the binary .conn files, which use LDraw units. |
| zlength xlength | For the stud-type groups 2 and 3, the size along Z and X in half studs. |
| cells | Comma-separated n:m pairs, (zlength + 1) × (xlength + 1) of them, such as 0:0,0:0,0:0,0:0,0:0,0:0 for 1 × 2. The meaning of the two numbers is unknown; one user saw that changing 10:4 to 20:4 turned the drawn disc into a ring. |
A full list of the group and element numbers, and the meaning of the cell values, are
unknown. The .conn files that Studio itself reads are a binary format and not LDraw
text.
LDForge
| Line | Meaning |
|---|---|
0 !LDFORGE VERTEX colour x y z | A helper vertex. |
0 !LDFORGE OVERLAY file camera x y width height | A picture laid over one of the editor’s views. |
0 BFC CERTIFY INVERTNEXT, CLIP, NOCLIP | The forms written by MLCad are accepted. |
Older LPub and LDLite forms
The LDraw wiki’s list of unofficial commands gives these by syntax alone. Their meaning below comes from the programs’ own sources.
| Line | Meaning |
|---|---|
0 BI BEGIN GREYED … 0 BI END | LPub 2: the geometry between the two lines is rendered in the greyed colours used for earlier steps, even where it belongs to the current step. It was introduced to correct the colours of parts from earlier steps when buffer exchanges are used. LPub 2 finds the lines in the POV-Ray file converted from the model, with or without WRITE before BI. |
0 BI BEGIN GRAYED | The wiki’s spelling. LPub 2’s source compares only with GREYED, so this spelling has no effect there. |
0 LPUB GROUP REMOVE name | LPub 2: removes the parts of an MLCad group from the model as built so far. |
0 LPUB END | Not a command of LPub 2, LPub4 or LPub3D; the LPub 2 source stops with a parse error on it. |
0 CMDLINE line | LDLite has no such keyword, in its source history or in release 2.4, and reads the line as a comment. It is the unprefixed form of the header line 0 !CMDLINE, the options for running the file, such as -c1; LDLite takes -Cn as a command-line option naming the colour that colour 16 stands for. LPub3D recognises both forms as header lines. |
LPub 2’s settings for pages, step numbers, parts lists, the bill of materials, callouts and step groups are described under LPub 2 commands.
Sources
- LDraw wiki: List of Known Unofficial META Commands
- LUGNET
lugnet.cadmessage 10658 –BI GREYED - LUGNET
lugnet.cadmessage 9372 – quotes the LPub 2.1.0.6 announcement introducingBI BEGIN GREYED - LPub 2 CVS repository (GPL) –
constr.cpp,parse_attrib.cpp - LDLite CVS repository and the LDLite 2.4 release (GPL) –
parser/ldlite.l,parser/ldlite.y, the 2.4 manual - LPub3D
ldrawfiles.cppand the LPub4 source – header lines; noLPUB END - LDraw.org: File Format Specification – META commands and rules for new ones
- LDraw forums: Tip on where to put
0 BL_Item_No(2026) - LDraw forums: File Format for the Studio Connectivity Files –
PE_CONNas observed by users (2024–2026) - LDraw forums: Studio Connectivity Data – no documentation of
PE_CONN(2022) - LeoCAD: Meta Commands
- LeoCAD source –
lc_model.cpp,piece.cpp,camera.cpp,light.cpp,light.h,lc_objectproperty.cpp,project.cpp - LDView source –
LDLoader/LDLCommentLine.cpp,LDLModel.cpp,LDLPalette.cpp,LDLib/LDModelParser.cpp,LDObiInfo.cpp,LDExporter/LDPovExporter.cpp - LDGLite source –
L3Input.c,L3View.c,main.c,ldlite.y - LSynth source –
lsynthcp.c,band.c,hose.c - Bricksmith source –
LDrawKeywords.h,LDrawStep.m,LDrawLSynth.m,LDrawMetaCommand.m - Bricksmith
LSynthConfiguration.m– its reading oflsynth.mpd - ImportLDraw source –
loadldraw.py - ExportLdraw source –
ldraw_file.py,ldraw_node.py,pe_texmap.py - buildinginstructions.js source –
LDRLoader.js,StudioTexmap.js,LDCadGenerator.js - three.js
LDrawLoader.js - LDForge source –
ldDocument.cc,ldObject.cc