Sign in to follow this  
TacomaMax

Removing A0. at Toolchange

Recommended Posts

Hello everyone,

I searched and was unable to find another thread asking this question, but I apologize if its been answered elsewhere.  I am using a generic 4ax haas post in mcam 2019 and at the end of each tool it posts:

M5
G91 G28 Z0. M9
A0.
M01

 

I would like to get rid of the A0. to reduce cycle times.  

Any help is appreciated.  Thank you.

Share this post


Link to post
Share on other sites

In many Posts, that output is controlled by this switch variable, inside the Post:

frc_cinit    : yes$  #Force C axis reset at toolchange

When that switch is 'yes$' or '1', then you get "forced Rotary Zero output" at each Tool Change.

If you look inside 'peof$', that block of code is used at the "end of the NC File" to produce output.

peof$            #End of file for non-zero tool
      pretract
      comment$
      if stagetool = 1 & stagetltype = 2, pbld, n$, *first_tool$, e$
      n$, "M30", e$
      if subs_before, #Merge subs before main program
        [             #At this point, the NC / Main program level is blank (Main prg was written to ext with subs before)
        subout$ = zero
        "%", e$
        mergesub$     #Merge transform subs
        clearsub$
        mergeaux$     #Merge non-transform subs
        clearaux$
        mergeext$     #Merge NC / Main program
        clearext$
        ]
      else,           #Merge subs after main program
        [             #At this point, the NC / Main program is written (Main prg was written to NC level with subs after)
        mergesub$
        clearsub$
        mergeaux$
        clearaux$
        ]
      subout$ = zero
      "%", e$

While that looks like a ton of code, we are only concerned with this part, here:

peof$            #End of file for non-zero tool
      pretract   #THIS CALL TO 'PRETRACT' IS ULTIMATELY WHAT CAUSES THAT 'A0.' OUTPUT.

So, inside 'pretract' is where that output is generated:

pretract        #End of tool path, toolchange
      sav_absinc = absinc$
      absinc$ = one
      sav_coolant = coolant$
      coolant$ = zero

#      if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless
        [                 #  explicitely turned off through a canned text edit
        if all_cool_off,
          [
          #all coolant off with a single off code here
          if coolant_on, pbld, n$, sall_cool_off, e$
          coolant_on = zero
          ]
        else,
          [
          local_int = zero
          coolantx = zero
          while local_int < 20 & coolant_on > 0,
            [
            coolantx = and(2^local_int, coolant_on)
            local_int = local_int + one
            if coolantx > zero,
              [
              coolantx = local_int
              pbld, n$, scoolantx, e$
              ]
            coolantx = zero
            ]
          coolant_on = zero
          ]
        ]
      #cc_pos is reset in the toolchange here
      cc_pos$ = zero
      gcode$ = zero
      if use_rot_lock & rot_on_x,
        [
        if (index = one & (prv_indx_out <> fmtrnd(indx_out)) | (prv_cabs <> fmtrnd(cabs)))
          | nextop$ = 1003 | frc_cinit, prot_unlock
        ]
      pbld, n$, sccomp, *sm05, psub_end_mny, e$
      if convert_rpd$, pconvert_rpd
      pbld, n$, [if gcode$, sgfeed], sgabsinc, sgcode, *sg28ref, "Z0.", [if gcode$, feed], scoolant, e$
      if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "X0.", "Y0.", protretinc, e$
      else, pbld, n$, protretinc, e$
      absinc$ = sav_absinc
      coolant$ = sav_coolant

So, where does our "A0." get generated?

It comes from the call to 'protretinc'. (Rotary Return Incremental Post Block Call)

The question is, do you want to remove it for Every Tool Change Event, or Just the end of the NC File? 

If you don't want any "Force A0." output, at all, then set this switch:

frc_cinit    : no$  #Force C axis reset at toolchange

 

If you want "A0." codes in-between the Tool Changes, but not at the End of File Only, then edit 'pretract' as follows:

pretract        #End of tool path, toolchange
      sav_absinc = absinc$
      absinc$ = one
      sav_coolant = coolant$
      coolant$ = zero

#      if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless
        [                 #  explicitely turned off through a canned text edit
        if all_cool_off,
          [
          #all coolant off with a single off code here
          if coolant_on, pbld, n$, sall_cool_off, e$
          coolant_on = zero
          ]
        else,
          [
          local_int = zero
          coolantx = zero
          while local_int < 20 & coolant_on > 0,
            [
            coolantx = and(2^local_int, coolant_on)
            local_int = local_int + one
            if coolantx > zero,
              [
              coolantx = local_int
              pbld, n$, scoolantx, e$
              ]
            coolantx = zero
            ]
          coolant_on = zero
          ]
        ]
      #cc_pos is reset in the toolchange here
      cc_pos$ = zero
      gcode$ = zero
      if use_rot_lock & rot_on_x,
        [
        if (index = one & (prv_indx_out <> fmtrnd(indx_out)) | (prv_cabs <> fmtrnd(cabs)))
          | nextop$ = 1003 | frc_cinit, prot_unlock
        ]
      pbld, n$, sccomp, *sm05, psub_end_mny, e$
      if convert_rpd$, pconvert_rpd
      pbld, n$, [if gcode$, sgfeed], sgabsinc, sgcode, *sg28ref, "Z0.", [if gcode$, feed], scoolant, e$
      if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "X0.", "Y0.", e$  #Removed "protretinc, " from output line. -CMG
      else, pbld, n$, protretinc, e$
      absinc$ = sav_absinc
      coolant$ = sav_coolant

You'll see that I "removed" the 'protretinc' statement from the 'if nextop$ = 1003 | tlchg_home,' condition line...

  • Thanks 2
  • Like 1

Share this post


Link to post
Share on other sites

Thanks so much Colin!

This worked perfectly.  I wanted to remove them from all tool changes so that I could continue the program on the face of the part I finished the tool on.  Thanks for the detailed explanation.

  • Like 2

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