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:

post question on tap cycle output pitch


Recommended Posts

I have searched thru the forum and this has been covered.  it has not been covered with the logic im seeing below.  anyone see something that jumps out as a possible reason the NC code is outputting an IPM feed rate and not a pitch value?

Switch settings:

fmt  "N" 4  n_tap_thds$  #Number of threads per inch (tpi) / Pitch (mm)
fmt  "F" 2  pitch        #Tap pitch (inches per thread)

 

 

Drilling section:

pdrill0$         #Pre-process before drill call
      sav_dgcode = gcode$ #Capture gcode for 5 axis drill

pdrlcommonb     #Canned Drill Cycle common call, before
       if initht$ <> refht$, drillref = zero
       else, drillref = one

      if sav_dgcode = 81,
        [
        result = newfs (two, zinc)
        if tap_feed = one & drillcyc$ = three, result = newfs (two, feed)  #Tap feeds with 4/3 decimal places
        if drillcyc$ = three, drlgsel = fsg1(-ss$) + drillcyc$ * two
        else, drlgsel = fsg2(dwell$) + drillcyc$ * two
        if initht$ <> refht$, drillref = zero
        else, drillref = one
        prv_refht_a = c9k
        prv_refht_i = c9k
        prv_dwell$ = zero
        ]
      if cuttype = three, sav_dgcode = gcode$
      else, z$ = depth$
      if cuttype = one, prv_zia = initht$ + (rotdia$/two)
      else, prv_zia = refht$  #Fanuc style - G91 Z depth from R level
      #else, prv_zia = initht  #G91 Z depth from initial height
      pcom_moveb
      feed = fr_pos$
      comment$
      pcan
      #5 axis must map the true Z, correct Z calculation here
      if cuttype = three,
        [
        prv_zia = zabs + (-depth$) + initht$
        zia = fmtrnd(zabs)
        zinc = zia - prv_zia
        ]

Tapping section:

ptap$            #Canned Tap Cycle
      pdrlcommonb
      #RH/LH based on spindle direction
      if use_pitch, pbld, n$, "G95", e$
      if use_pitch, pbld, n$, "M80", *speed,  e$
      if use_pitch = 1,
        [
        pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout,
          prdrlout, *feed, strcantext, e$
        ]
     else,
        [
        if met_tool$, 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,
          prdrlout, *pitch, !feed, strcantext, e$
        ]
      pcom_movea
      tapflg = 1
Link to comment
Share on other sites
4 minutes ago, riverhunter said:

maybe I need to format that before.

Yup, not formatted into your post yet...that's why I asked, some posts have it, some don't...depends on what, where & vintage

In the format section

fmt  "F" 2  pitch       #Tap pitch (units per thread)

under ptap is a good place for this

pitch = 1/n_tap_thds$ 

  • Thanks 1
Link to comment
Share on other sites

Here's the complete tap section in my post

ptap$            #Canned Rigid Tapping Cycle
      pdrlcommonb
      result = newfs(17, feed)  # Set for tapping Feedrate format
      if met_tool$,
        [
        if toolismetric, pitch = n_tap_thds$  #Metric NC Code - Metric Tap
        else, pitch = (1/n_tap_thds$) * 25.4  #Metric NC Code - English Tap
        ]
      else,
        [
        if toolismetric, pitch = n_tap_thds$ * (1/25.4)  #English NC Code - Metric Tap
        else, pitch = 1/n_tap_thds$           #English NC Code - English Tap
        ]
      #pitch = pitch * speed #Force Units Per Minute for regular Tap cycle
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        [if peck1$ > 0, *peck1$], prdrlout, *pitch, strcantext, e$
      result = unforce(feed), !feed
      pcom_movea

  • Thanks 1
Link to comment
Share on other sites

im getting an error message, but its pretty vague .

 

23 Jan 2024 02:17:31 PM - Post processor execution initialized.
23 Jan 2024 02:17:32 PM - Unencrypted input file:
23 Jan 2024 02:17:32 PM - C:\Users\Public\Documents\Shared Mastercam 2024\MILL\POSTS\MP-MATSUURA Fanuc-Hplus-FULL-4TH.pst
23 Jan 2024 02:17:32 PM - Loading input files was successful.
23 Jan 2024 02:17:32 PM - Initialization of pre-defined post variables, strings, postblocks was successful.
23 Jan 2024 02:17:32 PM - Search for defined post variables, strings, postblocks was successful.
23 Jan 2024 02:17:32 PM - Successful completion of post processor execution.

