QtDragon Documentation

- HOLE CIRCLE UTILITY
- FACING UTILITY
- NGCGUI
- USING A VFD
- SPINDLE PAUSE
- Z LEVEL COMPENSATION
- USING A MPG
- PROBING
- RUN FROM LINE
- STYLESHEETS
- ABOUT

# Z LEVEL COMPENSATION

Z level compensation is a bed levelling/distortion correction function typically used in 3D printing or engraving. It uses a HAL user space component which utilizes the external offsets feature of LinuxCNC. The loadusr command in the handler_postgui file specifies an interpolation type, which must be one of nearest, linear or cubic. If none is specified or if an invalid word is specified, the default is assumed to be cubic.

When Z LEVEL COMP is enabled:

- the compensation component reads a probe data file, which must be called probe_points.txt
- a 3d height map image is created and the HAL map-ready pin is set True
- the height map image is shown in the UTILS page -> Z Level Map tab

The probe_points.txt file can be updated at any time while compensation is disabled. When next enabled, the file will be reread and the compensation map is recalculated.

The necessary HAL connections are as follows:

    net xpos-cmd         compensate.x-pos <= axis.x.pos-cmd

    net ypos-cmd         compensate.x-pos <= axis.y.pos-cmd

    net zpos-cmd         compensate.x-pos <= halui.axis.z.pos-relative

    net compensate-on    compensate.enable-in <= woodpecker.comp-on

    net eoffset-clr2     compensate.clear  => or2_1.in1

    net comp-count       compensate.counts => woodpecker.comp-count

    net map-ready        compensate.map-ready => woodpecker.map-ready

    setp compensate.fade-height 0.0

    setp axis.z.eoffset-enable True

## Workflow

The gcode program that creates probe_points.txt is created by one of 2 possible methods.

- from the FILE page, navigate to config folder, set filter to Python Script, load gcode_ripper.py
- set origin to match the origin of the gcode file to be probed
- under G-Code Operations, check Auto Probe
- File -> Open G-Code File, select the gcode program which needs to be level compensated
- if necessary, enter any offsets, select number of sample points and press Recalculate
- press Save G-Code File - Probe Only
- save the generated file to the nc_files folder
- exit gcode_ripper

There should now be a file in the nc_files folder called {something}-probe-only.ngc. From the FILE page, set the file filter to G-Code Files, and navigate to the nc_files directory and load this file. Running this program will create a file called probe_points.txt

- from the FILE page, open the gcode program which needs to be level compensated
- enter the X and Y dimensions shown in the preview frame into the X and Y size fields
- enter the number of probe points and other probe parameters
- ensure that the selected zero reference point is the same as that of the gcode program
- press MAKE GCODE - this creates the gcode probing routine
- to save the probe routine to a file, press SAVE GCODE. A file dialog will appear.
- to load the probe routine to LinuxCNC, press LOAD GCODE. When this program is run, it will create probe_points.txt