The root
A project is UTF-8 XML with a <LightBurnProject> root. Its attributes include AppVersion (the LightBurn version that saved it), FormatVersion (1 for .lbrn2, 0 for the legacy .lbrn), MirrorX/MirrorY and sometimes DeviceName. Children include an optional <Thumbnail Source="…"> holding a base64 PNG preview, <VariableText>, <UIPrefs>, the cut settings, the shapes and <Notes>.
Cut settings
Each layer is a <CutSetting type="…"> (or <CutSetting_Img type="Image"> for image layers) whose children each carry a Value attribute: index, name, speed (mm/s), maxPower, minPower, numPasses, interval, priority, doOutput and many more. Types seen in real files are Cut (Line), Scan (Fill), Scan+Cut, Image and Tool. .lbrn2 omits values equal to the defaults, so a reader must supply them. Shapes refer to a layer by CutIndex; indexes 30 and 31 are tool layers T1 and T2.
Shapes and the XForm
Each <Shape Type="…"> has an <XForm> of six numbers, a b c d e f, mapping a local point to x' = a·x + c·y + e and y' = b·x + d·y + f. Units are millimetres and Y points up, so SVG output needs a flip. Groups nest their children inside <Children>, and the transforms compose.
- Rect:
W,Hand corner radiusCr, centred on the origin. - Ellipse: radii
Rx,Ry, centred on the origin. - Polygon:
Nsides with radiiRx,Ry; in sample files the first corner sits on the +X axis. - Text:
Str,Font, heightHand alignment, usually with a<BackupPath>holding its outline as a path. The backup path's XForm is relative to the text's parent, not to the text. - Bitmap:
W,Hand base64Data(PNG in the samples we have seen). W and H are the picture's size at 96 dpi; the XForm scales it to its placed size. AFileattribute may hold the original path on the designer's computer.
Paths: VertList and PrimList
<Shape Type="Path" CutIndex="0" VertID="3" PrimID="1">
<XForm>1 0 0 1 0 0</XForm>
<VertList>V0 0c0x1c1x1V10 0c0x15c0y5c1x1V10 10c0x1c1x10c1y5</VertList>
<PrimList>L0 1B1 2L2 0</PrimList>
</Shape>
Each V starts a vertex with x and y. c0x/c0y is the handle leaving the vertex and c1x/c1y the handle arriving at it. A lone c0x1 or c1x1 with no matching y is a marker for "no handle", not a coordinate. In the PrimList, L a b is a line and B a b a cubic Bézier from vertex a (using its c0) to vertex b (using its c1). A primitive that doesn't start where the last one ended begins a new subpath. A PrimList of just LineClosed means straight lines through every vertex, back to the first.
Copies can omit their lists and refer to earlier ones: a shape with VertID="3" and no VertList uses the vertices stored under that ID, and the same goes for PrimID.
The legacy .lbrn format
.lbrn files share the structure but write every setting, and they are much larger. Our sample .lbrn files contain only rectangles and text, so path encoding in .lbrn is the least tested part of this reader.
Prior work
Open-source projects that read the format include lbrn2-to-svg and lbrnts, both MIT licensed. Kerfview's reader is its own code, checked against openly licensed sample files and against the previews LightBurn saves inside them.