;probe a profile
;the routine will initially probe in negative Y and will walk around the profile clockwise ;but can follow a re-entrant shape
g20
g54
g91
#1 = 0 ; (explore angle)
#2 = 2.250 ; #<_X> (start positions)
#3 = 0.000 ; #<_Y>
#4 = 0.200 ; (step size)
#5 = 0.100 ; (retract on sucessful probe)
#6 = 2.000 ; (slow speed)
#7 = 4.000 ; (high speed)
(AXIS,stop)
(LOGOPEN,profile1.txt)
O100 WHILE [#<_flood> EQ 0] (use the flood button to stop and save data)
G38.3 F#7 X[#2 + #4 * COS[#1 - 90]] Y[#3 + #4 * SIN[#1 - 90]]
O101 IF [#5070 EQ 1]
G38.5 F#6 X#2 Y#3 (slow probe away, store point)
(LOG, #5061 #5062)
#2 = [#5061 + #5 * COS[#1 + 90]]
#3 = [#5062 + #5 * SIN[#1 + 90]]
G0 X#2 Y#3 (1mm back along probe track)
O102 DO
G38.5 F#7 X#2 Y#3
G38.3 F#7 X[#2 + #4 * COS[#1]] Y[#3 + #4 * SIN[#1]]
O103 IF [#5070 EQ 1]
#1 = [#1 + 15]
O103 ENDIF
O102 WHILE [#5070 EQ 1]
#2 = #<_X>
#3 = #<_Y>
O101 ELSE
(missed, so now start a clockwise polygon looking for the edge)
#1 = [#1 - 15]
O101 ENDIF
O100 ENDWHILE
(LOGCLOSE)
M2