LBRN2 File Documentation

Thanks. I had some further issues with my DXF files as I found the origin point is not always in the corner of the DXF file as I had expected. I was able to create the transforms and cut settings I require and edit them into the XML of the lbrn2 file successfully.

For completeness, here is what worked for me:

My laser is set with the origin at the top right corner and my lbrn2 files have the following as the first two lines (note: I’m adding spaces after the < to make it display correctly on the forum):

< ?xml version="1.0" encoding="UTF-8"?>
< LightBurnProject AppVersion="0.9.24" FormatVersion="1" MaterialHeight="0" MirrorX="True" MirrorY="True">

UIPrefs correspond to the selections made in the Optimization Settings dialog, with the ByLayer, ByGroup, ByPriority showing their selected order number (starting at 0) or showing -1 if not included.

CutSetting include an entry for each cut layer (colour) available in the file. The index value is the one that is important as it is referenced in the shapes data later to connect the shape with the colour/layer.

Shape is a hierarchy of groups, paths, polygons and rectangles (Rect). Objects will have properties that define them, such as a rectangle (Rect) has width (W, height (H) and corner radius (Cr) values with a reference point at the centre.

Each shape object or group has an XForm value that corresponds to a transformation matrix that is applied to all the items below that in the hierarchy. (For example, a rectangle in a group will first have the properties of the rectangle applied, then have the XForm of the rectangle applied, then have the XForm of the group it is in applied).

The XForm can be translated into an affine transformation using this layout:

"""
Translation matrix is encoded in <XForm> values as follows:

<XForm>a b c d e f</XForm>

⎡x'⎤   ⎡a c e⎤ ⎡x⎤
⎢y'⎥ = ⎢b d f⎥ ⎢y⎥
⎣1 ⎦   ⎣0 0 1⎦ ⎣1⎦

where x and y are the original coordinates and x’ and y’ are the transformed coordinates.

As an example, you can apply a translation of x and y with:

⎡1 0 x⎤
⎢0 1 y⎥
⎣0 0 1⎦

and a rotation of t radians with:

⎡cos(t) -sin(t)  0⎤
⎢sin(t)  cos(t)  0⎥
⎣    0      0    1⎦

and a reflection along the vertical axis with

⎡-1 0 0⎤
⎢0  1 0⎥
⎣0  0 1⎦

These can also be combined with matrix multiplication rules into a single matrix with multiple actions. Look at the wikipedia page for more examples.

Lastly, the VertList is explained by Oz here but to add to that description:

VertList is a list of vertices that can be split into chunks with this form
(replace the braces with numerical values in mm):
V{x coordinate} {y coordinate}{control point info}
Note there is a space between the x and y coordinate, but no space between vertices so split them at the V.

The control point info depends on if the point is a line or a bezier curve and can include some or all of this info:
c0x{left handle x point}c0y{left handle y point}c1x{right handle x point}c1y{right handle y point}S

For example, a straight line will look like this with its control point info:
V10 20c0x1c1x1
and a bezier curve from a point could look like this:
V10 20c0x10c0y24c1x10c1y12S
The presence of the S at the end indicates it is a smooth line at the point.

PrimList is a list of lines that join the corresponding vertices with this form:
{line type}{start} {end}
Where start and end are integers corresponding to the position of their vertices in the VerList, and the line type is a letter corresponding to:
B = bezier curve
L = straight line
Learn how to draw and display those curves and control points here.

Finally, I’d recommend creating some test files, saving them, and then opening the lbrn2 files with a text editor to see the XML structure. Make changes and then see what effect those changes have. Worst case is that the file will not open with an error message.

1 Like