<?xml version="1.0" encoding="UTF-8"?>
<!--
================================================================================
  LightBurn Material Library (.clb) 
================================================================================

  Written for an OMTech Polar 50W (Ruida CO2). The structure is universal but the
  machine-specific choices are called out.

================================================================================
  HIERARCHY 
================================================================================

  LightBurnLibrary            <- DisplayName = the Select Library dropdown label
    Material   @name          <- top folder     e.g. "Acrylic"
      Entry    @Thickness     <- sub-folder     e.g. "3.00mm"
               @NoThickTitle  <- sub-folder INSTEAD, when Thickness = -1.0000
               @Desc          <- the entry's own label in the list
        CutSetting @type      <- "Cut" or "Scan". One per Entry (per sub-layer).

  Thickness and NoThickTitle occupy the SAME slot in the tree, which is why
  LightBurn greys out the Title box when a thickness is set and vice versa.

    Thickness="3.0000"                        -> sub-folder reads "3.00mm"
    Thickness="-1.0000" NoThickTitle="Cut"    -> sub-folder reads "Cut"

  Use a real thickness when the setting makes sense, i.e., for cuts.
  Use -1.0000 + a title for surface ops (engrave, score).

================================================================================
  UNITS - heats and feeds
================================================================================

  speed     ALWAYS mm/sec in the file, no matter what the UI displays. A
            mm/min number will run 60x too fast. (CUT_PARAMS: "in
            mm/sec"; the controller converts to um/sec itself.)
  minPower  percent, 0-100. The controller applies its own x163.83 scaling.
  maxPower  Do not pre-scale.
  interval  raster line spacing in MILLIMETRES, not DPI:
                interval = 25.4 / DPI      300 DPI -> 0.0847
            Only meaningful on type="Scan". Leave 0.1 on cuts.

================================================================================
  WHAT LIGHTBURN DOES WHEN YOU SAVE
================================================================================

  It rewrites the file sparsely. Observed: 9 fields kept, ~39 dropped. It keeps
  index, name, LinkPath, minPower, maxPower, maxPower2, speed, priority and 
  anything where the value DIFFERS from the CUT_PARAMS default. Everything else
  is reconstructed from defaults on load.

  Omitting a field is the same as writing its default. I'll keep a copy of this
  file so I know what exists. Both load identically.

  LightBurn also ADDS on save:
    DisplayName  on the root
    LinkPath     per CutSetting = "Material/Thickness/Desc"
                 (verified for thickness entries only, the no-thickness form
                 is unconfirmed, so this template omits LinkPath entirely.
                 LightBurn regenerates it; nothing seems to break without it.)

================================================================================
-->
<LightBurnLibrary DisplayName="My_Library">

    <Material name="Acrylic">

        <!--
        ========================================================================
        ENTRY 1 of 3 - FULLY ANNOTATED CUT, with an included thickness.
        Every CUT_PARAMS field is written out here for reference. You almost
        never need to do this; entries 2 and 3 show the short form.
        Format:  <tag Value="..."/>   - always the Value attribute, never text.
        ========================================================================
        -->
        <Entry Thickness="3.0000" Desc="Clear - 75% @ 12 mm/s">
            <CutSetting type="Cut">

                <!-- IDENTITY. These are layer-level, not CUT_PARAMS. -->
                <index Value="0"/>
                <!-- name: becomes the LAYER NAME when you assign the preset.
                     A material hierarchy reads well: "Acrylic 3.0mm Clear". -->
                <name Value="Acrylic 3.0mm Clear"/>

                <!-- POWER, percent 0-100.
                     On Ruida, minPower applies during accel/decel. For CUTS
                     set min = max or corners come out under-burned. For SCANS
                     min = 0 is normal (constant speed inside the overscan). -->
                <minPower Value="75"/>
                <maxPower Value="75"/>
                <!-- Second tube. Inert while enableLaser2 = 0. -->
                <minPower2 Value="20"/>
                <maxPower2 Value="20"/>

                <!-- SPEED, mm/sec. MACHINE: Polar tops out ~500. -->
                <speed Value="12"/>

                <kerf Value="0"/>
                <zOffset Value="0"/>
                <enableLaser1 Value="1"/>
                <enableLaser2 Value="0"/>
                <startDelay Value="0"/>
                <endDelay Value="0"/>
                <throughPower Value="0"/>
                <throughPower2 Value="0"/>
                <enableCutThrough Value="0"/>
                <priority Value="0"/>

                <!-- MACHINE: 20000 Hz makes sense for most CO2. Glass tubes ignore it; 
                     I don't have any experience, but I assume RF
                     and galvo sources do not. -->
                <frequency Value="20000"/>
                <overrideFrequency Value="0"/>
                <PPI Value="200"/>
                <enablePPI Value="0"/>

                <doOutput Value="1"/>
                <hide Value="0"/>

                <!-- AIR ASSIST. MACHINE: the Polar has built-in air; leaving
                     this on is the safe default on any CO2 (flare-ups).
                     Polar may ignore the off setting. -->
                <runBlower Value="1"/>
                <autoBlower Value="0"/>
                <blowerSpeedOverride Value="0"/>
                <blowerSpeedPercent Value="100"/>

                <overcut Value="0"/>
                <rampLength Value="0"/>

                <!-- PASSES. numPasses >= 1. zPerPass steps Z between passes. -->
                <numPasses Value="1"/>
                <zPerPass Value="0"/>

                <perforate Value="0"/>
                <perfLen Value="0.1"/>
                <perfSkip Value="0.1"/>
                <dotMode Value="0"/>
                <dotTime Value="0"/>
                <dotSpacing Value="0.1"/>

                <!-- SCAN-ONLY below. No use on a Cut layer.
                     scanOpt: individual | byGroup | mergeAll -->
                <scanOpt Value="mergeAll"/>
                <bidir Value="1"/>
                <crossHatch Value="0"/>
                <!-- overscan: CUT_PARAMS default is 1 (on). This template ships
                     0, following the Ruida-class reference library, the DSP
                     ramps outside the image area on its own. If raster edges
                     come out dark, set this to 1. -->
                <overscan Value="0"/>
                <overscanPercent Value="2.5"/>
                <floodFill Value="0"/>
                <!-- interval: mm. 0.1 is the default and is ignored on cuts. -->
                <interval Value="0.1"/>
                <angle Value="0"/>

                <!-- Halftone cell settings. Layer-level, carried here because
                     LightBurn's own libraries do. -->
                <cellsPerInch Value="50"/>
                <halftoneAngle Value="22.5"/>

                <!-- SUB-LAYER NAME. LightBurn renders the tab as "1 Cut", it
                     prefixes the index itself, so never put an ordinal here or
                     you get "1 Pass 1". Name by ROLE: Score / Cut / Cleanup. -->
                <subname Value="Cut"/>
            </CutSetting>
        </Entry>

        <!--
        ========================================================================
        ENTRY 2 of 3 - SHORT FORM CUT, no thickness.
        Only non-default fields. Loads identically to a fully-written entry.
        NoThickTitle puts it in a "Cut" sub-folder instead of a "3.00mm" one -
        right when the stock thickness is unknown or irrelevant.
        ========================================================================
        -->
        <Entry Thickness="-1.0000" NoThickTitle="Cut" Desc="Tinted - 68% @ 14 mm/s">
            <CutSetting type="Cut">
                <name Value="Acrylic Tinted"/>
                <minPower Value="68"/>
                <maxPower Value="68"/>
                <speed Value="14"/>
                <overscan Value="0"/>
                <subname Value="Cut"/>
            </CutSetting>
        </Entry>

        <!--
        ========================================================================
        ENTRY 3 of 3 - ENGRAVE (raster fill).
        type="Scan" is CT_ScanVector, i.e. Fill mode. For photographs you want
        Image mode instead. note DITHER MODE IS NOT STORED HERE. DitherMode,
        DPI and negative are per-LAYER, not CUT_PARAMS, so a library preset
        structurally cannot carry additonal info. Put it in the Desc as a reminder.
        ========================================================================
        -->
        <Entry Thickness="-1.0000" NoThickTitle="Engrave" Desc="Clear - 15% @ 350 mm/s, 300 DPI">
            <CutSetting type="Scan">
                <name Value="Acrylic Clear"/>
                <!-- Scan: ramp from 0 during accel. -->
                <minPower Value="0"/>
                <maxPower Value="15"/>
                <speed Value="350"/>
                <!-- 25.4 / 300 DPI = 0.0847 mm -->
                <interval Value="0.0847"/>
                <overscan Value="0"/>
                <subname Value="Engrave"/>
            </CutSetting>
        </Entry>

    </Material>

    <!--
    ============================================================================
    A second Material, to show the folder split. Group by FAMILY (Acrylic,
    Plywood, Coated Metal) and put the variant in Desc, not one Material per
    "3mm Baltic Birch Plywood", which gives you 40 top-level folders.
    ============================================================================
    -->
    <Material name="Plywood">
        <Entry Thickness="3.0000" Desc="Baltic Birch - 72% @ 18 mm/s">
            <CutSetting type="Cut">
                <name Value="Plywood 3.0mm Baltic Birch"/>
                <minPower Value="72"/>
                <maxPower Value="72"/>
                <speed Value="18"/>
                <overscan Value="0"/>
                <subname Value="Cut"/>
            </CutSetting>
        </Entry>
        <Entry Thickness="6.0000" Desc="Baltic Birch - 88% @ 8 mm/s, x2">
            <CutSetting type="Cut">
                <name Value="Plywood 6.0mm Baltic Birch"/>
                <minPower Value="88"/>
                <maxPower Value="88"/>
                <speed Value="8"/>
                <numPasses Value="2"/>
                <overscan Value="0"/>
                <subname Value="Cut"/>
            </CutSetting>
        </Entry>
    </Material>

</LightBurnLibrary>
