Milling un-even surfaces / Z-heigh compensation
automatically un-even surfaces
Intended use
The compensation is intended for relatively small compensation with natural smooth behavior. The compensation profile is directly added to the motion of the Z axis. The acceleration profile therefore is determined by the shape of the compensation.
If the compensation is not continuous, then depending of the quantity of it and the speed in which the moves are done this may lead to position loss with open-loop stepper motor systems or position following error with closed loop systems. relatively
Milling PCB’s is one example:

The Coordinates TAB contains the functionality to measure the unevenness:

Start measurement
Will pop up an interpreter dialog for explained measurement using a touch automatically.
Move to start position.
Will move X and Y to the first measured position, where the compensation is zero.
Save measurement
It will open a file-save dialog and allow you to save the measurement data.ow you to save the measurement data. allows to save the mesurement data.
“Load"
Shows Wil shows some statics of the measured data, the max and minimum correction values, and at which place they are. file-open dialog to load existing measurement data.
“Check measurement”
Will shows some statics of the measured data, the max and minimum correction values, and at which place they are.
“ZheightComp ON”
Wil switch the compensation ON/OFF.
It will be shown in the position read out, the compensation value is shown above the normal work position of Z.
Now you can do normal XY engraving and while the Z is compensated using the measurement values.
Starting the measurement
You specify the number of measurements in X and Y.The height to which the probe should move to when going to the next point.
The minimum Z value to which the probe should move to during the measurement (G38.2).
The size of the grid, distance between the measuring points.And the feed for the down movement during G38.2. All other moves use G0 for highest speed.
The measurement starts at WORK X0 Y0. Max Z and Min Z are also WORK coordinates.The measurement data itself is in machine coordinates, so after the measurement you can freely zero anywhere else on the work piece.
This is the subroutine to be added in the standard macro.cnc for this purpose.
If you have a self-modified macro.cnc, you can copy from default_macro.cnc to your own macro.cnc
Milling un-even cylinders with y->a mapping on also works.In that case the measurement must be done using with y->a mapping on.
The compensation works only in the measured range. So of the mapping is measured between 0-360 degrees for A, it will not compensate for e.g. 370 degrees.
For your own use if you want to customize the working:
ZHCINIT <grid size in mm> <number of points in X> <number of points in Y>
This is the first command required before starting a measurement, it will reserve the correct amount of memory to store the measured points.
ZHCINITEX <grid sizeX> <grid sizeY> <n of points in X> <n of points in Y>
Instead of ZHCINIT you can use ZHCINITEX.
The difference with ZHCINIT is that this allows different grid sizes for X and Y.
Using G38.2 will do the actual measurement.
ZHCADDPOINT will add the last measured point to the data.
ZHCS <fileName> will store the data to a file.
ZHCL <fileName> will load the data from a file.
ZHC [ON | OFF] will switch the compensation on.
#5151 contains 1 if ZHC is ON and 0 if OFF. This can be used for run time checks if the compensation is on. In case of tool change, you will probably want to switch it off and switch it back ON after the tool change.