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:

Changing E to F on lathe threading


Recommended Posts

There is normally a switch, but if not look for the fmt statement that defines the variable for E and just change the letter to F.

 

Here is the switch:

# --------------------------------------------------------------------------
# Machine Specific Settings
# --------------------------------------------------------------------------
#Machine axis switches, initial
y_axis_mch   : no$   #SET_BY_MD - Machine has a Y axis, 0=no, 1=yes - Set based on Axis Combination in MD
old_new_sw   : 1     #Switch old (6T), new (0T+) cycle formats, 0=old, 1=new

For anyone not familiar with searching through a post to understand what I am saying here to change a fmt is an example:

# --------------------------------------------------------------------------
# Threading output
# --------------------------------------------------------------------------
pthread0$        #Pre-thread calculations
      # Calculate taper delta 'X' on Acceleration Clearance distance
      thdrdlt = (((thdx2$ - thdx3$) / abs(thdz1$ - thdz2$)) * thdzclr$)
      # Add to the original thread 'X' difference calculation
      thdrdlt = (thdrdlt + (thdx2$ - thdx3$)) * pl_ax_m0x
      thdang = rad2deg$ * thdangle$
      thd_dirx = (thdx2$ - thdx3$) * pl_ax_m0x
      thd_dirz = (thdz1$ - thdz2$) * pl_ax_m0z
      thd_vlen = thdlead$/ nstarts$
      thd_dirx = vsa (thd_vlen, thd_dirx)
      if fr_pos$, pthreadpull
      else, thdpull = zero

pthreadpull     #Pre-thread calculations
      if thdpulloff$/(fr_pos$*10) > 0.99,thdpull = 99
      else, thdpull = (thdpulloff$/(fr_pos$*10))*100

pthdext$         #Calculation override for external thread
      #thddepth = thdlead * .61343         #Calc. thread depth
      #thdflat  = thdlead * .1667          #Calc. thread flat

pthdint$         #Calculation override for internal thread
      #thddepth = thdlead * .54127         #Calc. thread depth
      #thdflat  = thdlead * .125           #Calc. thread flat

pthdface$        #Calculation override for face thread
      #thddepth = thdlead * .61343         #Calc. thread depth
      #thdflat  = thdlead * .1667          #Calc. thread flat

pthrg32_1$       #G32 threading first
      comment$
      gcode$ = zero
      lrapid$

pthrg32_2$       #G32 threading second
      gcode$ = zero
      lrapid$

pthrg32_3$       #G32 threading third
      copy_x = vequ(x$)
      pcom_moveb
      pcan1, pbld, n$, sgfeed, *sthdgcode, pxout, pyout, pzout, pcout, pffr,
      strcantext, e$
      pcom_movea
      prv_gcode$ = m_one

pthrg32_4$       #G32 threading fourth
      gcode$ = zero
      lrapid$

pthrg92_1$       #G92 threading
      if thdpass$ = one, pthrg92_11

pthrg92_11      #G92 threading
      comment$
      gcode$ = zero
      lrapid$
      prv_feed = m_one
      prv_zabs = c9k
      prv_thdtype$ = m_one

pthrg92_2$       #G92 threading

pthrg92_3$       #G92 threading
      copy_x = vequ (x$)
      pcom_moveb
      pcan1, pbld, n$, sgfeed, sthdgcode, pfxout, pyout, pzout, pcout,
        [if thdrdlt & thdpass$ = one, *thdrdlt], pfr, strcantext, e$
      pcom_movea
      prv_gcode$ = m_one

pthrg92_4$       #G92 threading

pg32e$           #G32/G92 threading end
      gcode$ = zero
      lrapid$

pthrg76_1$       #G76 threading start point
      gcode$ = zero
      lrapid$

pg76$            #G76 threading
      comment$
      gcode$ = zero
      lrapid$
      sav_xa = vequ(copy_x)
      if thdface$ = zero, copy_x = thdx3$
      else, copy_z = thdx3$
      if thdface$ = zero, copy_z = thdz2$
      else, copy_x = thdz2$
      pcom_moveb
      nstart_cnt = zero
      while nstart_cnt < nstarts$, pg76nstart
      pcom_movea
      prv_gcode$ = m_one
      copy_x = vequ(sav_xa)
      copy_x = copy_x + (thd_dirx * (nstarts$ - one))
      copy_z = copy_z + (thd_dirz * (nstarts$ - one))
      pcom_moveb
      pe_inc_calc
      !gcode$, !xabs, !yabs, !zabs, !xinc, !yinc, !zinc

pg76nstart      #G76 threading, for multiple starts
      if old_new_sw = zero, pg76old
      else, pg76new
      nstart_cnt = nstart_cnt + one
      if nstarts$ <> one & nstart_cnt <> nstarts$,
      pbld, n$, *sgcode, thd_dirx, thd_dirz, e$

