double Zmin = -100; double Feedrate = 100; double RetractHeight = 10; double ProbeHeight = 2.3; // 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... exec.Code("G00 Z" + RetractHeight); // Retract the Z-axis while(exec.IsMoving()) {} // Wait while there is motion exec.Wait(200); // Wait for syncronisation }