Sign in to follow this  
Dave228

Misc Value tirgger AFTER the Toolpath

Recommended Posts

I could use some help. I tried a lot of things but just cant get what I want.

I am trying to get a Misc Value to trigger AFTER a toolpath but every thing I have tried so far, either puts my work at the END of the previous toolpath, or at the START of the toolpath where the misc value is set. I want my work to be at the END of the toolpath where the misc value is set.

I am a newbie at post edits, so I have just been pasting something like this

if mi7$ = 1,
pn, "XXXXXXXXX", pe

into various locations and watching where it posts out at but I just cant find the right spot.

 

Share this post


Link to post
Share on other sites

Have you tried putting it in your pl_/pm_retract? You might need to set a variable in the tool change and then call it there or ptoolend. Tough to tell with the vague description...

Share this post


Link to post
Share on other sites

You have to understand the "calling structure" of the MP Post Language, in order to understand why this is happening.

  • The call to 'pretract' happens in 'ptlchg1002$'. This is the "start tool change sequence". So, by the time you've hit 'pretract', you are already reading the "next operation's MI/MR values", as you've discovered.
  • If you are using MPMaster, there is a mechanism that was built into the Post, in order to tract the "last MI/MR values". But it only tracks a couple "by default", meaning you have to add variables to capture the rest of the values.
  • Search for 'plast'. That is the Post Block where the 'last MI/MR values' are captured.
  • Add variables in the "variable define section".
#Last variables (see plast)
last_op_id       : 0
last_cuttype     : 0
last_rot_axis    : 0
last_rotary_type : 0
last_tlplnno     : 0
last_mr1         : 0
last_mr2         : 0
#Added additional last_ values to track MI/MR values at tool change
last_mi1         : 0 #Added to track Z Variable Output Formatting
last_mi7         : 0

Then, add logic to 'plast' to capture the new values:

plast
      last_op_id = op_id$
      last_cuttype = cuttype
      last_rotary_type = rotary_type$
      last_tlplnno = tlplnno$
      last_mr1 = mr1$
      last_mr2 = mr2$
      last_mi1 = mi1$
      last_mi7 = mi7$

Then, add your code in 'pretract' to do whatever you want with that value:

pretract        #End of tool path, toolchange
      phsm_off
      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,
            [
            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
      if convert_rpd$ = one,
        [
        gcode$ = one
        feed = maxfeedpm
        ipr_type = zero
        ]
      else, gcode$ = zero
      pbld, n$, sccomp, *sm05, psub_end_mny, e$
      pcancel_rot_coord
      pbld, n$, sgabsinc, sgcode, [if gcode$ = 1, sgfeed], *sg28, "Z0.", [if gcode$ = 1, feed], scoolant, e$
#      if lock_codes = one & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$
#      pbld, n$, *sg28, "X0.", "Y0.", protretinc, e$
#      if lock_codes = one & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$
      if abs(fmtrnd(cabs)) > 360 & nextop$ <> 1003 & not(index),
        [
        if lock_codes = one, pbld, n$, *sunlock, sunlockcomm, e$
        rotretflg = 1
        pbld, n$, `sg28, protretinc, e$
        rotretflg = 0
        if lock_codes = one & cuttype = 0, pbld, n$, *slock, slockcomm, e$
        ]
      absinc$ = sav_absinc
      coolant$ = sav_coolant
      uninhibit_probe$
      if last_mi7 = 1,
        [
        #Set Z back to normal output
        result = nwadrs(str_z_pstd, zabs) #Assign original prefix string to zabs
        result = nwsufx(str_z_sstd, zabs) #Assign original suffix string to zabs?
        zabs = sav_zabs, !zabs #set current to output, update variable to maintain proper modality
        last_mi7 = zero #Reset Flag. If next op has MI7 set, it will update at PLAST
        ]

 

  • Like 1

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