pg76old         #G76 threading old style
      pbld, n$, *sthdgcode, pfxout, pfzout, *thdrdlt, *thddepth$,
        *thdfirst$, *thdang, pffr, e$

pg76new         #G76 threading new style
      pbld, n$, *sthdgcode, *nspring$, *thdpull, *thdang, *thdlast$,
        *thdfinish$, e$
      pbld, n$, *sthdgcode, pfxout, pfzout, *thddepth$, *thdfirst$,
        *thdrdlt, pffr, e$

The section above defines the threading cycles. Now we need to look for the defined variables.

# --------------------------------------------------------------------------
# Thread output
# --------------------------------------------------------------------------
fmt  "P" 2  thddepth$   #Thread height absolute
fmt  "Q" 2  thdfirst$   #First depth cut in thread
fmt  "Q" 2  thdlast$    #Last depth cut in thread
fmt  "R" 2  thdfinish$  #G76 thread finish allowance
fmt  "R" 3  thdrdlt     #Thread R delta G92 and G76
fmt  "U" 3  thd_dirx    #Incremental X move for G76 mult starts
fmt  "W" 3  thd_dirz    #Incremental Z move for G76 mult starts
fmt  "P" 5  nspring$    #Number of spring cuts
fmt     5   thdpull     #G76 thread pull off
fmt     5   thdang      #G76 threading angle

Now we have an issue here as nothing is defined with F here. What do you do here? You have to know even though all Mastercam posts have a defined places to format variables more post writers never only format a variable there. They define or change their output in other places. The pffr is what defines the feed here and if you follow the rabbit hole till the end you will find the line were it is defined. Hopefully this step by step process will help someone figure out how Mastercam posts are written.

pffr            #Output feedrate, force
      if ipr_actv$ = zero, pfr_m
      else, pfr_l
      *feed

Here the feed decided i the feed rate in imp or ipr.

 

We are using a threading cycle so the else part of the statement applies here and then tells the post to look up the next condition statement pfr_l:

pfr_l           #Format feedrate for lathe
      if opcode$ = 104,
        [
        #Format feedrate for lathe thread
        if old_new_sw = zero, result = nwadrs(stre, feed)
        result = newfs (19, feed)
        ]
      else,
        [
        result = nwadrs(strf, feed)
        result = newfs (18, feed)
        ]
         

Here we have even more logic to sort through. If opcode$ = 104 then it will use the upper section if not then it will use the lower section or the else. Here is where the post writer throws the person off trying to figure out where the E or F is coming from out. This line below is where they format the E in the post. If someone used the switch in the post to get the correct format:

if old_new_sw = zero, result = nwadrs(stre, feed)

the nwadrs(stre, feed) had taken any fmt statement above in the post and rewritten the letter to use E. Anywhere you see this in a post and the conditions to make it true are present nothing done in the fmt to change the value will work. Why there is not a variable defined here and then a fmt for E to define it is done I can't tell you, but unless you can understand how to reverse engineer a Mastercam post to look for these little things and there is not a switch to change it then you can spends hours searching and looking for these little hidden things to get the correct output you may need.

 

Here is the old switch output:

%
O0000
(PROGRAM NAME - OP_2_OLD)
(DATE=DD-MM-YY - 25-04-16 TIME=HH:MM - 09:10)
(MCX FILE - 5TH AXIS)
(NC FILE - C:\USERS\RON\DOCUMENTS\MY MCAMX9\LATHE\NC\OP_2_OLD.NC)
(MATERIAL - STEEL INCH - 1030 - 200 BHN)
G20
(TOOL - 97 OFFSET - 97)
(OD THREAD RIGHT  INSERT - NONE)
G0 T9797
G18
M8
G97 S200 M03
G0 G54 X.45 Z.2109
G76 X.1887 Z-1. I0. K.0306 D.012 A29 E.05
M9
G28 U0. V0. W0. M05
T9700
M30
%

Here is the new switch output:

%
O0000
(PROGRAM NAME - OP_2)
(DATE=DD-MM-YY - 25-04-16 TIME=HH:MM - 09:09)
(MCX FILE - 5TH AXIS)
(NC FILE - C:\USERS\RON\DOCUMENTS\MY MCAMX9\LATHE\NC\OP_2.NC)
(MATERIAL - STEEL INCH - 1030 - 200 BHN)
G20
(TOOL - 97 OFFSET - 97)
(OD THREAD RIGHT  INSERT - NONE)
G0 T9797
G18
M8
G97 S200 M03
G0 G54 X.45 Z.2109
G76 P010029 Q0 R0
G76 X.1887 Z-1. P306 Q120 R0. F.05
M9
G28 U0. V0. W0. M05
T9700
M30
%

I gave you this information since you may only want to change the F for E and not the complete output and you would have to dig this deep into the post to make that change. Follow the rabbit hole till the end and you will find the answer you were looking for.

 

HTH

Edited by 5th Axis Consulting Group
  • 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...