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 option for m0 in tap cycle


Recommended Posts

Hi guys,

Been trying to modify an MPmaster post slowly the last few days. One thing I want to do is have an option in the tap cycle for an M0 to appear before the tap starts tapping.  I got the dialog box to show the dialog I want but am not sure how to go about changing the tap cycle to spit out the M0 if there is anything other then zero in the dialong box. Looking at ptap$ I'm at a lost on how to implement an if statement because I don't know how the dialog boxes are called upon. Am I going about this the wrong way to begin with? Should I be using a custom drill parameter instead of the dialog boxes?

Link to comment
Share on other sites

Each Data Entry Field on that page of the Drill Parameters dialog box has a "pre-defined" variable name that will receive the value from the dialog. It really depends on which field you are using. Post up a picture of your dialog so we can tell you which variable to use.

The logic itself is pretty easy:

If retr$ = one, "pbld, n$, sm00, e$

"retr$" is one of those data entry fields...

Link to comment
Share on other sites

Sorry for the late reply guys.

The new one that I am modifying looks like this at the moment.

N6(TAPPING 2-56 HOLES)
(MIN - Z-.25)
T5 M6 (NO. 2-56 FORM TAPRH)
( READY ) T1
/2 G54 J3
/3 G55 J3
G0 G17 G90 X-.75 Y.5
G43 H5 Z.1
G95
M29 S1110
G99 G84 Z-.25 R.1 F.0179
Y-.5
X.75
Y.5
G80
M5
G91 G28 Z0.
M1

I'm trying to add the M0 just before it starts tapping.

N6(TAPPING 2-56 HOLES)
(MIN - Z-.25)
T5 M6 (NO. 2-56 FORM TAPRH)
( READY ) T1
/2 G54 J3
/3 G55 J3
G0 G17 G90 X-.75 Y.5
G43 H5 Z.1
M0 (LUBE TAP)
G95
M29 S1110
G99 G84 Z-.25 R.1 F.0179
Y-.5
X.75
Y.5
G80
M5
G91 G28 Z0.
M1

 

I was trying to use the "subsequent peck" dialog box. I am assuming I still can but would just need a statement that uses "$peck2" as the variable? Not to sure how to get the post to put it on the line after the height offset is called though. Colin I'll definitely be taking your course in June. 

Link to comment
Share on other sites

Well, to get this to work right, we need to be careful about "where" you add the "M0". The issue is with the way that MP processes the data, in 2-line sets.

At the "Tool Change" event, we only have a limited ability to "look forward" in order to get data from the upcoming drill cycle. MP has some "next" variables that are used to "look ahead" and give us some data.

For example, at the Tool Change, we have 'nextdc$', which holds the value of the "next drill cycle". Unfortunately, this is only the "Drill Cycle Number". As in Drill, Peck, Tap, Bore, ect. We don't have the ability to get "individual parameter values" from the Drill Cycle Dialog.

We can only get that Drill Cycle Parameter Data when we are processing the "NCI G-code 81". (All Drill Cycles are output as "Gcode 81", as the "NCI G-code Value". Based on the 2nd Parameter Line in the NCI File, the first parameter on that line tells MP "which entry post block to call".

So when MP sees "3" on that first parameter value, it calls "ptap$" as the block where that output occurs.

 

What you have with MPMaster, is a series of locations where output occurs from. Here are the "main blocks" that output each line of your code:

G0 G17 G90 X-.75 Y.5           <<<<< This output comes from 'ptlchg_com'
G43 H5 Z.1                     <<<<< This output comes from 'ptlchg_com'
G95                            <<<<< This output comes from one of the last lines in 'pdrlcommonb'
M29 S1110                      <<<<< This output comes from 'ptap$'
G99 G84 Z-.25 R.1 F.0179       <<<<< This output comes from 'ptap$'
Y-.5                           <<<<< This output comes from 'ptap_2$'
X.75                           <<<<< This output comes from 'ptap_2$'
Y.5                            <<<<< This output comes from 'ptap_2$'
G80                            <<<<< This output comes from 'pcanceldc$'

So, what you'll need to do is either just add the "M0" code to the beginning of 'ptap$', (which would put the "M0" after the "G95", and before the "M29 S1100"), or you will need to copy the 'sgfeed' line (last line in 'pdrlcommonb'), and paste it at the start of each pre-defined Drill Cycle. (8 of them)

By moving the "sgfeed" line to each Entry Block for Drilling, it would then be possible to insert your "M0" line directly before the "G95" output.

This is what 'ptap$' would look like, if we moved the 'sgfeed' line to the start of the block, and put "M0" before it:

ptap$            #Canned Tap Cycle
      pdrlcommonb
      #Added M0 for tap lube, based on 'peck2$'
	 if peck2$ <> zero, pbld, n$, "M0", e$
	 pbld, n$, sgfeed, e$
      #RH/LH based on spindle direction
      if rigid_tap, pbld, n$, *sm29, *speed, e$           #Rigid Tapping
      if use_pitch = 0,
        [
        pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,
          prdrlout, [if peck1$, *peck1$], *feed, strcantext, e$
        ]
      else,
        [
        if metvals, pitch = n_tap_thds$  # Tap pitch (mm  per thread)
        else, pitch = 1/n_tap_thds$       # Tap pitch (inches per thread)
        pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,
          prdrlout, [if peck1$, *peck1$], *pitch, !feed, strcantext, e$
        ]
      pcom_movea

 

  • 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...