'Make sure we're not accidentally in electrical contact with target ' IF %(51) = 1 THEN GOTO Already_Triggered ' *not working yet ... 'Set Zero Plate Adder (i.e. thickness) if not present $sandwich_thickness := .570 'Remove the Cutter Offset Contribution to Location VA,,, -.25,,,,,, -.25 'Get Speeds at Startup &startXY_speed = %(71) &startZ_speed = %(73) &startZ_ramp = %(83) 'Starting Settings for Measuring Z VS, 4, .5 &Z_plunge_target = -5 &Z_pullup = .5 &sandwich_thickness = 0.570 &Z_final = &sandwich_thickness + .25 'HERE WE GO ! ............................................................. 'Next command creates an interrupt handler for contact with zero plate VS,,0.5 VR,, 10000 ' quick stop ON INPUT(1,1) GOTO afterHit MZ, &Z_plunge_target GOTO FAIL afterHit: GOSUB Backoff 'Now, let's do again with a touch at a reliable distance and speed VS,,.25 VR,, 10000 ' quick stop ON INPUT(1,1) GOTO Finish MZ, &Z_plunge_target GOTO FAIL Finish: GOSUB Backoff 'Set Location and Zero $current_cutter_Zoffset = (-1 * %(3)) + &sandwich_thickness + &Z_pullup ' remember we're pulled up here &new_base_Z_loc = &Z_pullup + &sandwich_thickness VA,,, &new_base_Z_loc,,,,,, &new_base_Z_loc 'Restore Values VS, &startXY_speed, &startZ_speed VR, , &startZ_ramp MZ, &Z_final '{{Eventually we'd like a choice here to move home or to park}} END 'SUBROUTINES BELOW HERE --------------------------- Backoff: &NextPullUp = %(3) &NextPullUp = &NextPullUp + &Z_pullup MZ, &NextPullUp RETURN FAIL: VS, &startXY_speed, &startZ_speed VR, , &startZ_ramp 'No Contact with Plate ... Ending! PAUSE END Already_Triggered: 'Z-contact seems already triggered ... Ending! PAUSE END