Sign in to follow this  
bigprody

Buffer help, I think?

Recommended Posts

I need to have my post generate code for running tool touch off macros after the main code is run. I already have a buffer that loads up tool info at all the tool changes. My problem is that at times a tool might come out twice thus loading the buffer with the same tool twice. When I then loop thru the buffer and spit out tool touch off macros I get multiple callouts for the same tool. I would like to have the post only create code once for each tool. The goal is to have NC code that needs no editing. I am having difficulty wrapping my head around the logic needed for this.

I know how to make this happen at the machine. With macro B I can make it skip a repeat, I would much rather take care of it in the post as it would be much more seamless out on the floor.

Any thoughts would be great.

Share this post


Link to post
Share on other sites

Add an extra numeric variable to your Buffer File. During "data capture", when you are filling the buffer, add the value of Parameter 15240 - Mastercam Operation Number.

The other option, if you tend to use Transform Operations, is to capture 2 different variable (NCI variable) values:

op_id$ - Unique (integer) value, representing "operation data tag". Will be a unique number, that only repeats during Null Tool Changes, for the same Operation. (So "Contour #10, might have 'op_id$': '55'. This would still be '55.' for every Depth Cut, and/or Multi-Pass. The value will only change when you process a "new" operation from the Toolpath Manager.)

xform_op_id$ - Parameter #17 from the NCI Gcode 1016 Line. This is the 'parent' op_id$ of the Transform Operation itself. (So if you are processing a Transform, you can key on "are we still processing the same Transform Op, or not"?)

Share this post


Link to post
Share on other sites

I am running outside if conventional post flow here a bit. I have a couple of buffers loaded with the tool and op info I need. This gives me a counter that I use to re-output the info as I need after the code for the specific operations are run. My peof$ section is quite large as I need to loop thru my operation sequence a few times at the end of posting to get what I need. Again I use the buffers as counters for the loops and extract what I need from them.

The path I started down is where I am trying to load another buffer (b4) as I am looping thru one of my main ones (b2). I am trying to evaluate the new buffer (b4) to see if there are any duplicates. It does not seem to be working.

Below is the code, maybe something will jump out to you as wrong.

 

      "(TOOL CHANGER LOAD PROGRAM)", e$     
        rc2 = 1
        rc3 = 1
        while rc2 <= size2, #while read counter, less or equal, to "last row number"
         [
         rc4 =1
         tl_skip = 0  
         b3_speed = rbuf(3, rc3) #read each row, starting with 1.
         str_temp = sopen_prn + drs_str(2, b3_speed) + " " + drs_str(2, b3_prog) + " " + drs_str(2, b3_numb) + " " + drs_str(2, b3_tcp) + " " + drs_str(2, b3_rl1) + " " + drs_str(2, b3_rl2) + " " + drs_str(2, b3_rl3) + " " + drs_str(2, b3_rl4) + " " + drs_str(2, b3_ptang) + " " + drs_str(2, b3_op) + " " + drs_str(2, b3_dir) + " " + drs_str(2, b3_chktl) + " " + drs_str(2, b3_qty) + " " + drs_str(2, b3_pitch) + " " + drs_str(2, b3_full) + sclose_prn
#         str_temp, e$        
         *rc2, e$
         if rc2 = 1,#First time thru it skips the check
          [
           b4_tool = b3_tool
           b4_tool = wbuf(4, wc4)#loads first position of buffer 4 with tool number
           sb2_str = rbuf(2, rc2) #read each row, starting with 1. 'rc2' auto-increments!        
           brk_str = strstr(" ", sb2_str)
           str_temp = brksps(brk_str+1, sb2_str)  #Tool Number and comment
           brk_str = strstr(" ", str_temp)
           sb2_str = brksps(brk_str+1, str_temp)
           stool_cmnt = "#3006=(LOAD " + str_temp + ")"
           if b3_tool = 1, ld_tool = 19
           if b3_tool = 2, ld_tool = 20
           if b3_tool = 3, ld_tool = 21
           if b3_tool > 3, ld_tool = b3_tool - 3
           "G100", *ld_tool, e$
           stool_cmnt, e$
           "G100", *b3_tool, e$
           if rc3 = 2, "G65P3501Z0", e$
           "G65P3010Z0", e$
          ]
          else,#After the first loop, checking buffer 4 for duplicates.
          [
           *rc4, e$
           *size4, e$
           while rc4 <= size4,#-----------------This is what does not seem to be working.
            [
             b4_tool = rbuf(4, rc4) #read each row, starting with 1.
             *b4_tool, e$
             if b4_tool = b3_tool, tl_skip = 1
            ]
           b4_tool = b3_tool
           b4_tool = wbuf(4, wc4)         
           sb2_str = rbuf(2, rc2) #read each row, starting with 1. 'rc2' auto-increments!        
           brk_str = strstr(" ", sb2_str)
           str_temp = brksps(brk_str+1, sb2_str)  #Tool Number and comment
           brk_str = strstr(" ", str_temp)
           sb2_str = brksps(brk_str+1, str_temp)
           stool_cmnt = "#3006=(LOAD " + str_temp + ")"
           if b3_tool = 1, ld_tool = 19
           if b3_tool = 2, ld_tool = 20
           if b3_tool = 3, ld_tool = 21
           if b3_tool > 3, ld_tool = b3_tool - 3
           if tl_skip = 0,
           [
            "G100", *ld_tool, e$
            stool_cmnt, e$
            "G100", *b3_tool, e$
            if rc3 = 2, "G65P3501Z0", e$
            "G65P3010Z0", e$
           ]
          ]
         ]
      "M30", e$

 

Share this post


Link to post
Share on other sites

You're likely doing more work than you have to.  If you are in Mastercam 2017 or later you could do something like this...

[POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V22.00 P0 E1 W22.00 T1550094727 M22.00 I0 O1

return    : 0

#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


op_identity        : 0

tool_number        : 0
tool_offset        : 0
tool_length_offset : 0
tool_diameter      : 0
tool_corner_radius : 0

pget_tool_parameters(op_identity)
    tool_number = opinfo(47, op_identity, 1)
    tool_offset = opinfo(49, op_identity, 1)
    tool_length_offset = opinfo(50, op_identity, 1)
    tool_diameter = opinfo(10005, op_identity, 1)
    tool_corner_radius = opinfo(10006, op_identity, 1)

stack_tool_number        : 0
stack_tool_offset        : 0
stack_tool_length_offset : 0
stack_tool_tool_diameter : 0
stack_tool_corner_radius : 0

stack_size    : 0
stack_result  : 0

fstack 1 5

is_tool_in_stack : no$

padd_tool_to_stack
    is_tool_in_stack = no$

    stack_size = pop(1, stack_result, 0)
    while stack_size > 0,
        [
        stack_tool_number = pop(1, stack_size, 5)
        if stack_tool_number = tool_number,
            [
            is_tool_in_stack = yes$
            stack_size = -1
            ]
        stack_size = stack_size - 1
        ]
    if not(is_tool_in_stack),
        [
        tool_number = push(1, stack_result, 0)
        ]

stream_idx   : 1
stream_op_id : 0

output_tool_number        : 0
output_tool_offset        : 0
output_tool_length_offset : 0
output_tool_diameter      : 0
output_tool_corner_radius : 0

fmt "Number         -> "  2 output_tool_number
fmt "Diameter Offset-> "  2 output_tool_offset
fmt "Length Offset  -> "  2 output_tool_length_offset
fmt "Diameter       -> "  2 output_tool_diameter
fmt "Corner Radius  -> "  2 output_tool_corner_radius

pwrite_tool_info
    stream_idx = 1
    stream_op_id = streaminfo(1, stream_idx)

    while stream_op_id <> -99999,
        [
        pget_tool_parameters(stream_op_id)
        padd_tool_to_stack

        stream_idx = stream_idx + 1
        stream_op_id = streaminfo(1, stream_idx)
        ]

    stack_size = pop(1, stack_result, 0)
    while stack_size > 0,
        [
        output_tool_number = pop(1, stack_size, 5)

        "(Tool Information)", e$
        "(   ", *output_tool_number, ")", e$
        "(   ", *output_tool_offset, ")", e$
        "(   ", *output_tool_length_offset, ")", e$
        "(   ", *output_tool_diameter, ")", e$
        "(   ", *output_tool_corner_radius, ")", e$
        *e$

        stack_size = stack_size - 1
        ]

pheader$
    "(--- Header---)", e$
    pwrite_tool_info
    *e$

peof$
    "(--- End-of-File---)", e$
    pwrite_tool_info
    *e$

Sample Output

(--- Header---)
(Tool Information)
(    Number         -> 1. )
(    Diameter Offset-> 1. )
(    Length Offset  -> 1. )
(    Diameter       -> .5 )
(    Corner Radius  -> 0. )

(Tool Information)
(    Number         -> 287. )
(    Diameter Offset-> 287. )
(    Length Offset  -> 287. )
(    Diameter       -> .375 )
(    Corner Radius  -> 0. )


(--- End-of-File---)
(Tool Information)
(    Number         -> 1. )
(    Diameter Offset-> 1. )
(    Length Offset  -> 1. )
(    Diameter       -> .5 )
(    Corner Radius  -> 0. )

(Tool Information)
(    Number         -> 287. )
(    Diameter Offset-> 287. )
(    Length Offset  -> 287. )
(    Diameter       -> .375 )
(    Corner Radius  -> 0. )

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Jeff, you seem to be operating a bit above my head but let me see if I have what you posted figured out. You are loading a stack (what ever that is), of the tool info, in the parameter read post block. I would guess that I could then output that info later in the post as needed. It looks like there is some logic written to prevent the same tool to be loaded twice, if so perfect, that is the key to what I am trying to do.

I will spend some time looking thru my post document stuff and see if I can figure a bit of this out.

 

Thanks again

 

Share this post


Link to post
Share on other sites

A stack is a buffer with different options.  Stacks also have performance advantages under certain conditions.

You can call pwrite_tool_info from anywhere in the post EXCEPT the parameter read post blocks.  This is because we are doing our own sequential read of the operations with the streaminfo function. 

As you've noticed, the stack uniquifies the tools so none are repeated.

Share this post


Link to post
Share on other sites

Ok, after looking at it a bit more I see what you are doing with pheader$ and peof$. I don't quite understand the logic in the "padd_tool_to_stack" section but if it prevents duplicate tools from being loaded I will just grab what you have and use it.

When it comes to the skills I have in my tool box, post mods. are not my best asset. I stumble thru them till I get what I need and then I am done. I seem to only spend time on this when I change jobs, once the posts are set I don't exercise that skill for years.  

I frequent this forum often, usually just lurking and learning. There are a group of very knowledgeable people on here that are very helpful and have made this forum a big asset for both me and the Mastercam community, you are obviously one of them.

Thanks again for your time Jeff.

Share this post


Link to post
Share on other sites

So If I have this correct, in the tool change section I run "pget_tool_parameters", this loads the all parameters I need for the current tool. Next I call "padd_tool_to_stack", this loads the parameters in the stack if the tool does not repeat. Calling the write sections seem pretty straight forward.

I will dive into this and see how it goes.

Thanks

Share this post


Link to post
Share on other sites
5 minutes ago, bigprody said:

So If I have this correct, in the tool change section I run "pget_tool_parameters", this loads the all parameters I need for the current tool. Next I call "padd_tool_to_stack", this loads the parameters in the stack if the tool does not repeat. Calling the write sections seem pretty straight forward.

I will dive into this and see how it goes.

Thanks

No, you shouldn't do any of that.

All you need to do is call pwrite_tool_info, that will take care of everything.  With this method you do not need to capture the tool information as the operation is being processed; pwrite_tool_info will gather the information at any time.

Share this post


Link to post
Share on other sites

Many thanks.

Where do I go to learn all this stuff?

Share this post


Link to post
Share on other sites
43 minutes ago, bigprody said:

Many thanks.

Where do I go to learn all this stuff?

I learned how to do the above from the MP docs.  I know some classes are offered online; I've never taken one, so I can't speak to what they teach.

Share this post


Link to post
Share on other sites

Thanks Jeff, everything worked well. I matched up your stuff to my MP documentation and it is making some sense to me.

I owe you a beer. If you are ever in the Chicagoland area I would be happy to buy you one.

Share this post


Link to post
Share on other sites

Not sure if you guys like this.... Keep it simple....

 

(TOTAL TOOLS FOR OP1 = 11 TOOLS)
(T16= .12, #31 JOBBER DRILL * Z-1.1861)
(T18= .1875, 3/16 CHMF CB * Z-.028)
(T20= .125, 1/8 CHMF  CB * Z-.185)
(T21= .375, 3/8 EM 3FLTS CB * Z-1.15)
(T22= .375, 3/8 EM 3FLTS CB * Z-1.15)
(T23= .25, 1/4 SPOTTER * Z-.0938)
(T25= .125, 1/8 REAMER 6FLTS * Z-1.135)
(T26= .1495, #25 JOBBER DRILL * Z-.88)
(T27= .125, 1/8 EM 3FLTS CB * Z-.123)
(T28= .25, 1/4 CHMF CB * Z-.015)
(T29= .1406, 9/64 EM 3FLTS CB * Z-.85)

  • Like 1
  • Huh? 1

Share this post


Link to post
Share on other sites
On 9/20/2019 at 12:11 PM, PcRobotic said:

Not sure if you guys like this.... Keep it simple....

 

(TOTAL TOOLS FOR OP1 = 11 TOOLS)
(T16= .12, #31 JOBBER DRILL * Z-1.1861)
(T18= .1875, 3/16 CHMF CB * Z-.028)
(T20= .125, 1/8 CHMF  CB * Z-.185)
(T21= .375, 3/8 EM 3FLTS CB * Z-1.15)
(T22= .375, 3/8 EM 3FLTS CB * Z-1.15)
(T23= .25, 1/4 SPOTTER * Z-.0938)
(T25= .125, 1/8 REAMER 6FLTS * Z-1.135)
(T26= .1495, #25 JOBBER DRILL * Z-.88)
(T27= .125, 1/8 EM 3FLTS CB * Z-.123)
(T28= .25, 1/4 CHMF CB * Z-.015)
(T29= .1406, 9/64 EM 3FLTS CB * Z-.85)

@PcRobotic Would you mind sharing how you got the Z min correct in the tool table? I have been having issues getting the correct output. Almost there and yet still far away.

Thank you in advance,

Brad

Share this post


Link to post
Share on other sites
5 hours ago, Brad Lisle said:

@PcRobotic Would you mind sharing how you got the Z min correct in the tool table? I have been having issues getting the correct output. Almost there and yet still far away.

Thank you in advance,

Brad

Hi Brad,

If you're using the enhanced tool table that was introduced in Mastercam 2017 check out the Techno Titan post on the Mastercam tech exchange.  The Titan post has a postblock to output the tools minium Z.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Zaffin said:

Hi Brad,

If you're using the enhanced tool table that was introduced in Mastercam 2017 check out the Techno Titan post on the Mastercam tech exchange.  The Titan post has a postblock to output the tools minium Z.

Be great when we see more of the Generic posts supporting this functionality like HAAS, Okuma and other more Popular posts.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/2/2019 at 9:31 PM, Brad Lisle said:

@PcRobotic Would you mind sharing how you got the Z min correct in the tool table? I have been having issues getting the correct output. Almost there and yet still far away.

Thank you in advance,

Brad

Hey Brad,
   You need to create another BUFFER for the separate tool table.  I am pasting it now but beware that you must to change it for your pacific needs.

 

 

==========================


#Region Buffer 8, Deepest Depth In Tools List
# --------------------------------------------------------------------------
# Buffer definition (for Max/Min X,Y,Z storage)
# --------------------------------------------------------------------------
rc8    : 1  #Buffer 8 READ pointer (YES, '2' is correct for this case!)
wc8    : 1  #Buffer 8 WRITE pointer
size8  : 0  #To hold 'size' of Buffer 8

b8_gcode : 0 #Stored in Buffer #8
b8_tcode : 0 #
b8_idnum : 0 #
b8_tldia : 0 #
b8_tcr   : 0 #
b8_cut_ability  : 0
b8_shldr_len    : 0
b8_my_arbor_dia : 0
b8_flute_len    : 0
b8_my_n_flutes1 : 0
b8_itoolmat     : 0
b8_total : 0 #
b8_xmax  : 0 #
b8_xmin  : 0 #
b8_ymax  : 0 #
b8_ymin  : 0 #
b8_zmax  : 0 #
b8_zmin  : 0 #
b8_op_id : 0

fbuf 8 1 19 0 0 #Declare Buffer8 to hold Min/Max X,Y,Z axis info.
sbufname8$ = "D:\Buffer_8.txt"
#EndRegion Buffer 8, Deepest Depth In Tools List


fmt "Xmin="  2  min_x
fmt "Xmax="  2  max_x
fmt "Ymin="  2  min_y
fmt "Ymax="  2  max_y
fmt "Zmin="  2  min_z
fmt "Zmax="  2  max_z

pshowcoord            #
   t$ = ncount
   "(", *t$, *min_x, *max_x, *min_y, *max_y, *min_z, *max_z, " )", e$

pshowtime             #
   pthrminsec
   "(", *idnum, " ", *t$, " ", *thrs, no_spc$, "H ", no_spc$, *tmin, no_spc$, "M ", no_spc$, *tsec, no_spc$, "S )", e$

pthrminsec       #Convert minutes to hr/min/sec format
      thrs = int(total / 60)
      tmin = int(total - thrs * 60)
      tsec = (total - thrs * 60 - tmin) * 60

fmt    5   thrs        #Time in hours
fmt    5   tmin        #Time in minutes
fmt    10  tsec        #Time in seconds

fmt "Oper: "  4  idnum
fmt "Time: "  2  total

ncount : 1
nenabl : 0

preadandshowtimetoolone             #
   thrs = 0
   tmin = 0
   tsec = 0
   total  = 0
   size8  = rbuf(8,0)

   nenabl = 0
   rc8 = 1
   while rc8 <= size8,
   [
      b8_gcode = rbuf(8, rc8)
      smystr0  = no2str(b8_tcode)
      real_result = strstr (".", smystr0)
      if real_result,
         smystr = brksps (real_result, smystr0)

      if smystr1 = smystr0,
      [
         nenabl = 1
         total  = total + b8_total
      ]
   ]
   if nenabl, pthrminsec

ponetimeout                         #
   if thrs > 0 | tmin > 0 | tsec > .9999, "(", no_spc$, 
    [if thrs > 0, *thrs, no_spc$, "H "], no_spc$, [if tmin > 0, *tmin, no_spc$, "M "], no_spc$, [if tsec > .9999, *tsec, no_spc$, "S"]# SECOND CALCULATION
   if thrs > 0 | tmin > 0 | tsec > .9999, no_spc$, ")", no_spc$, e$
#EndRegion Time Cycle Calculation

#Region  preadandshowtimeoperone
preadandshowtimeoperone             #
   thrs = 0
   tmin = 0
   tsec = 0
   total  = 0
   size8  = rbuf(8,0)

   nenabl = 0
   rc8 = 1
   while rc8 <= size8 & nenabl = 0,
   [
      b8_gcode = rbuf(8, rc8)
      if b8_idnum = idnum,
      [
         nenabl = 1
         total  = total + b8_total
      ]
   ]
   if nenabl, pthrminsec
#EndRegion preadandshowtimeoperone


#Region preadandshowtimeoperall
preadandshowtimeoperall             #
   thrs = 0
   tmin = 0
   tsec = 0
   total  = 0
   size8  = rbuf(8,0)

   nenabl = 1
   rc8 = 1
   while rc8 <= size8,
   [
      b8_gcode = rbuf(8, rc8)
      total  = total + b8_total
   ]
   if nenabl, pthrminsec

   "(CYCLE TIME = ", [if thrs > 0, *thrs, no_spc$, "H "], [if tmin > 0, *tmin, no_spc$, "M "], [if tsec > 0, *tsec, no_spc$, "S"], no_spc$, ")", e$
#EndRegion preadandshowtimeoperall

#Region preadandshowcoord
preadandshowcoord           #
   "(----------------------------)", e$
   "(--- My compute MIN/MAX -----)", e$
   "(----------------------------)", e$
   size8 = rbuf(8,0)
   while ncount < 100,
   [
      psetstart
      nenabl = 0
      rc8 = 1
      while rc8 <= size8,
      [
         b8_gcode = rbuf(8, rc8)
         if b8_tcode = ncount,
         [
            nenabl = 1
            if b8_xmax > max_x, max_x = b8_xmax
            if b8_xmin < min_x, min_x = b8_xmin
            if b8_ymax > max_y, max_y = b8_ymax
            if b8_ymin < min_y, min_y = b8_ymin
            if b8_zmax > max_z, max_z = b8_zmax
            if b8_zmin < min_z, min_z = b8_zmin
         ]
      ]
      if nenabl, pshowcoord

      ncount = ncount + 1
   ]
   "(----------------------------)", e$
   "(----------------------------)", e$
#EndRegion preadandshowcoord


#Region Tools List

smyaddstring1 : ""
smyaddstring2 : ""
smyaddstring3 : "" # SHELL MILL HERE

srtcr : ""

preadandshowtool   #
   *e$

   no_nc_out$ = 0

#   "; BREAK POINT ---> BEGIN", e$

   #"(*)", e$
   size10 = rbuf(10,0)
   size8 = rbuf(8,0)

   "(TOTAL TOOLS FOR", *swcsplname, "= ", *size10, [if size10 = 1, "TOTAL TOOL)" else, "TOOLS)"], e$
   size10  = rbuf(10,0)
   if size10 > 1, 
   #sav_result = mprint(serrordetect, 3) # DO YOU WANT TO ORGANIZE TOOL LIST?
#   result1 = mprint (sav_result)
   if sav_result = 0, psortbuffer10
   if sav_result = 3, exitpost$
   sav_result = 0
   rc10 = 1
   while rc10 <= size10,
   [
      strbuff10 = rbuf(10, rc10)
      smystr1   = strbuff10
      real_result = strstr ("#", smystr1)
      if real_result,
      [
         smystr3 = smystr1
         smystr2 = ""
         smystr4 = ""
         smystr2 = brksps (real_result, smystr1)
         smystr4 = brksps (real_result+1, smystr3)

         psetstart
         nenabl = 0
         rc8    = 1
         while rc8 <= size8, # & smystr0 <> smystr1,
         [
            b8_gcode = rbuf(8, rc8)

            smystr0  = no2str(b8_tcode)
            real_result = strstr (".", smystr0)
            if real_result,
               smystr = brksps (real_result, smystr0)

            if smystr0 = smystr1,
            [
               nenabl = 1
               my_dia = b8_tldia
               my_tcr = b8_tcr
               my_cut_ability = b8_cut_ability
               my_shldr_len = b8_shldr_len
               my_arbor_dia = b8_my_arbor_dia
               my_flute_len = b8_flute_len
               my_n_flutes1 = b8_my_n_flutes1
               idtoolmat    = b8_itoolmat
               if b8_xmax > max_x, max_x = b8_xmax
               if b8_xmin < min_x, min_x = b8_xmin
               if b8_ymax > max_y, max_y = b8_ymax
               if b8_ymin < min_y, min_y = b8_ymin
               if b8_zmax > max_z, max_z = b8_zmax
               if b8_zmin < min_z, min_z = b8_zmin
            ]
         ]
         if nenabl,
         [
           !stoolmat
            stoolmatout = ""
            if strlen (stoolmat), stoolmatout = stoolmat + " "


            smyaddstring1 = ""
            smyaddstring2 = ""
            smyaddstring3 = ""
            if my_n_flutes1 > 2 & tool_type >= 10, smyaddstring1 = no2str(my_n_flutes1) + "FLTS" + " "
            if idtoolmat <> 1, smyaddstring2 = stoolmatout
            if tool_type = 13 & oa_len > 4, smyaddstring3 = no2str(my_arbor_dia) + "NCK " + no2str(my_shldr_len) + "RLF "

            preadandshowtimetoolone  # Tools list here
            
            if my_tcr,
               srtcr = " * " + "R" + no2str(my_tcr) + ", "
            else,
            [
               srtcr = ", "
            ]
            
            pcut_tl_b8
            
            if b8_tcr > 0 & my_arbor_dia = my_dia,
            [
               strbuff10 = "(" + "T" + smystr1 + "= " + no2str(my_dia) + ", " + smystr4 + srtcr + smy_cut_ability + smyaddstring1 + smyaddstring2 + "* " + "Z" + no2str(min_z) + ")" # + " * " + no2str(thrs) + "h " + no2str(tmin) + "m " + no2str(tsec) + "s)"
            ]   
            else,
              if b8_tcr = 0 & my_arbor_dia <> my_dia,
               strbuff10 = "(" + "T" + smystr1 + "= " + no2str(my_dia) + ", " + smystr4 + srtcr + smy_cut_ability + smyaddstring1 + smyaddstring3 + smyaddstring2 + "* " + "Z" + no2str(min_z) + ")"# + " * " + no2str(thrs) + "h " + no2str(tmin) + "m " + no2str(tsec) + "s)"

              if b8_tcr > 0 & my_arbor_dia <> my_dia,
               strbuff10 = "(" + "T" + smystr1 + "= " + no2str(my_dia) + ", " + smystr4 + srtcr + smy_cut_ability + smyaddstring1 + smyaddstring3 + smyaddstring2 + "* " + "Z" + no2str(min_z) + ")"# + " * " + no2str(thrs) + "h " + no2str(tmin) + "m " + no2str(tsec) + "s)"

              if b8_tcr = 0 & my_arbor_dia = my_dia,
               strbuff10 = "(" + "T" + smystr1 + "= " + no2str(my_dia) + ", " + smystr4 + srtcr + smy_cut_ability + smyaddstring1 + smyaddstring2 + "* " + "Z" + no2str(min_z) + ")"# + " * " + no2str(thrs) + "h " + no2str(tmin) + "m " + no2str(tsec) + "s)"


            strbuff10, e$

            if strlen (strbuff12) = 0,
               strbuff12 = strbuff10


         ]
         smystr    = ""
         smystr0   = ""
         strbuff10 = ""
      ]
   ]
   comment$
#   subout$ = my_subout
   no_nc_out$ = 1

#EndRegion Tools List

#Region pGetToolTable
pGetToolTable # Write tool table, scans entire file, null tools are negative
           if opcode$ = 3, !nextdc$, !sdrnote, scurop = sdrnote
           else, !opcode$, !sopnote, scurop = sopnote
           if met_tool$, sunit = " MM"
           else, sunit = no2asc(34)
           if arbor_dia <> tldia$,
           #shldr_len = sReliefToolNote
           if tcr$ > 0,
              stoollib = sopn + "T" + no2str(t$) + "= " + no2str(tldia$) + ", " + strtool$ + sdlm + "R" + no2str(tcr$)#+ no2str(sReliefToolNote)
           else,
              stoollib = sopn + "T" + no2str(t$) + "= " + no2str(tldia$) + ", " + strtool$#+ no2str(sReliefToolNote)# + "H" + no2str(tloffno$)
#EndRegion pGetToolTable


#Region ptooltable
ptooltable # Write tool table, scans entire file, null tools are negative
           tnote = t$
           toffnote = tloffno$
           tlngnote = tlngno$
           spaces$=0
           if (t$ >= zero | gcode$ = 1003) & is_outputolptool,
           [
              # *ADDED* for XYZ limit output "in the ToolTable"
              if (toolable_XYZ = yes$) & (gcode$ <> 1001),
              [
                  preadbuf4t #Read the data from the Buffer 4
 #                pMaxMin    #Output Max/Min X,Y,Z coords during this tool operation
                  pMaxMin_str
              ]
              if gcode$ <> 1003, # '1003' = end of program
                  pGetToolTable
           ]
           spaces$=sav_spc
             #"(******************)", e$
             if use_g10tloff,
              [
               offset3 = tloffno$
               tl_oal = oa_len
               if mr8$ = one, tl_oal = tl_oal * m_one
               if mr8$ = 10 & mr7$ = 10, #Haas
                 [
                 spaces$ = one
                 pbld, no_spc$, *sgabsinc, no_spc$, "(HAAS G10 tool length", [if tl_oal < zero, "NEGATIVE" else, "POSITIVE"],  "offset mode)", e$
                 "G10", "L10", *offset3, *tl_oal, e$
                "(******************)", e$
                 spaces$ = zero
                  ]
               if mr8$ = 20 & mr7$ = 10, #Fanuc
                [
                 spaces$ = one
                 pbld, no_spc$, *sgabsinc, no_spc$, "(FANUC G10 tool length", [if tl_oal < zero, "NEGATIVE" else, "POSITIVE"],  "offset mode)", e$
                 "G10", "L1", *offset3, *tl_oal, e$
                "(******************)", e$
                 spaces$ = zero
                ]
              ]
              [
               offset3 = tloffno$
               tl_oal = oa_len
               #if mr8$ = two, tl_oal
               if mr8$ = 20 & mr7$ = 10, #Haas
                 [
                 spaces$ = one
                 pbld, no_spc$, *sgabsinc, no_spc$, "(HAAS G10 tool length", [if tl_oal < zero, "NEGATIVE" else, "POSITIVE"],  "offset mode)", e$
                 "G10", "L10", *offset3, *tl_oal, e$
                "(******************)", e$
                 spaces$ = zero

                 ]
               if mr8$ = 20 & mr7$ = 10, #Fanuc
                 [
                 spaces$ = one
                 pbld, no_spc$, *sgabsinc, no_spc$, "(FANUC G10 tool length", [if tl_oal < zero, "NEGATIVE" else, "POSITIVE"],  "offset mode)", e$
                 "G10", "L1", *offset3, *tl_oal, e$
                "(******************)", e$
                 spaces$ = zero
                 ]
               ]
           spaces$=sav_spc
#EndRegion ptooltable

1.txt

  • Thanks 1
  • Like 1

Share this post


Link to post
Share on other sites
On 12/3/2019 at 3:04 AM, Zaffin said:

Hi Brad,

If you're using the enhanced tool table that was introduced in Mastercam 2017 check out the Techno Titan post on the Mastercam tech exchange.  The Titan post has a postblock to output the tools minium Z.

 

Would you please show us some codes of the post?

 

Thank you.

Share this post


Link to post
Share on other sites
2 hours ago, PcRobotic said:

 

Would you please show us some codes of the post?

 

Thank you.

Download it from Mastercam's tech exchange; that way you can review the entire post.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us