double Zmin = -150; double Feedrate = 100; double RetractHeight = 10; double ProbeHeight = 2; // IMPORTANT: Change this value to your probe 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 Zretract = RetractHeight + ProbeHeight; // Calculate a safe retract value exec.Code("G00 Z" + Zretract); // Retract the Z-axis while(exec.IsMoving()) {} // Wait while there is motion exec.Wait(200); // Wait for syncronisation }