Code:
'Tool Parameters
OptionsUnits Output, Unit = UN
NCEdit Output,Line = i
dim XPOS as double
dim YPOS as double
dim ZPOS as double
dim TOOLNUM as integer
dim DESC as string
dim TOOLNUMSTRING as string
dim SPINDIR as integer
dim SPINSPEED as integer
dim WORKOFF as integer
SPINDIR = 3
SPINSPEED = 500
WORKOFF = 54
NCEdit Line = i, Output, X = XPOS, Y = YPOS, Z = ZPOS
Ask Header="Tool Change",Output,Cancel=canc,"Tool Number;0"=TOOLNUM, "Tool
Description"=DESC, "Spindle Direction;0"=SPINDIR, "Spindle Speed;0"=SPINSPEED,
"Work Offset;0"=WORKOFF
If canc Then
Exit
End If
If WORKOFF < 54 Then
WORKOFF = 54
End If
If WORKOFF > 59 Then
WORKOFF = 59
End If
If TOOLNUM > 99 Then
TOOLNUM = 99
End If
If TOOLNUM < 0 Then
TOOLNUM = 0
End If
If TOOLNUM < 10 Then
TOOLNUMSTRING = "0"+TOOLNUM
Else
TOOLNUMSTRING = TOOLNUM
End If
If SPINDIR < 3 Then
SPINDIR = 3
End If
If SPINDIR > 4 Then
SPINDIR = 4
End If
If SPINSPEED < 0 Then
SPINDPEED = SPINSPEED * -1
End If
XPOS = XPOS - 1
YPOS = YPOS - 1
NCEdit Line = i,Output,Text=txt
txt = "N"+TOOLNUM+"M06T"+TOOLNUMSTRING
If Len(DESC) > 0 Then
txt = txt+" ("+DESC+")"
End If
NCEdit Line = i,Text=txt, X = XPOS, Y = YPOS, Z = ZPOS, Output, NumLines=nl
NCEdit Line = i+1,Output,Text=txt
txt = txt+"G0G"+WORKOFF+"G90X????Y????S"+SPINSPEED+"M0"+SPINDIR
NCEdit Line = i+1,Text=txt, X = XPOS, Y = YPOS, Z = ZPOS, Output, NumLines=nl
NCEdit Line = i+2,Output,Text=txt
txt = txt+"G43Z1.0H"+TOOLNUM+"M08"
NCEdit Line = i+2,Text=txt, X = XPOS, Y = YPOS, Z = ZPOS, Output, NumLines=nl
NCEdit Line = nl + 2, X = XPOS, Y = YPOS
NCRenumber
Window2
This is the Sample NC code that I get...