﻿#VB
'rem Modified december/09/2022 by CNC4PC
'for screen CNC4PC_Plasma_V1
Dim PierceHeight, PierceTime,Z_Min_Height, Z_Pos, CON,PROBE_LED, Probing_FR, Check_probe_disable, Offset_Z, codelist
PierceHeight = 0
Z_Pos = 0
PierceTime = 0
CON = 0
Probing_FR = 0
Offset_Z = 0
PierceHeight = AS3.Getfield(2010)
PierceTime = AS3.Getfield(234)
Z_Min_Height= AS3.Getfield(20002)
Probing_FR= AS3.Getfield(20006)
Offset_Z= AS3.Getfield(20003)
Check_probe_disable = AS3.Getcheckboxstate(20006)
exec.Code ("G31Z"& Z_Min_Height & " F"& Probing_FR)
While (exec.IsMoving())
End While
if Check_probe_disable then

PROBE_LED = AS3.GetLED(37)

While (CON <= 100)
CON = CON + 1
PROBE_LED = AS3.GetLED(37)
exec.Wait(100)
If PROBE_LED = False Then
CON = 101
 Else 
 if CON = 101 Then
 MessageBox.Show ("The PTS-1 Plasma Touch Sensor is not disabling and cannot proceed to activating the plasma.")
 If AS3.GetLED(25) = False Then 
exec.Callbutton(144)
Exit Sub
End If
 
 End if
 End If 
End While

End if

codelist = New List(of String)
codelist.Add("G92 Z"& Offset_Z) 
codelist.Add("G91")
codelist.Add("G0Z"&PierceHeight)
codelist.Add ("G90")
exec.Codelist(codelist)
exec.DospinCW()
exec.Code ("G04 P"& PierceTime)
If AS3.GetLED(66) = False Then 
exec.Callbutton(205) 
End If



