//M31 probing macro double Zmin = -100; // Max.Z depth double FeedrateFast = 300; // Fast feedrate for probing double FeedrateSlow = 20; // Slow feedrate for probing double SafeZ = 100; double retractheight = 10; // Retract height double retractforsecondmeasurement = .5; double newZ = 32.60; // The new Z DRO value after probing and calibration bool dodualcycle = true; // 2 cycle probing, Fast feedrate then Slow feedrate while(exec.IsMoving()){} exec.Wait(200); if(dodualcycle) { exec.Code("G31 Z" + Zmin + "F" + FeedrateFast); // Z probe with Fast feed first while(exec.IsMoving()){} exec.Wait(200); exec.Code("G91 G0 Z" + retractforsecondmeasurement); // Raise probe ready for second reading exec.Code("G90"); } exec.Code("G31 Z" + Zmin + "F" + FeedrateSlow); // Probe with Slow feed for accurate reading while(exec.IsMoving()){} exec.Wait(200); exec.ChangeaxisDROvalue(2, newZ.ToString()); //Change the DRO value exec.Wait(200); //Safety wait for the UC100 syncronisation while(exec.IsMoving()){} exec.Wait(500); double Zup = exec.GetZmachpos() + retractheight; if(Zup > SafeZ) { Zup = SafeZ; } exec.Code("G00 G53 Z" + Zup); // Move 10mm above probe plate while(exec.IsMoving()){} exec.Wait(1000);