LPub3D makes building instructions from LDraw models and keeps the whole description of the book in the model file, as type 0 lines. This page follows the parser in its source.
How a line is read
A command is a path through a tree of keywords:
0 !LPUB branch [sub-branch…] [LOCAL | GLOBAL] values.
0 LPUB without the ! is accepted, and a line beginning
0 PLIST is read as a parts list command. LOCAL before the
value makes the setting temporary: it is kept beside the standing value and dropped at
the end of the step. GLOBAL marks a setting for the whole document. A line
whose first word is in the tree but whose remainder does not parse is reported as an
error; other type 0 lines are comments.
Besides !LPUB, the first words LPub3D acts on are STEP,
CLEAR, ROTSTEP, BUFEXCHG, MLCAD,
!LDCAD, !LEOCAD, SYNTH, !FADE,
!SILHOUETTE, !TEXMAP and !COLOUR.
Some old spellings are rewritten before parsing: VIEW_ANGLE to
CAMERA_ANGLES, MODEL_PIECES to MODEL_PARTS,
BLENDER_DIRECTIONAL_ANGLE to BLENDER_SUN_ANGLE and
COLOR_RGB to COLOR.
CAMERA_DISTANCE_NATIVE is no longer supported below global scope.
Commands that change what a step shows
Line after 0 | Meaning |
|---|---|
STEP | Ends a step. |
!LPUB NOSTEP | Takes no further words; marks a step that gets no instruction step of its own. |
ROTSTEP x y z [ABS | REL | ADD] | Ends a step and sets the view rotation. ROTSTEP END clears it. |
BUFEXCHG b STORE | RETRIEVE | Saves or restores the model so far in a buffer named by one capital letter. |
!LPUB PART BEGIN IGN … !LPUB PART END | The parts between are left out and no step images are made for them. Nesting is an error. |
MLCAD SKIP_BEGIN … MLCAD SKIP_END | Treated exactly as the pair above. |
SYNTH BEGIN … SYNTH END | Marks the generated pieces of an LSynth part. The tree also has SYNTH SHOW, HIDE, INSIDE, OUTSIDE, CROSS and SYNTHESIZED. |
!LPUB REMOVE PART file | From here, drops from the step image every sub-file reference naming that file (case ignored), with the lines that follow it up to the next reference. |
!LPUB REMOVE NAME name | Drops the sub-file reference that follows a line 0 !LPUB NAME name. |
!LPUB REMOVE GROUP name | Drops a group: the line after each matching 0 MLCAD BTG name; the line after each 0 !LDCAD GROUP_NXT [ids=…] whose group ids include that group; or a whole 0 !LEOCAD GROUP BEGIN Group name … GROUP END block, nested blocks included. For the last form the name compared is what follows the word Group. |
!LPUB INCLUDE file | Reads commands from another file. |
Parts list control
Line after 0 !LPUB | Meaning |
|---|---|
PLI BEGIN IGN … PLI END | The parts between do not appear in the parts list. BOM takes the same pair for the bill of materials. |
PLI BEGIN SUB part [colour scale fov latitude longitude tx ty tz rx ry rz ABS | REL | ADD] [LDRAW_TYPE part] … PLI END | The list shows the named part in place of the parts between. A sub-file reference must stand before PLI END; without a colour its colour is used. The accepted argument counts are the part alone; with colour; plus scale; plus field of view; plus the two camera angles; and from there a target, a rotation with its keyword, or both. |
Insertions and space
Line after 0 !LPUB | Meaning |
|---|---|
INSERT PAGE, INSERT COVER_PAGE [FRONT | BACK] | A blank page or a cover page. The step holding it may not contain parts. |
INSERT MODEL, INSERT DISPLAY_MODEL | A view of the finished model, or a display view. |
INSERT BOM [FOR_SUBMODEL] | The bill of materials. |
INSERT PICTURE "file" [SCALE factor] | A picture. |
INSERT TEXT "text" "font" "colour" | A text. RICH_TEXT and HTML_TEXT take only the text. |
INSERT TEXT PLACEMENT … | Where the text goes; also for RICH_TEXT and HTML_TEXT. LOCAL may follow PLACEMENT. |
INSERT ARROW hx hy tx ty depth px py | An arrow: head, tail, hafting depth, hafting tip. |
INSERT ROTATE_ICON | The icon telling the builder to turn the model. |
… OFFSET x y | May follow the page, model and icon insertions. |
RESERVE number | Keeps space free in a step group or callout; 0 to 1000000. |
Build modifications
A step can show the model with a temporary change:
0 !LPUB BUILD_MOD BEGIN "key"
… lines as modified
0 !LPUB BUILD_MOD END_MOD
… lines as originally
0 !LPUB BUILD_MOD END
Later steps use 0 !LPUB BUILD_MOD APPLY "key" to show the modification and
0 !LPUB BUILD_MOD REMOVE "key" to show the original again.
BEGIN, APPLY and REMOVE require the key; nested
modifications need keys. BUILD_MOD_ENABLED switches the facility.
Pages, callouts and step groups
Lines after 0 !LPUB | Meaning |
|---|---|
MULTI_STEP BEGIN, MULTI_STEP DIVIDER, MULTI_STEP END | Several steps on one page, with an optional divider between rows or columns. |
CALLOUT BEGIN, CALLOUT DIVIDER, CALLOUT END | The steps between are drawn in a box beside the step that uses the sub-model. |
START_STEP_NUMBER n, START_PAGE_NUMBER n | First numbers, 1 to 10000. |
Keyword tree of the settings
The rest of 0 !LPUB is layout and rendering settings. These are the
keywords registered under each branch; what each one
takes follows below.
Top level
PAGE ASSEM CALLOUT MULTI_STEP STEP_NUMBER PLI BOM BUILD_MOD BUILD_MOD_ENABLED
FINAL_MODEL_ENABLED COVER_PAGE_MODEL_VIEW_ENABLED LOAD_UNOFFICIAL_PARTS_IN_EDITOR
SET_SUBMODEL_SUBSTITUTE_AS_UNOFFICIAL_PART POINTER_BASE REMOVE RESERVE
CAMERA_DEFAULT_DISTANCE_FACTOR PART RESOLUTION INSERT INCLUDE NOSTEP FADE_STEPS
HIGHLIGHT_STEP PREFERRED_RENDERER SUBMODEL_DISPLAY ROTATE_ICON STUD_STYLE HIGH_CONTRAST
PARSE_NOSTEP AUTOMATE_EDGE_COLOR CONSOLIDATE_INSTANCE_COUNT
CONSOLIDATE_INSTANCE_COUNT_BY_COLOR MODEL_STEP_NUMBER CONTINUOUS_STEP_NUMBERS STEP_PLI
START_STEP_NUMBER START_PAGE_NUMBER
and, in the forms of LeoCAD, GROUP LIGHT CAMERA MODEL PIECE SYNTH.
PAGE
SIZE ORIENTATION MARGINS BORDER BACKGROUND DISPLAY_PAGE_NUMBER
TOGGLE_PAGE_NUMBER_PLACEMENT NUMBER SUBMODEL_INSTANCE_COUNT SUBMODEL_BACKGROUND_COLOR
POINTER POINTER_ATTRIBUTE TEXT_PLACEMENT ENABLE_TEXT_PLACEMENT SCENE
SUBMODEL_INSTANCE_COUNT_OVERRIDE PAGE_HEADER PAGE_FOOTER DOCUMENT_TITLE_FRONT
DOCUMENT_TITLE_BACK MODEL_ID MODEL_DESCRIPTION MODEL_PARTS DOCUMENT_AUTHOR_FRONT
DOCUMENT_AUTHOR_BACK DOCUMENT_AUTHOR PUBLISH_DESCRIPTION PUBLISH_URL PUBLISH_URL_BACK
PUBLISH_EMAIL PUBLISH_EMAIL_BACK PUBLISH_COPYRIGHT_BACK PUBLISH_COPYRIGHT
DOCUMENT_LOGO_FRONT DOCUMENT_LOGO_BACK DOCUMENT_COVER_IMAGE LEGO_DISCLAIMER APP_PLUG
APP_PLUG_IMAGE MODEL_CATEGORY
PAGE SCENE orders the items on a page; its names are
CSI_ANNOTATION CSI_ANNOTATION_PART ASSEM CALLOUT CALLOUT_INSTANCE CALLOUT_POINTER
CALLOUT_UNDERPINNING DIVIDER DIVIDER_ITEM DIVIDER_LINE DIVIDER_POINTER POINTER_GRABBER
PLI_GRABBER SUBMODEL_GRABBER PICTURE TEXT MULTI_STEP MULTI_STEPS ATTRIBUTE_PIXMAP
ATTRIBUTE_TEXT PAGE PAGE_NUMBER PAGE_POINTER PLI_ANNOTATION PLI PLI_INSTANCE
POINTER_SEG_FIRST POINTER_HEAD POINTER_SEG_SECOND POINTER_SEG_THIRD ROTATE_ICON RESERVE
STEP_NUMBER SUBMODEL_DISPLAY SUBMODEL_INSTANCE SUBMODEL_INST_COUNT PLI_PART
PLI_PART_GROUP STEP_RECTANGLE.
ASSEM (the step image)
MARGINS PLACEMENT MODEL_SCALE LDVIEW_PARMS LDVIEW_ENV_VARS LDGLITE_PARMS
LDGLITE_ENV_VARS POVRAY_PARMS POVRAY_ENV_VARS BLENDER_PARMS BLENDER_ENV_VARS STUD_STYLE
HIGH_CONTRAST AUTOMATE_EDGE_COLOR FADE_STEPS HIGHLIGHT_STEP SHOW_STEP_NUMBER ANNOTATION
IMAGE_SIZE CAMERA_FOV CAMERA_ZNEAR CAMERA_ZFAR CAMERA_ANGLES CAMERA_DISTANCE
CAMERA_ORTHOGRAPHIC CAMERA_NAME CAMERA_TARGET CAMERA_POSITION CAMERA_UPVECTOR
PREFERRED_RENDERER
PLI and BOM
PLACEMENT CONSTRAIN BORDER BACKGROUND MARGINS INSTANCE_COUNT ANNOTATE
MODEL_SCALE SHOW LDVIEW_PARMS LDVIEW_ENV_VARS LDGLITE_PARMS LDGLITE_ENV_VARS
POVRAY_PARMS POVRAY_ENV_VARS INCLUDE_SUBMODELS SUBMODEL_BACKGROUND_COLOR
SHOW_INDIVIDUAL_PARTS PART PART_GROUP STUD_STYLE HIGH_CONTRAST AUTOMATE_EDGE_COLOR BEGIN
END SORT SORT_BY SORT_ORDER ANNOTATION PART_ELEMENTS RECTANGLE_STYLE CIRCLE_STYLE
SQUARE_STYLE ELEMENT_STYLE DEFAULT_STYLE IMAGE_SIZE CAMERA_FOV CAMERA_ZNEAR CAMERA_ZFAR
CAMERA_ANGLES CAMERA_TARGET CAMERA_POSITION CAMERA_UPVECTOR CAMERA_DISTANCE
PART_GROUP_ENABLE PREFERRED_RENDERER. PLI also has
SUBMODEL_FONT SUBMODEL_FONT_COLOR PART_ROTATION CAMERA_ORTHOGRAPHIC.
SORT_BY is marked deprecated.
CALLOUT and MULTI_STEP
Both: MARGINS STEP_NUMBER SEPARATOR PLACEMENT FREEFORM ALLOC STEPS
DIVIDER_POINTER DIVIDER_POINTER_ATTRIBUTE SUBMODEL_FONT SUBMODEL_FONT_COLOR BEGIN
DIVIDER END ASSEM PLI SUBMODEL_DISPLAY ROTATE_ICON.
CALLOUT only: BORDER INSTANCE_COUNT BACKGROUND
SUBMODEL_BACKGROUND_COLOR POINTER POINTER_ATTRIBUTE.
MULTI_STEP only: SHOW_GROUP_STEP_NUMBER COUNT_GROUP_STEPS
ADJUST_ON_ITEM_OFFSET JUSTIFY_Y_AXIS_OUTSIDE_PLACEMENT_MULTIPLE_RANGES
STEP_SIZE.
Others
| Branch | Keywords |
|---|---|
SUBMODEL_DISPLAY | SHOW_STEP_NUM PLACEMENT CONSTRAIN BORDER BACKGROUND MARGINS INSTANCE_COUNT INCLUDE_SUBMODELS MODEL_SCALE SHOW SHOW_TOP_MODEL SHOW_SUBMODEL_IN_CALLOUT STUD_STYLE HIGH_CONTRAST AUTOMATE_EDGE_COLOR SHOW_INSTANCE_COUNT LDVIEW_PARMS LDVIEW_ENV_VARS LDGLITE_PARMS LDGLITE_ENV_VARS POVRAY_PARMS POVRAY_ENV_VARS SUBMODEL_BACKGROUND_COLOR PART SUBMODEL_ROTATION CAMERA_FOV CAMERA_ZNEAR CAMERA_ZFAR CAMERA_ANGLES CAMERA_DISTANCE CAMERA_TARGET CAMERA_POSITION CAMERA_UPVECTOR PREFERRED_RENDERER |
ROTATE_ICON | SIZE ARROW PLACEMENT BORDER BACKGROUND MARGINS DISPLAY SCALE |
FADE_STEPS | ENABLED SETUP COLOR OPACITY LPUB_FADE |
HIGHLIGHT_STEP | ENABLED SETUP COLOR LINE_WIDTH LPUB_HIGHLIGHT |
LIGHT | TYPE NAME AREA_SHAPE COLOR POSITION TARGET_POSITION ROTATION SHADOWLESS POV_RAY AREA_SIZE AREA_SIZE_X AREA_SIZE_Y SPOT_CONE_ANGLE SPOT_BLEND SPOT_PENUMBRA_ANGLE POVRAY_POWER POVRAY_FADE_POWER POVRAY_FADE_DISTANCE POVRAY_SPOT_TIGHTNESS POVRAY_AREA_GRID_X POVRAY_AREA_GRID_Y POVRAY_AREA_SIZE_X POVRAY_AREA_SIZE_Y BLENDER_POWER BLENDER_DIFFUSE BLENDER_SPECULAR BLENDER_CUTOFF_DISTANCE BLENDER_SUN_ANGLE BLENDER_POINT_RADIUS BLENDER_SPOT_RADIUS |
LPub3D also writes colour definitions for faded and highlighted steps as
0 !COLOUR lines named LPub3D_Fade_name and
LPub3D_Highlight_name, and wraps lines in
0 !FADE percent colour … 0 !FADE and
0 !SILHOUETTE width colour …
0 !SILHOUETTE.
Value forms of the settings
The syntax help built into the parser gives these forms for what follows a setting’s
keywords. Generic settings take an integer, a decimal, two decimals, three or nine
decimals, one quoted string or several, or TRUE | FALSE. In the table
colour is a quoted colour name or "#RRGGBB", and
place one of TOP BOTTOM LEFT RIGHT CENTER TOP_LEFT TOP_RIGHT
BOTTOM_LEFT BOTTOM_RIGHT.
| Kind of setting | Value |
|---|---|
| Placement | place, then what it is placed against: PAGE, ASSEM (INSIDE | OUTSIDE), MULTI_STEP, STEP_NUMBER, PLI, SUBMODEL_DISPLAY, ROTATE_ICON or CALLOUT |
| Background | TRANSPARENT | SUBMODEL_BACKGROUND_COLOR | COLOR colour | GRADIENT mode spread type sizeX sizeY angle "points" "stops" | PICTURE "file" [STRETCH] |
| Border | NONE 0 | HIDDEN 0 colour thickness | SQUARE line colour thickness | ROUND line colour thickness radius, followed by MARGINS x y; line is 0 to 5 |
| Pointer | place location x1 y1 [x2 y2 x3 y3 x4 y4] base [segments] [BASE_TOP | BASE_BOTTOM | BASE_LEFT | BASE_RIGHT] |
| Pointer attributes | LINE | BORDER, a style NONE SOLID DASH DOT DASH_DOT DASH_DOT_DOT, COLOR "#RRGGBB" WIDTH w [HIDE_TIP TRUE | FALSE] [ID n] [BASE_…]; or TIP WIDTH w HEIGHT h [ID n] |
| Step image annotation icon | place, then icon offset x y, part offset x y and part size x y in pixels, an LDraw colour code and a part name without extension |
| Free form | FALSE, or STEP_NUMBER | ASSEM | PLI | ROTATE_ICON followed by LEFT | RIGHT | TOP | BOTTOM | CENTER |
| Constraint | AREA | SQUARE | WIDTH n | HEIGHT n | COLS n |
| Allocation; alignment | HORIZONTAL | VERTICAL; LEFT | CENTER | RIGHT |
| Camera angles | latitude longitude, or FRONT BACK TOP BOTTOM LEFT RIGHT, HOME [a b] or LAT_LON a b |
| Picture fill | ASPECT | STRETCH | TILE |
| Step justification | JUSTIFY_LEFT | JUSTIFY_CENTER | JUSTIFY_CENTER_HORIZONTAL | JUSTIFY_CENTER_VERTICAL |
| Page orientation; page size | PORTRAIT | LANDSCAPE; width height, then optionally the orientation and a quoted size id in either order; or "size id" with an optional orientation before or after it. A size id must name a known page size; custom alone is refused. |
| Instance counting | AT_TOP | AT_MODEL | AT_STEP | TRUE | FALSE |
| Separator | [PAGE_LENGTH | CUSTOM_LENGTH length] THICKNESS n colour MARGINS x y |
| Page item order | BRING_TO_FRONT | SEND_TO_BACK x y |
| Preferred renderer | NATIVE | LDGLITE | LDVIEW [SINGLE_CALL | SINGLE_CALL_EXPORT_LIST] | POVRAY [LDVIEW_POV_GENERATOR] |
| Stud style | PLAIN THIN_LINE_LOGO OUTLINE_LOGO SHARP_TOP_LOGO ROUNDED_TOP_LOGO FLATTENED_LOGO HIGH_CONTRAST HIGH_CONTRAST_WITH_LOGO or a number 0 to 7 |
| Colour | "#[AA]RRGGBB" or four numbers 0 to 255 |
| Fade colour | A quoted LDraw colour name or "#[AA]RRGGBB" (also with 0x), then [USE TRUE | FALSE] |
| Arrow head; arrow end | tipX haftingInsideX haftingOutsideX haftingOutsideY; SQUARE | ROUND |
| Callout begin | [ASSEMBLED | ROTATED | WHOLE] |
| Resolution | n DPI | DPCM |
| Parts list group offset | part colour OFFSET x y |
What each keyword takes
Bool is TRUE | FALSE, int a whole number,
num a decimal, pair two decimals, xyz three decimals,
string one quoted string and strings any number of them.
Margins are two decimals from 0 to 100, across and down. A name in italics
is a group of sub-keywords from the second table; the other forms are those of the
table above.
A font is one quoted string, which LPub3D hands to the Qt toolkit’s font reader; it
has no sub-keywords. The default is "Arial,64,-1,255,75,0,0,0,0,0".
Qt 5.15 lists the fields of such a description as family, point size, pixel size,
style hint, weight, style, underline, strike-out, fixed pitch, a field that is always
0, capitalisation, letter spacing, word spacing, stretch, style strategy and style
name; the default string holds the first ten.
Directly under !LPUB
| Keyword | Value | Sets |
|---|---|---|
STEP_NUMBER | placed number | The step number. |
START_STEP_NUMBER, START_PAGE_NUMBER | int | First numbers. |
CONTINUOUS_STEP_NUMBERS | bool | Step numbers that run on instead of restarting. |
MODEL_STEP_NUMBER | int | A step count compared with a model’s steps while numbering continuously. |
CONSOLIDATE_INSTANCE_COUNT | AT_TOP | AT_MODEL | AT_STEP | TRUE | FALSE | Where repeated sub-models are counted together. |
CONSOLIDATE_INSTANCE_COUNT_BY_COLOR | bool | Whether that count is kept per colour. |
STEP_PLI PER_STEP | bool | A parts list for each single step outside step groups and callouts. |
BUILD_MOD_ENABLED, COVER_PAGE_MODEL_VIEW_ENABLED, FINAL_MODEL_ENABLED | bool | Build modifications, the model view on the cover, the final model page. |
PARSE_NOSTEP | bool | Whether a single step containing NOSTEP or BUFEXCHG is parsed. |
SET_SUBMODEL_SUBSTITUTE_AS_UNOFFICIAL_PART | bool | Treats a substituted sub-model as an unofficial part. |
LOAD_UNOFFICIAL_PARTS_IN_EDITOR | ENABLE_SETTING bool, ENABLED bool | Loading unofficial parts into the command editor. |
CAMERA_DEFAULT_DISTANCE_FACTOR | num | Default camera distance factor of the built-in renderer. |
PREFERRED_RENDERER | renderer form | The program that draws the images. |
RESOLUTION | int DPI | DPCM | Page resolution and unit. |
STUD_STYLE | stud style | How studs are drawn. |
HIGH_CONTRAST | high contrast | Colours of the high-contrast style. |
AUTOMATE_EDGE_COLOR | edge colour | Computed edge colours. |
FADE_STEPS, HIGHLIGHT_STEP | fade, highlight | Fading earlier steps, highlighting the current one. |
INCLUDE | string | A file of further commands. |
RESERVE | num | Space kept free. |
NOSTEP | nothing | See above. |
POINTER_BASE | PLACEMENT placement, BORDER border, BACKGROUND background, MARGINS margins | The box at the base of pointers. |
SUBMODEL_DISPLAY, ROTATE_ICON | branches below |
Groups of sub-keywords
| Group | Sub-keywords and values |
|---|---|
| number | FONT string (font), FONT_COLOR string, MARGINS margins |
| placed number | number and PLACEMENT placement |
| text item | FONT string (font), COLOR string, MARGINS margins, PLACEMENT placement, CONTENT string, DISPLAY bool |
| image item | PLACEMENT placement, BORDER border, MARGINS margins, SCALE num, FILE string, DISPLAY bool, FILL picture fill |
| fade | ENABLED bool, SETUP bool (the project uses fading somewhere), COLOR fade colour, OPACITY int, LPUB_FADE bool (LPub3D’s own fading) |
| highlight | ENABLED bool, SETUP bool, COLOR string, LINE_WIDTH int, LPUB_HIGHLIGHT bool (LPub3D’s own highlighting) |
| edge colour | ENABLE bool, CONTRAST num, SATURATION num |
| high contrast | COLOR_LIGHT_DARK_INDEX num; STUD_CYLINDER_COLOR, EDGE_COLOR, BLACK_EDGE_COLOR, DARK_EDGE_COLOR each a colour, each with an …_ENABLED bool |
| annotation style | MARGINS margins, BORDER border, BACKGROUND background, FONT string (font), FONT_COLOR string, SIZE pair, STYLE int |
PAGE
| Keyword | Value |
|---|---|
SIZE, ORIENTATION | page size, page orientation |
MARGINS, BORDER, BACKGROUND | margins, border, background |
DISPLAY_PAGE_NUMBER | bool |
TOGGLE_PAGE_NUMBER_PLACEMENT | bool: mirrors the page number’s place on even-numbered pages |
NUMBER, SUBMODEL_INSTANCE_COUNT | placed number |
SUBMODEL_INSTANCE_COUNT_OVERRIDE | int: the instance count to show instead of the counted one |
SUBMODEL_BACKGROUND_COLOR | strings: page colours for the levels of sub-models, four by default |
POINTER, POINTER_ATTRIBUTE | pointer, pointer attributes |
ENABLE_TEXT_PLACEMENT | placement of inserted text |
TEXT_PLACEMENT | bool: enables that placement (the two names read the other way round) |
SCENE item | page item order, for each item name listed above |
PAGE_HEADER, PAGE_FOOTER | SIZE pair, PLACEMENT placement |
DOCUMENT_TITLE_FRONT, …_BACK, MODEL_ID, MODEL_DESCRIPTION, MODEL_PARTS, MODEL_CATEGORY, DOCUMENT_AUTHOR, …_FRONT, …_BACK, PUBLISH_DESCRIPTION, PUBLISH_URL, …_BACK, PUBLISH_EMAIL, …_BACK, PUBLISH_COPYRIGHT, …_BACK, LEGO_DISCLAIMER, APP_PLUG | text item |
DOCUMENT_LOGO_FRONT, …_BACK, DOCUMENT_COVER_IMAGE, APP_PLUG_IMAGE | image item |
ASSEM, CALLOUT ASSEM and MULTI_STEP ASSEM
The two nested forms take the same keywords for callouts and step groups, except the
…_PARMS and …_ENV_VARS pairs, SHOW_STEP_NUMBER
and ANNOTATION, which belong to the plain ASSEM.
| Keyword | Value |
|---|---|
PLACEMENT, MARGINS | placement, margins |
MODEL_SCALE, CAMERA_FOV, CAMERA_ZNEAR, CAMERA_ZFAR, CAMERA_DISTANCE | num |
CAMERA_ANGLES | camera angles |
CAMERA_TARGET, CAMERA_POSITION, CAMERA_UPVECTOR | xyz |
CAMERA_ORTHOGRAPHIC | bool |
CAMERA_NAME | string |
IMAGE_SIZE | pair |
STUD_STYLE, HIGH_CONTRAST, AUTOMATE_EDGE_COLOR, FADE_STEPS, HIGHLIGHT_STEP, PREFERRED_RENDERER | as at the top level |
LDVIEW_PARMS, LDGLITE_PARMS, POVRAY_PARMS, BLENDER_PARMS and the matching …_ENV_VARS | string: extra arguments and environment for the renderer |
SHOW_STEP_NUMBER | bool |
ANNOTATION | part annotations on the step image: PLACEMENT placement; DISPLAY, AXLE, BEAM, CABLE, CONNECTOR, EXTENDED, HOSE, PANEL bool (shown at all, and per kind of part); ICON annotation icon |
PLI, BOM and SUBMODEL_DISPLAY
These three share most of their keywords; the lists above say which each registers.
The camera, image size, stud style, edge colour and renderer keywords take the same
values as under ASSEM.
| Keyword | Value |
|---|---|
PLACEMENT, BORDER, BACKGROUND, MARGINS | placement, border, background, margins |
CONSTRAIN | constraint on the box |
MODEL_SCALE | num |
SHOW | bool: whether the list or view appears |
INSTANCE_COUNT, ANNOTATE | number: format of the counts and of annotation text |
PART MARGINS | margins round each part image |
PART_GROUP, PART_GROUP_ENABLE | parts list group offset; bool |
INCLUDE_SUBMODELS | bool: sub-models appear in the list |
SHOW_INDIVIDUAL_PARTS | bool: each instance listed separately |
SUBMODEL_BACKGROUND_COLOR, SUBMODEL_FONT_COLOR | strings |
SUBMODEL_FONT | strings (fonts) |
PART_ROTATION, SUBMODEL_ROTATION | x y z ABS | REL | ADD |
SORT | bool |
SORT_ORDER | PRIMARY, SECONDARY, TERTIARY and each with _DIRECTION: string |
SORT_BY SORT_OPTION | string; deprecated |
ANNOTATION | bools: DISPLAY, USE_TITLE, USE_FREE_FORM, USE_TITLE_AND_FREE_FORM, FIXED_ANNOTATIONS (where the text comes from), ENABLE_STYLE, and AXLE, BEAM, CABLE, CONNECTOR, ELEMENT, EXTENDED, HOSE, PANEL |
PART_ELEMENTS | bools: DISPLAY, LEGO, BRICKLINK, USER_ELEMENTS_FILE, USER_ELEMENTS_USE_LDRAW_KEY, LOCAL_LEGO_ELEMENTS_FILE (which element numbers are shown) |
RECTANGLE_STYLE, CIRCLE_STYLE, SQUARE_STYLE, ELEMENT_STYLE, DEFAULT_STYLE | annotation style |
SHOW_STEP_NUM (SUBMODEL_DISPLAY) | int: marks the first step number of a group under continuous numbering |
SHOW_INSTANCE_COUNT, SHOW_TOP_MODEL, SHOW_SUBMODEL_IN_CALLOUT (SUBMODEL_DISPLAY) | bool |
CALLOUT and MULTI_STEP
| Keyword | Value |
|---|---|
MARGINS, PLACEMENT, BORDER, BACKGROUND | margins, placement, border, background |
STEP_NUMBER, CALLOUT INSTANCE_COUNT | placed number |
SEPARATOR | separator: the line between steps |
FREEFORM, ALLOC | free form; allocation: steps stacked across or down |
STEPS | step justification |
POINTER, DIVIDER_POINTER | pointer |
POINTER_ATTRIBUTE, DIVIDER_POINTER_ATTRIBUTE | pointer attributes |
SUBMODEL_FONT, SUBMODEL_FONT_COLOR, SUBMODEL_BACKGROUND_COLOR | strings |
PLI | PLACEMENT placement, MARGINS margins, PER_STEP bool (a parts list for every step) |
SUBMODEL_DISPLAY | PLACEMENT placement, MARGINS margins, SHOW bool (a preview of the sub-model at the first step) |
ASSEM, ROTATE_ICON | branches above and below |
BEGIN, DIVIDER, END | CALLOUT BEGIN takes the callout form; the others no value |
SHOW_GROUP_STEP_NUMBER, COUNT_GROUP_STEPS | bool (MULTI_STEP) |
ADJUST_ON_ITEM_OFFSET | bool: the row or column moves when a callout or rotate icon is dragged |
JUSTIFY_Y_AXIS_OUTSIDE_PLACEMENT_MULTIPLE_RANGES | bool: that justification where page dividers make several ranges |
STEP_SIZE | pair |
ROTATE_ICON, REMOVE, PART and the LeoCAD forms
| Keyword | Value |
|---|---|
ROTATE_ICON SIZE, SCALE | pair; num |
ROTATE_ICON ARROW, BORDER | border (for the arrow, its line) |
ROTATE_ICON BACKGROUND, MARGINS, PLACEMENT, DISPLAY | background, margins, placement, bool |
REMOVE GROUP, PART, NAME | string |
PART BEGIN IGN, PART END; PLI BEGIN IGN, SUB | see above |
GROUP BEGIN, GROUP END, MODEL, PIECE, CAMERA, SYNTH | passed on in LeoCAD’s form |
LIGHT TYPE, NAME, AREA_SHAPE | string |
LIGHT COLOR, POSITION, TARGET_POSITION | xyz |
LIGHT ROTATION | nine decimals, a 3 × 3 matrix |
LIGHT POVRAY_AREA_GRID_X, …_Y | int |
LIGHT POV_RAY, SHADOWLESS | no value: flags |
every other LIGHT keyword listed above | num |
LPub 2 commands
Kevin Clague’s earlier LPub 2 wrote 0 LPUB lines without the
!, and its values differ from the ones above even where a keyword
survives. The following is the reading of the last source in the program’s CVS
repository. Sizes, margins and thicknesses are whole pixels. A colour is a
number, decimal or 0x hexadecimal, handed to Windows as a colour value,
so the hexadecimal digits run blue, green, red.
Shared value forms
| Form | Meaning |
|---|---|
MARGINS x y | Horizontal and vertical space around the thing named. Starts as 6 6. |
BORDER SQUARE colour thickness | A square-cornered frame. |
BORDER ROUND colour thickness radius | A frame with rounded corners of that radius. |
BORDER MARGINS x y | The space kept between the frame and what is placed against it. |
BORDERLESS | No frame. The source sets that, then reports a missing end of line; in the PLI, BOM and CALLOUT branches the word is not reached at all, so this version stops with an error wherever it is written. |
BACKGROUND TRANS | No fill. This is also the starting value; the source’s comparison does not allow for the line end, so a written line is taken as a picture named TRANS. |
BACKGROUND colour | A solid fill. |
BACKGROUND [STRETCH] file | A picture, stretched to the area with STRETCH. A name with spaces is quoted. |
FONT [BOLD] [ITALIC] name | The font of a number. |
SEPARATOR thickness colour | The line drawn between rows or columns of steps. The width is read first. |
SEPARATOR MARGINS x y | Space around that line. |
HORIZONTAL, VERTICAL | The direction in which steps are laid out in a callout or step group. Vertical to start with. |
Placement
PLACEMENT place [justify] against
[INSIDE | OUTSIDE], or PLACEMENT OFFSET x y.
place is TOP, BOTTOM, LEFT,
RIGHT, one of the four corners such as TOP_LEFT, or
CENTER. Outside an item, TOP and BOTTOM are
followed by LEFT, CENTER or RIGHT, and
LEFT and RIGHT by TOP, CENTER or
BOTTOM. against is PAGE (always inside),
PLI or MULTI_STEP (always outside), ASSEM (the
step image; outside unless INSIDE is written) or CALLOUT.
The two OFFSET numbers are fractions of the width and height of what the
item is placed against, added to the chosen position.
Branches
Line after 0 LPUB | Meaning |
|---|---|
PAGE SIZE x y | The size of the page image. |
PAGE MARGINS, PAGE BORDER, PAGE BACKGROUND | The shared forms above. The layout code takes the distance of items from the page edges from PAGE BORDER MARGINS. |
PAGE PLI YES | YES shows parts lists on the pages; any other word hides them. |
PAGE NUMBER MARGINS, PAGE NUMBER FONT, PAGE NUMBER PLACEMENT | The page number. |
ASSEM MARGINS, ASSEM PLACEMENT | The step image. |
STEP_NUMBER FONT, STEP_NUMBER PLACEMENT | The step number. |
PLI MARGINS | Space between the entries of a parts list. |
PLI PART MARGINS | Space between a part’s picture and its count. |
PLI PLACEMENT, PLI BORDER, PLI BACKGROUND | The parts list box. |
PLI INSTANCE_COUNT, PLI ANNOTATE | FONT or PLACEMENT of the count and of the annotation. |
PLI CONSTRAIN SQUARE, AREA | The list is packed as near to square as it can be, or into the smallest area. Square to start with. |
PLI CONSTRAIN WIDTH n, HEIGHT n, COLS n | A limit in pixels on the width or height, or a number of columns. |
PLI BEGIN IGN … PLI END | The parts between are left out of the list. |
PLI BEGIN SUB [colour] file … PLI END | The list shows the named part in place of the parts between. |
BOM MARGINS, PART MARGINS, PLACEMENT, BORDER, BACKGROUND, ANNOTATE, CONSTRAIN | The same for the bill of materials, which spells the count BOM INSTANCE. |
BOM BEGIN IGN … BOM END | The parts between are left out of the bill of materials. |
BOM SORT WIDTH | Entries are ordered by picture width, then height, part and colour. This is also what happens without the line. |
BOM PACK SUBS | The packer may fit further parts into the space left beside a part, as extra small columns. Parts lists always do this and a bill of materials does by default. |
CALLOUT BEGIN, CALLOUT DIVIDER, CALLOUT END | A callout; DIVIDER ends the current row or column of its steps and starts the next. BEGIN clears the pointer list. |
CALLOUT MARGINS, PLACEMENT, BORDER, BACKGROUND, SEPARATOR, HORIZONTAL, VERTICAL, STEP_NUMBER | The callout box, its steps and their numbers. |
CALLOUT INSTANCE_COUNT FONT, PLACEMENT | The label saying how many times the callout is built. The error text also names MARGINS, but this version takes only the other two. |
CALLOUT POINTER place loc x y | An arrow. place is a side or corner of the callout box, loc the position along that side from 0 to 1 (not used for a corner), and x, y the tip as fractions of the width and height of the step image. |
CALLOUT POINTER BASE n | The base of the arrow reaches n pixels to each side of its starting point. |
MULTI_STEP BEGIN, DIVIDER, END, MARGINS, SEPARATOR, STEP_NUMBER, HORIZONTAL, VERTICAL | Several steps on one page, with the same dividing and layout rules. |
GROUP REMOVE name | Takes the parts of the named MLCad group out of the model as built so far: each 0 MLCAD BTG name line and the part line after it are dropped. A name with spaces is quoted. |
PLIST is the older spelling of PLI, marked as deprecated
in the source. 0 LPUB END appears in the LDraw wiki’s list, but neither
LPub 2, LPub4 nor LPub3D defines it, and the LPub 2 source stops with a parse error
on it. The BI BEGIN GREYED lines are described with the
other older forms.
Sources
- LPub 2 CVS repository (GPL):
parse_attrib.cppandparse_attrib.h(the commands),constr.cpp,pli.cppandlayout.cpp(what they do) - LPub4 source (GPL):
meta.cpp - LPub3D source:
meta.handmeta.cpp(keyword tree, value types and parsing),traverse.cpp,formatpage.cppand the settings dialogs (what the settings do) - Qt 5.15 QFont: the fields of a font description