Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Adding height check at the end of toolpaths


Recommended Posts

Hey all,

I am currently working on a Makino post processor and am trying to setup mi7 to output a G165 at the end of toolpaths. So far I have gotten the G165 to drop in where I want it in the toolpath, but it adds it to all of the posted tools instead of only the one tool I need it on.

Right now I am putting this if statement in pretract above the G90 line

if mi7 = 1, n$, "G165", e$

 

Have tried adding an else statement after it on the G90 line to cover non "1" values and get the same results. Anyone delt with this before?  

Thanks in advance!

 

Link to comment
Share on other sites
17 hours ago, hamsamsquanch said:

Hey all,

I am currently working on a Makino post processor and am trying to setup mi7 to output a G165 at the end of toolpaths. So far I have gotten the G165 to drop in where I want it in the toolpath, but it adds it to all of the posted tools instead of only the one tool I need it on.

Right now I am putting this if statement in pretract above the G90 line

if mi7 = 1, n$, "G165", e$

 

Have tried adding an else statement after it on the G90 line to cover non "1" values and get the same results. Anyone delt with this before?  

Thanks in advance!

 

Try 'resetting' the value of 'mi7$', after you output the G165. That should make it so it only outputs "once", unless there is another Operation where MI7 is set:

      if mi7$ = 1,
        [
        pbld, n$, "G165", e$
        mi7$ = 0
        ]

I noticed in your sample above, that you have 'mi7'. Is that a typo, or did you try to create your own User Defined variable named 'mi7'? (When using the predefined variable, it should be followed by a Dollar Sign character. The only exception, would be if you were working on a 'pre-X' Post Processor. [V9])

  • Like 1
Link to comment
Share on other sites
5 minutes ago, Colin Gilchrist said:

Try 'resetting' the value of 'mi7$', after you output the G165. That should make it so it only outputs "once", unless there is another Operation where MI7 is set:


      if mi7$ = 1,
        [
        pbld, n$, "G165", e$
        mi7$ = 0
        ]

I noticed in your sample above, that you have 'mi7'. Is that a typo, or did you try to create your own User Defined variable named 'mi7'? (When using the predefined variable, it should be followed by a Dollar Sign character. The only exception, would be if you were working on a 'pre-X' Post Processor. [V9])

mi7 is supposed to be the Miscellaneous integer #7 and this is a modern Post, so I'll add that $ in and try out the reset code in a few.

Also, with fresh eyes this morning I realized that I need to be putting the G165 in AFTER the G90. Tuesday hit me more like a Monday this week.

Thank you for the reply!

Link to comment
Share on other sites

I handle this like so...define the sav_mi8 variable

In the tool change section,

sav_mi8 = mi8$      #Save value to determine Tool Breakage Output

Then in the pretract section...

if sav_mi8,
        [
          pbld, n$, "M98P99999999","(TOOL BREAKAGE)", e$
          sav_mi8 = 0
        ]

 

If I need a tool to do a tool check after it has been run, I only need to set the mi8$ in the initial operation for that tool...

You want to make sure you save the value in the toolchange section as they read ahead and if you wait til the last operation, the post has already read ahead to the next tool...

  • Like 1
Link to comment
Share on other sites

The piece you are missing is this:

  • By default, the Misc. Values (Miscellaneous Integers and Real Numbers) are "Set at the Tool Change Event".
  • This means that 'after you have processed either 'psof$', 'ptlchg$', or 'ptlchg0$', that these MI$ and MR$ values get "reset" by MP.
  • 'pretract' is a Post Block that gets called "at the start of the next Tool Change". But all of the 'misc values' are for the 'next tool change', not the 'current tool's retract'.

MPMaster is setup to handle this, by using a Post Block named 'plast'.

The 'plast' Post Block, gets called at the "end of each Tool Change" event. In this block, there is some code to "save the current value of MI/MR Variables". (You can initialize additional "last variables", and add them to this block.)

For example, you would initialize 'last_mr7':

last_mr7  : -1

Then, in 'plast', add the following:

plast

      last_mi7 = mi7$
     #There will be other code here, just add additional 'last variable' capture

