I don't know how many of the people here use Mach3 Turn or its wizards but if you do then this is for you.
I was looking at why this wizard was not working correctly when it has Xend larger than Xstart and ended up rewriting a lot of the script. The issues were:
If you tried to use it for facing from the centre to the OD it overshot the centre and so pushed the tool into the rising side of the workpiece which, as we all know, is bad for the cutting edge on the tool,
If you wanted to leave a central spigot going from the spigot to the OD the error above created the wrong size spigot and going from outside inwards the final cut uses G0 not G1.
This is the modified script for the Post Code button. You can access it by going to the wizard page for OD facing, on the menu bar choose Operator/Edit Button Script then when the buttons flash click on the Post Code button. This should open the script editor. If you paste this script in front of the existing script then the new script will execute when the button is pressed in normal use. The old script will still be there if you want to compare the two or, if you don't want to use this newer script (just delete what has been added at the front).
Sub Main()
DoOEMButton (169)
?
PlungeFeed = Abs(GetUserDRO(1080))
XStart = GetUserDRO(1081)
XEnd = GetUserDRO(1082)
?
ZStart = GetUserDRO(1083)
ZEnd = GetUserDRO(1084)
?
Clearance = Abs(GetUserDRO(1086))
?
FinishCut = Abs(GetUserDRO(1088))
?
Feed = Abs(GetUserDRO(1089))
FinishFeed = Abs(GetUserDRO(1091))
rough_amount = Abs(GetUserDRO(1090))
?
If ZStart <= ZEnd Then
? ? setTicker 20, "****ZStart <= ZEnd***"
Exit Sub
End If
?
If Clearance <= 0 Then
? ? setTicker 20, "****Clearance = 0***"
Exit Sub
End If
?
If Feed = 0 Then
? ? setTicker 20, "****Feed = 0***"
Exit Sub
End If
?
If PlungeFeed = 0 Then
? ? setTicker 20, "****Plunge Feed = 0***"
Exit Sub
End If
?
If rough_amount = 0 Then
? ? setTicker 20, "**** Roughing Cut = 0 ***"
Exit Sub
End If
?
If Clearance <= rough_amount Then
? ? setTicker 20, "**** Clearnace <= Roughing Depth ***"
Exit Sub
End If
?
xFinishCut=FinishCut
If XStart=0 Then xFinishCut=0
If XEnd=0 Then xFinishCut=0
?
DiaCheck = 1
If IsDiameter() = 1 Then
? ? XEnd = XEnd / 2
? ? XStart = XStart / 2
? ? DiaCheck = 2
End If
?
setTicker 20, ""
OpenTeachFile "ODFacing.tap"
Code "G18 G40 G49 G90 G94 G80"
Code "M3"
?
If XStart < XEnd Then
? ? Code "G0 X" & (XStart + xFinishCut) * DiaCheck & " Z" & ZStart + Clearance
? ? Code "F" & Feed
? ? Pass_Num = 1
? ? End_Loop = 0
? ??
? ? Do
? ? ? ? ZDist = ZStart - (rough_amount * Pass_Num)
? ? ? ? ? ? If ZDist > ZEnd + FinishCut Then
? ? ? ? ? ? ? ? Do
? ? ? ? ? ? ? ? ? ? ZDist = ZStart - (rough_amount * Pass_Num)
? ? ? ? ? ? ? ? ? ? If ZDist < (ZEnd + FinishCut) Or Pass_Num > 2000 Then
? ? ? ? ? ? ? ? ? ? ? ? Exit Do
? ? ? ? ? ? ? ? ? ? End If
? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? Code "G0 Z" & ZDist + Clearance
? ? ? ? ? ? ? ? ? ? Code "G1 Z" & ZDist & "F" & PlungeFeed
? ? ? ? ? ? ? ? ? ? Code "G1 X" & (XEnd + Clearance) * DiaCheck & "F" & Feed
? ? ? ? ? ? ? ? ? ? Code "G1 Z" & ZStart + Clearance
? ? ? ? ? ? ? ? ? ? Code "G0 X" & (XStart + xFinishCut) * DiaCheck
? ? ? ? ? ? ? ? ? ? Pass_Num = Pass_Num + 1
? ? ? ? ? ? ? ? Loop
? ? ? ? ? ? Else
? ? ? ? ? ? ? ? Exit Do
? ? ? ? ? ? End If
? ? Loop
? ??
? ? If FinishCut > 0 Then
? ? Code "G1 Z" & ZStart + Clearance & "F" & Feed
? ? Code "G1 X" & (XStart + xFinishCut) * DiaCheck
? ? ? ? Code "G1 Z" & ZEnd + FinishCut
? ? ? ? Code "G1 X" & (XEnd + Clearance ) * DiaCheck
? ? ? ? Code "G1 Z" & ZStart + Clearance
? ? ? ??
? ? End If
? ??
? ? Code "G1 Z" & ZStart + Clearance & "F" & Feed
? ? Code "G1 X" & XStart * DiaCheck
? ? ? ? ? ??
? ? If FinishFeed > 0 Then
? ? ? ? Code "F" & FinishFeed
? ? Else
? ? ? ? Code "F" & Feed
? ? End If
? ??
? ? Code "G1 Z" & ZEnd
? ? Code "G1 X" & (XEnd + Clearance) * DiaCheck
? ? Code "G0 Z" & ZStart + Clearance
? ??
Else
?
? ? Code "G0 X" & (XStart + Clearance) * DiaCheck & " Z" & ZStart + Clearance
? ? Code "F" & Feed
? ? Pass_Num = 1
? ? End_Loop = 0
? ??
? ? Do
? ? ? ? ZDist = ZStart - (rough_amount * Pass_Num)
? ? ? ? ? ? If ZDist > ZEnd + FinishCut Then
? ? ? ? ? ? ? ? Do
? ? ? ? ? ? ? ? ? ? ZDist = ZStart - (rough_amount * Pass_Num)
? ? ? ? ? ? ? ? ? ? If ZDist < (ZEnd + FinishCut) Or Pass_Num > 2000 Then
? ? ? ? ? ? ? ? ? ? ? ? Exit Do
? ? ? ? ? ? ? ? ? ? End If
? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? Code "G0 Z" & ZDist
? ? ? ? ? ? ? ? ? ? Code "G1 X" & (XEnd + xFinishCut) * DiaCheck & "F" & Feed
? ? ? ? ? ? ? ? ? ? Code "G0 Z" & ZStart + Clearance
? ? ? ? ? ? ? ? ? ? Code "G0 X" & (XStart + Clearance) * DiaCheck
? ? ? ? ? ? ? ? ? ? Pass_Num = Pass_Num + 1
? ? ? ? ? ? ? ? Loop
? ? ? ? ? ? Else
? ? ? ? ? ? ? ? Exit Do
? ? ? ? ? ? End If
? ? Loop
? ??
? ? If FinishCut > 0 Then
? ? Code "G1 X" & (XStart + Clearance) * DiaCheck
? ? ? ? Code "G1 Z" & ZEnd + FinishCut
? ? ? ? Code "G1 X" & (XEnd + xFinishCut) * DiaCheck & "F" & Feed
? ? ? ? Code "G1 Z" & ZStart + Clearance
? ? ? ? Code "G1 X" & (XStart + Clearance) * DiaCheck
? ? End If
? ??
? ? Code "G1 Z" & ZEnd
? ??
? ? If FinishFeed > 0 Then
? ? ? ? Code "F" & FinishFeed
? ? Else
? ? ? ? Code "F" & Feed
? ? End If
? ??
? ? Code "G1 X" & XEnd * DiaCheck
? ? Code "G1 Z" & ZStart + Clearance
? ? Code "G1 X" & (XStart) * DiaCheck
?
End If
?
Code "M5"
Code "M30"
?
?
CloseTeachFile
?
Call LoadTeachFile
End Sub
?
Main
?
? ? ? ? ? ?
?