# LBRN2 File Documentation

**URL:** <https://forum.lightburnsoftware.com/t/lbrn2-file-documentation/52174>\
**Category:** LightBurn Software Questions\
**Created:** [November 18, 2021, 2:46am UTC](https://forum.lightburnsoftware.com/t/lbrn2-file-documentation/52174 "2021-11-18T02:46:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mattb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@mattb](https://forum.lightburnsoftware.com/u/mattb)\
**Post date:** [November 22, 2021, 6:51am UTC](https://forum.lightburnsoftware.com/t/lbrn2-file-documentation/52174/3 "2021-11-22T06:51:01Z")

</div>

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):

```auto
< ?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](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/Affine_transformation) using this layout:

```auto
"""
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:

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

```

and a rotation of t radians with:

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

```

and a reflection along the vertical axis with

```auto
⎡-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](https://forum.lightburnsoftware.com/t/lbrn-or-lbrn2-xml-file-docuumentation/42317) 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](https://forum.lightburnsoftware.com/t/how-to-draw-a-freehand-curve/10044).

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.

---

_[View the full topic](https://forum.lightburnsoftware.com/t/lbrn2-file-documentation/52174)._