Make sure you've got a 'call to [plast] at the end of 'psof$', 'ptlchg$', and 'ptlchg0$'. (This is done already for you, if you are using MPMaster. Otherwise, you'll need to create the 'plast' Post Block.)

 

Now, in 'pretract', you can add your check:

pretract    #comment...

      #
      # Other code, above and below where you want output...
      #

      if last_mi7 = 1,
        [
        pbld, n$, "G165 (TBD AT TOOL END)", e$
        last_mi7 = 0
        ]

      #
      # Other code, above and below where you want output...
      #

 

Link to comment
Share on other sites

Thank you guys so much for the suggestions! And apologies for the response time, my rookie account is limited on posts per day.

 

Jparis,

Your suggestion resulted in the same as I had prior, a G165 on the previous tool.

Colin,

I believe your suggestion put G165 on every tool in the file, and every new toolpath between tool changes. Tried a lot of variations on this one and I cannot remember exactly what the carbon copy of what you suggested output. 

 

Another programmer here found an old post processor manual and wrenched on this project for a bit last night. He got it really close, then I moved one of his lines this morning and got it 99% of the way to where I want it.

 

WHAT WE HAVE RIGHT NOW:

We ended up making a "Common User Defined Variable Initialization" called: sav_mi7 : 0

Near the end of ptlchg$: sav_mi7 = mi7$

Then in pretract (under the G90 line) I put: if sav_mi7 = 1, n$, "G165", e$

 

This outputs the G165 on the tool with mi7 set to 1, but only registers the first toolpath that uses that tool, unless another tool is called up between instances of the tool needing the G165. (ex. Three drilling paths in a row, using the same tool. The first path has the mi7 set as 1, so the end of the tool gets a G165. If the first is set to 0, but the second and/or third are set to 1, there is no G165 called). I am getting around this on drills, taps, spots and bores by setting the toolpath defaults to put a 1 in the mi7 box. Other toolpath types will require the programmer to keep this condition in mind though.

 

Link to comment
Share on other sites

What I do in this type of process is put the specific tool path closing codes inside ptoolend$

This keeps the "closing" arguments in the same area.

In this case you would insert your code in the "if  nextop$ = 1002 segment

It is definitely better to create and use "sav_mi8".

Your code is the first statement after "nextop$ = 1002" statement. The rest is mine.

ptoolend$        #End of tool path, before reading new tool data
      !speed, !spdir2

      if nextop$ = 1000, # repeat with same tool
        [
        prvtpsub = virt_tlplnno
        ]
      if nextop$ = 1002, # last operation before toolchange
        [
        if sav_mi7 = 1. n$, "G165", e$ #<<<<<<<<<<<<<<<<<<<<<<<<         
        cantext_54 = 0
        cantext_55 = 0
#     ****** moved from probing cycle for multiple offsets***2011-08-20*********
        prvprb_x = 0
        prvprb_y = 0
        prvprb_z = 0
        prvprb_b = 0
#     **************************************************************************
        prvtpsub = 0
        plane$ = 0
        if sav_mi8 = 1, n$, "G69", e$
        n$, sgplane, e$
#       ***************** removed from HX300iG 2019-05-17 **********************
#        if machine <> 60, phsm_off
        if machine <> 60 | machine <> 300, phsm_off
#       ************************************************************************
        prv_tloffno$ = c9k
        sav_mac_tloffno = 0
        sav_mi6 = 0
        sav_mi8 = 0
        sav_mr10 = 0
        if s_popen_flg = 1,
          [
          s_pclos, e$
          s_popen_flg = 0
#     ********** added to clear inspection variables*****2018-02-15*************
          s_full_storage_removal, e$
#     **************************************************************************
          ]
        psub_end_st
        subout$ = 0 #main NC program

#        if sav_mi2 = 3112 | sav_mi2 = 3612 | sav_mi2 = 3712, "#539=#540", e$

        if sav_cantext = 51 & sav_mi2 = 37, "#539=#540", e$
        if vari_540_flg = 1,
          [
          "#540=-9999", e$
          vari_540_flg = 0
          ]
        tooldiawarn = 0
        t$ = c9k
        if (machine = 60 & prvtool = 59) | (machine = 80 | machine = 300
         | machine = 480 | machine = 800 & prvtool = 4),sys43_Bax_cl = 1
        pcoolantoff
        if sav_mi2 > 41 & sav_mi2 <= 44, "#181=-9999", e$
        ]

 

 

 

  • Like 1
Link to comment
Share on other sites
5 hours ago, crazy^millman said:

Great you solved it.

What did you come up with for the solution?

Please share so those that do search know how to do it.

Thank you for sharing your solution to others if you decide to do so.

My previous comment is the solve. The condition I spelled out at the end of the comment is how the post is supposed to work, so I am not calling it a problem. If that switch were being read after the first instance of the tool, there would be a height check at every toolpath change, not just the end of the tool.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • 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

×
×
  • Create New...