Link to comment
Share on other sites

found my error in case anyone search this agian.

 

ptap$            #Canned Tap Cycle
      pdrlcommonb
      #RH/LH based on spindle direction
      if use_pitch, pitch = 1/n_tap_thds$              # ***********add this line****************
      if use_pitch, pbld, n$, "G95", e$
      if use_pitch, pbld, n$, "M80", *speed,  e$
      if use_pitch = 1, 
        [
        pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout,
          prdrlout, *pitch, strcantext, e$                # **********DJF replace *feed with *pitch**********
        ]
     else,
        [
        if met_tool$, pitch = n_tap_thds$  # Tap pitch (mm  per thread)
        else, pitch = 1/n_tap_thds$       # Tap pitch (inches per thread)
		pitch = pitch * speed #Force Units Per Minute for regular Tap cycle
        pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout,
          prdrlout, *pitch, strcantext, e$
        ]
      pcom_movea
      tapflg = 1
Link to comment
Share on other sites

Just when i thought i had it.......

it handles it fine on the G84 line, but throws an IPM feed on the next position line.  is there a way to stop this?

post code:

ptap$            #Canned Tap Cycle

      pdrlcommonb

      #RH/LH based on spindle direction

                  if use_pitch, pitch = 1/n_tap_thds$              # DJF add this line

      if use_pitch, pbld, n$, "G95", e$

      if use_pitch, pbld, n$, "M80", *speed,  e$

      if use_pitch = 1,

        [

        pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout,

          prdrlout, *pitch, strcantext, e$                # DJF replace *feed with *pitch

        ]

     else,

        [

        if met_tool$, pitch = n_tap_thds$  # Tap pitch (mm  per thread)

        else, pitch = 1/n_tap_thds$       # Tap pitch (inches per thread)

                                pitch = pitch * speed #Force Units Per Minute for regular Tap cycle

        pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout,

          prdrlout, *pitch, strcantext, e$

        ]

      pcom_movea

      tapflg = 1

 

 

nc code:

N190
G91 G28 G00 Z0
G90 G80 G40 G49 G17 G00
(TAP_34_X_2-56_OP5)
M01
T138 M06 (2-56_D3_ROLL_TAP_LOC_0437)
M01
G90G10L12P#517R0
(MAX - Z1.7808)
(MIN - Z.093)
M22 (UNLOCK)
G54
G90 G00 X-.6693 Y4.849 B0. S560 M03
M21 (LOCK)
G43 H#517 Z1.641 M08
T195
G95
M80 S560
G98 G84 X-.6693 Y4.849 Z.443 R.741 F.0179
X.6693 Y4.849 F10.    *************************************here**************
X.6693 Y3.9
X-.6693 Y3.9
X.6693 Y3.142
X-.6693 Y3.142
X-.6874 Y-3.2829
X.6874 Y-3.2829
X.6874 Y-3.9154
X-.6874 Y-3.9154
G80
G94
X5.035 Y.885
Z1.391
G95
M80 S560
G98 G84 X5.035 Y.885 Z.193 R.491 F.0179
X5.035 Y-.885
G80
G94
Z1.7808
Link to comment
Share on other sites

ptap when it encounters more than a single hole, then calls out ptap_2$ on subsequent holes, which calls pdrill_2$

ptap_2$          #Canned Tap Cycle
      pdrill_2$

pdrill_2$        #Canned Drill Cycle, additional points
      pdrlcommonb
      pcan1, pbld, n$, pxout, pyout, pzout, pcout, prdrlout, feed, strcantext, e$
      pcom_movea

 

In all likelihood you'll just need to remove a* from the feed variable

Link to comment
Share on other sites

it did not have a * so i added a ! and it seemed to work,  thanks for pointing me in the right direction AGIAN!

 

pdrill_2$        #Canned Drill Cycle, additional points
      pdrlcommonb
      pcan1, pbld, n$, sgdrlref, pdrlxy, pzout, pcout, prdrlout, dwell$,
        !feed, strcantext, e$                                            #****DJF**** ADDED ! TO FEED 1-24-24
      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...