Originally Posted by
Get lucky
[
One thing I would like to have is the N number match the tool number but only post a N number on the line before a tool change. Is that something that would be fairly easy or complex to do?.
Easy enough
( items to be added/altered are in blue )
Code:
# --------------------------------------------------------------------------
# Format statements - n=nonmodal, l=leading, t=trailing, i=inc, d=delta
# --------------------------------------------------------------------------
#Default english/metric position format statements
fs2 1 0.7 0.6 #Decimal, absolute, 7 place, default for initialize (:)
fs2 2 0.4 0.3 #Decimal, absolute, 4/3 place
fs2 3 0.4 0.3d #Decimal, delta, 4/3 place
#Common format statements
fs2 4 1 0 1 0 #Integer, not leading
fs2 5 2 0 2 0l #Integer, force two leading
fs2 6 3 0 3 0l #Integer, force three leading
fs2 7 4 0 4 0l #Integer, force four leading
fs2 9 0.1 0.1 #Decimal, absolute, 1 place
fs2 10 0.2 0.2 #Decimal, absolute, 2 place
fs2 11 0.3 0.3 #Decimal, absolute, 3 place
fs2 12 0.4 0.4 #Decimal, absolute, 4 place
fs2 13 0.5 0.5 #Decimal, absolute, 5 place
fs2 14 0.3 0.3d #Decimal, delta, 3 place
fs2 15 0.2 0.1 #Decimal, absolute, 2/1 place (feedrate)
fs2 16 1 0 1 0n #Integer, forced output
fs2 17 0.2 0.3 #Decimal, absolute, 2/3 place (tapping feedrate)
# These formats used for 'Date' & 'Time'
fs2 18 2.2 2.2lt #Decimal, force two leading & two trailing (time2)
fs2 19 2 0 2 0t #Integer, force trailing (hour)
fs2 20 0 2 0 2lt #Integer, force leading & trailing (min)
# This format statement is used for sequence number output
# Number of places output is determined by value for "Increment Sequence Number" in CD
# Max depth to the right of the decimal point is set in the fs statement below
fs2 21 0^7 0^7 #Decimal, 7 place, omit decimal if integer value ... this is the numerical format for the new string
fs2 22 0^3 0^3 #Decimal, 3 place, omit decimal if integer value
# dwell$ must be 1/1000th of a sec, no decimal point
fs2 23 0 3 0 3t #Decimal, absolute, 3 place
# --------------------------------------------------------------------------
# Toolchange / NC output Variable Formats
# --------------------------------------------------------------------------
fmt T 4 t$ #Tool number
fmt T 4 first_tool$ #First tool used
fmt T 4 next_tool$ #Next tool used
fmt D 4 tloffno$ #Diameter offset number
fmt H 4 tlngno$ #Length offset number
fmt G 4 g_wcs #WCS G address
fmt P 4 p_wcs #WCS P address
fmt S 4 speed #Spindle Speed
fmt M 4 gear #Gear range
# --------------------------------------------------------------------------
fmt N 21 n$ #Sequence number
fmt N 21 tn #Sequence number at toolchange...new string...NOTE format number associated
fmt X 2 xabs #X position output
fmt Y 2 yabs #Y position output
the placement of the callout is not required on the 1st tool, So it is only in later tools
- I place mine before the toolchange for easier reading
- I have set my post to NOT output sequence numbers, so the n$ is ignored in the post
- the only issue is if you call a tool out a 2nd time, it WILL have the same sequence number
Code:
ptlchg$ #Tool change
pcuttype
toolchng = one
if mi1$ = one, #Work coordinate system
[
pfbld, n$, *sg28ref, "X0.", "Y0.", e$
pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
]
if prog_stop = 1, pbld, n$, *sm01, e$
if prog_stop = 2, pbld, n$, *sm00, e$
"()", e$
pcom_moveb
pcheckaxis
c_mmlt$ #Multiple tool subprogram call
pcan
tn = t$ #( this sets tn to be the same as T )
tn, e$ #( this outputs tn to the NC file )
result = newfs(15, feed) #Reset the output format for 'feed'
pbld, n$, sm06, *t$, ptoolcomment, e$