double Zmin = -100; double Feedrate = 250; double RetractHeight = 10; double ProbeHeight = 33; // IMPORTANT: Change this value to your probe device height while(exec.IsMoving()) {} // Wait for any previous action to stop exec.Wait(200); // Wait for syncronisation exec.Code("G31 Z" + Zmin + "F" + Feedrate); // Start probing while(exec.IsMoving()) {} // Wait while there is motion exec.Wait(200); // Wait for syncronisation exec.ChangeaxisDROvalue(2, ProbeHeight.ToString()); // Change the Z DRO value to the probe height exec.Wait(200); // Wait for syncronisation if(!exec.Ismacrostopped()) { // If the macro isn't interrupted... double Zup = ProbeHeight + RetractHeight; // Calculate the new coordinate to retract the Z axis exec.Code("G00 G53 Z" + Zup); // Retract the Z-axis while(exec.IsMoving()) {} // Wait while there is motion exec.Wait(200); // Wait for syncronisation }