Hi,
I just want to know if I can make the post generate different N sequence numbers with the same tool as different operation type? For instance, I just tool #1 to contour then the next operation with tool #1 again but with pocket. Then I would like something like this:
N1 (1/2 End Mill)
G0 G17 G49 G53 G80 G90 Z0
T1 M6 ( SKIM CUT )
M8(LOC = Z0.)
G0 G90 G56 X-3.3 Y-.7501 S5000 M3
G43 H1 Z2. T2
Z.2
G1 Z0. F100.
X11.8 F50.
Y-1.9167
X-1.8
Y-3.0833
X11.8
Y-4.2499
X-3.3
G0 Z2.
M9
M5
G91 G28 Z0
M1
N100 (1/2 End Mill)
G0 G17 G49 G53 G80 G90 Z0
T1 M6 ( Cut ABC )
M8(LOC = Z0.)
G0 G90 G56 X-3.3 Y-.7501 S5000 M3
G43 H1 Z2. T2
Z.2
G1 Z0. F100.
X11.8 F50.
Y-1.9167
X-1.8
Y-3.0833
X11.8
Y-4.2499
X-3.3
G0 Z2.
M9
M5
G91 G28 Z0
M1
Thanks for your help.
Different "N" number for same tool?
Started by
PcRobotic
, Aug 21 2012 09:55 AM
9 replies to this topic
#2
Posted 21 August 2012 - 11:01 AM
you would need to build a buffer to track the number of times you are using a given tool.
First you need to check if the tool has been used already by reading the buffer, then you would output the sequence number based on how many times the tool has been called. Finally you would need to write to the buffer to indicate that the tool has been called again.
First you need to check if the tool has been used already by reading the buffer, then you would output the sequence number based on how many times the tool has been called. Finally you would need to write to the buffer to indicate that the tool has been called again.
#4
Posted 21 August 2012 - 12:14 PM
define the buffer and necessary variables (size1, rc1, wc1, tcount, tseqno)
in ptlchg$ or ptlchg_com (where ever you are outputting the tool change)
size1 = rbuf(1,0)
rc1 = t$
if rc1<= size1, tcount = rbuf(1,rc1)
else, tcount = 0
if tcount = 0, tseqno = t$
else, tseqno = t$ * 100 + (tcount-1)
tcount = tcount + 1
wc1 = t$
tcount = wbuf(1,wc1)
then force out the sequence number (tseqno) where you need it output
in ptlchg$ or ptlchg_com (where ever you are outputting the tool change)
size1 = rbuf(1,0)
rc1 = t$
if rc1<= size1, tcount = rbuf(1,rc1)
else, tcount = 0
if tcount = 0, tseqno = t$
else, tseqno = t$ * 100 + (tcount-1)
tcount = tcount + 1
wc1 = t$
tcount = wbuf(1,wc1)
then force out the sequence number (tseqno) where you need it output
#6
Posted 19 September 2012 - 01:47 PM
Hi Chris,
I got some thing like this, can you tell me why I did wrong?
N3€ (1" DRILL)
G0 G17 G40 G49 G53 G80 G90 Z0
G53 X0 Y0
T3 M6(DRILL)
M22
G0 G90 G55 B90.
M21
X2.5 Y-3.5 S7000 M3
M8(DOC= Z-.75)
G43 H3 Z2. T2
G98 G83 Z-.75 R.1 Q.225 F5.
X1. Y-1.
X4.
X1. Y-6.
X4.
G80
G0 G17 G40 G49 G53 G80 G90 Z0 M19
M1
I got some thing like this, can you tell me why I did wrong?
N3€ (1" DRILL)
G0 G17 G40 G49 G53 G80 G90 Z0
G53 X0 Y0
T3 M6(DRILL)
M22
G0 G90 G55 B90.
M21
X2.5 Y-3.5 S7000 M3
M8(DOC= Z-.75)
G43 H3 Z2. T2
G98 G83 Z-.75 R.1 Q.225 F5.
X1. Y-1.
X4.
X1. Y-6.
X4.
G80
G0 G17 G40 G49 G53 G80 G90 Z0 M19
M1
#7
Posted 19 September 2012 - 01:50 PM
Hi Chris,
Where do I define the "define the buffer and necessary variables (size1, rc1, wc1, tcount, tseqno)"? At what area? Under the "# Buffer 5 Read / Write Routines" ?
Thank you.
Where do I define the "define the buffer and necessary variables (size1, rc1, wc1, tcount, tseqno)"? At what area? Under the "# Buffer 5 Read / Write Routines" ?
Thank you.
Chris McIntosh, on 21 August 2012 - 12:14 PM, said:
define the buffer and necessary variables (size1, rc1, wc1, tcount, tseqno)
in ptlchg$ or ptlchg_com (where ever you are outputting the tool change)
size1 = rbuf(1,0)
rc1 = t$
if rc1<= size1, tcount = rbuf(1,rc1)
else, tcount = 0
if tcount = 0, tseqno = t$
else, tseqno = t$ * 100 + (tcount-1)
tcount = tcount + 1
wc1 = t$
tcount = wbuf(1,wc1)
then force out the sequence number (tseqno) where you need it output
in ptlchg$ or ptlchg_com (where ever you are outputting the tool change)
size1 = rbuf(1,0)
rc1 = t$
if rc1<= size1, tcount = rbuf(1,rc1)
else, tcount = 0
if tcount = 0, tseqno = t$
else, tseqno = t$ * 100 + (tcount-1)
tcount = tcount + 1
wc1 = t$
tcount = wbuf(1,wc1)
then force out the sequence number (tseqno) where you need it output
#8
Posted 19 September 2012 - 02:51 PM
Buffer definition can be complicated.
May I suggest.... Buy a 'MP Documentation Portfolio' from your reseller. Costs about 50 bucks. ALL of the things that you need to learn about post editing and data manupulation are covered. Well worth the investment, I use mine all the time.
May I suggest.... Buy a 'MP Documentation Portfolio' from your reseller. Costs about 50 bucks. ALL of the things that you need to learn about post editing and data manupulation are covered. Well worth the investment, I use mine all the time.
#9
Posted 24 September 2012 - 08:42 AM
Hi Steven,
Using a buffer file can be a very complicated procedure, depending on what you are trying to do. Here is another method of incrementing the Sequence Number for each time a tool is called.
The method I'm demonstrating uses a Lookup Table to keep track of the number of times a tool has been called.
First, define the lookup table:
Then define some variables:
You will need an error message string:
And you will need to format the operation number:
Next, add this to the Start of file:
You’ll notice above that I’ve added an error check to see if the tool number specified is greater than 24 tools. You’ll need to define an error message string for ‘stoolnumerr’ if you want to include the error check.
You need to check in ‘ptlchg0$’ to see if the operation is a new op in the op manager (that just uses the same tool), or if we are in a new call to the same operation (depth cuts/multipasses).
Define a post block to check the operation:
For you to be able to check the op_id$ properly, you need to remove the update variable from ‘ptoolchg1002$’ and add it to the end of both ‘ptlchg$’ and ‘ptlchg0$’:
ADD !op_id$ to the end of ‘ptlchg$’ and ‘ptlchg0$’
Add a new code ‘ptlchg0$’ for checking the Op and outputting operation comment and incremented sequence number.
Add the following to ‘ptlchg$’:
Add the following to ‘pparameter$’ lookup:
I hope that helps...
Using a buffer file can be a very complicated procedure, depending on what you are trying to do. Here is another method of incrementing the Sequence Number for each time a tool is called.
The method I'm demonstrating uses a Lookup Table to keep track of the number of times a tool has been called.
First, define the lookup table:
# -------------------------------------------------------------------------- # Define the Tool Count Table for sequence output. Table is setup to output # 24 Tools maximum. Add more entries and modify 'no. entries' to add more tools. # This Lookup table is used with the 'finc' function to build the sequence number # based on the tool number. flktbl 3 25 #Lookup table definition - table no. - no. entries 0 0 #T0 (could be encountered, so include) 0 1 #T1 0 2 #T2 0 3 #T3 0 4 #T4 0 5 #T5 0 6 #T6 0 7 #T7 0 8 #T8 0 9 #T9 0 10 #T10 0 11 #T11 0 12 #T12 0 13 #T13 0 14 #T14 0 15 #T15 0 16 #T16 0 17 #T17 0 18 #T18 0 19 #T19 0 20 #T20 0 21 #T21 0 22 #T22 0 23 #T23 0 24 #T24
Then define some variables:
opno_output : yes$ #Output operation number at start of operation force_n_num : yes$ #Force Tool Seq No at Null Toolchange newopflg : 0 #Operation type at null tool change. #0 - Same operation (depth cuts, multi passes or chains) #1 - New operation #2 - Same operation but transformed tcnt : 0 #Tool Count return variable
You will need an error message string:
stoolnumerr : "ERROR - TOOL NUMBER IS GREATER THAN 24"
And you will need to format the operation number:
fmt "(OPERATION NUMBER: " 4 opman_id ")" #Format operation manager operation number as integer
Next, add this to the Start of file:
n$ = t$ #Set Sequence number equal to T number for first output *n$, e$ #Force out Sequence Number if t$ > 24, [if mprint(stoolnumerr, 2) = 2, exitpost$] tcnt = finc(3, t$) #Increment the lookup table for Tool Count.
You’ll notice above that I’ve added an error check to see if the tool number specified is greater than 24 tools. You’ll need to define an error message string for ‘stoolnumerr’ if you want to include the error check.
You need to check in ‘ptlchg0$’ to see if the operation is a new op in the op manager (that just uses the same tool), or if we are in a new call to the same operation (depth cuts/multipasses).
Define a post block to check the operation:
pnewop #Check if it is a new operation at null tool change if op_id$ <> prv_op_id$, newopflg = 1 #New operation else, #Same operation [ if op_id$ <> xform_op_id$ | xform_op_id$ <> prv_xform_op_id$, newopflg = 2 #Transformed operation else, newopflg = 0 #Same operation (depth cuts, multi passes or chains) ]
For you to be able to check the op_id$ properly, you need to remove the update variable from ‘ptoolchg1002$’ and add it to the end of both ‘ptlchg$’ and ‘ptlchg0$’:
ptlchg1002$ #Call at actual toolchange, end last path here pnewop #Check to see if it is a new operation if op_id$ <> prv_op_id$, pset_mach #Read machine def parameters pspindle whatline$ = four #Required for vector toolpaths if gcode$ = 1000, [ #Null toolchange ] else, [ #Toolchange and Start of file if gcode$ = 1002, [ #Actual toolchange pretract ] if stagetool = one, prv_next_tool$ = m_one prv_xia = vequ(xh$) prv_feed = c9k ]
ADD !op_id$ to the end of ‘ptlchg$’ and ‘ptlchg0$’
!op_id$
Add a new code ‘ptlchg0$’ for checking the Op and outputting operation comment and incremented sequence number.
pnewop #Check to see if it is a Operation if force_n_num = 1 & newopflg = 1, [ tcnt = flook(3, t$) #Lookup number of times Tool Seq No has been output if tcnt = zero, [ n$ = t$ #Set Sequence Number, if first time output *n$, [if opno_output & op_id$ <> prv_op_id$, *opman_id], e$ #Force output of Tool Seq No if t$ > 24, [if mprint(stoolnumerr, 2) = 2, exitpost$] tcnt = finc(3, t$) #Increment the Tool Count +1 ] else, [ n$ = (tcnt * seqinc$) + (t$*100) *n$, [if opno_output & op_id$ <> prv_op_id$, *opman_id], e$ #Force output of Tool Seq No tcnt = finc(3, t$) #Increment the Tool Count +1 ] ]
Add the following to ‘ptlchg$’:
tcnt = flook(3, t$) #Lookup number of times Tool Seq No has been output if tcnt = zero, [ n$ = t$ #Set Sequence Number, if first time output *n$, [if opno_output, *opman_id], e$ #Force output of Tool Seq No if t$ > 24, [if mprint(stoolnumerr, 2) = 2, exitpost$] tcnt = finc(3, t$) #Increment the Tool Count +1 ] else, [ n$ = (tcnt * seqinc$) + (t$*100) #Build Seqence Number from Tool Count + Tool Number *n$, [if opno_output, *opman_id], e$ #Force output of Tool Seq No tcnt = finc(3, t$) #Increment the Tool Count +1 ]
Add the following to ‘pparameter$’ lookup:
pparameter$ #Read operation parameters #rd_params is used to call pparameter postblock and read the parameters of the operation specified in rd_param_op_no #"pparameter", ~prmcode$, ~sparameter$, e$ if prmcode$ = 15240, opman_id = rpar(sparameter$, 1) #This is the operation manager operation number
I hope that helps...
#10
Posted 06 November 2012 - 02:21 PM
fbuf 1 0 2 0
size1 : 0
rc1 : 1
wc1 : 0
tcount : 0
fmt "N" 4 tseqno
Ok so how I see it I can't use the non-buffer route because I am already updating op_id$ somewhere else. Colin may recall this one. He was a great help. So I would like to use the buffer method. This is what I have and it gives me T1N1, T2N2. . . basically the N number is matching the tool number.
What am I doing wrong?
size = rbuf(1,0)
rc1=t$
if rc1 <= size1, tcount = rbuf(1,rc1)
else, tcount = 0
if tcount = 0, tseqno = t$
else, tseqno = t$*100+(tcount-1)
tcount = tcount+1
wc1 = t$
tcount = wbuf(1,wc1)
size1 : 0
rc1 : 1
wc1 : 0
tcount : 0
fmt "N" 4 tseqno
Ok so how I see it I can't use the non-buffer route because I am already updating op_id$ somewhere else. Colin may recall this one. He was a great help. So I would like to use the buffer method. This is what I have and it gives me T1N1, T2N2. . . basically the N number is matching the tool number.
What am I doing wrong?
size = rbuf(1,0)
rc1=t$
if rc1 <= size1, tcount = rbuf(1,rc1)
else, tcount = 0
if tcount = 0, tseqno = t$
else, tseqno = t$*100+(tcount-1)
tcount = tcount+1
wc1 = t$
tcount = wbuf(1,wc1)















