This is code I'm using in a macro and it works really for my machine. There's still a lot of extra stuff in it that need to be cleaned out.
'Do probe down to establish torch height
SetVar(604,GetOemDro(818)) 'SetVar to Feedrate, FRO DRO =55
'SetVar(604,GetOemDro(55)) 'FRO DRO =55 Feedrate DRO = 818
code"g31 z-2 F30 " 'G31 = streight probe. Stops when torch switch hits
While ismoving()
'Sleep 100
Wend
'MsgBox "stop"
DoOemButton(1010) 'set Z zero
'Get the distance from trip point to torch above work for firing from DRO
Clearance = GetUserDro(1252) 'set this up on screen
'Code"G91" & 'Clearance ' incremental move
Code"G0 Z" & Clearance ' incremental move
While Ismoving()
'Sleep 100
Wend
SetOemDro(818,GetVar(604)) 'Reset Feedrate
Code"G90" 'absolute mode
'Switch to remote height control
ActivateSignal(Output2) 'turn on HC
'Fire torch and wait for transfer
Fire: ActivateSignal(Output1)
'Trying a timer here
'A= 0 'reset counter
'Do Until a >= 5 'wait some time for transfer (1) seconds
'sleep 200
'a = a + 1
TS = Timer
Do Until TT > 1
TE = Timer
TT = TE - TS
If IsActive(Input1)Then 'torched established arc
TT = 0
Exit Do
End If
Loop
TT = 0
'a = 0
Cond = IsActive(input1) 'torched established arc
If Cond = false Then 'Didn’t fire
DeActivateSignal(Output1)
'DoOemButton(1003) 'stop button
'Need some way To fire again
'See MachMsg.doc
Ret =MachMsg("Torch Failed to start","Torch",2) '2 = Abort, Retry, Ignore buttons
If Ret = 4 Then '4= Retry, Cancel = 2, Abort = 3 ,Ignore = 5
GoTo Fire
End If
If Ret = 3 Or Ret = 5 Then
MsgBox " Program was aborted "
DoOemButton(1003) 'Stop
'Sleep(50)
'Code"M30"
Exit Sub
End If
End If
'Dwell, wait for pierce delay
'Get user DRO for dwell itme.
Dwell = GetOemDro(1251) 'dwell time DRO
Code"G4 P" & Dwell
While Ismoving()
'Sleep 100
Wend
'DoOemButton(1000) 'Start cycle
'End If
'Else
exit sub
'end if
'DoOemButton(1000) 'Start cycle
'End Sub
'Returns To Gcode file
I fire the torch .1" above the work and then let the height controller go from there.
Tony