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:

Help writing logic statement for rigid tap


JVizzi
 Share

Recommended Posts

I am developing my HAAS Lathe post, based off of the "Generic Haas tl 2 axis lathe" post included with MX7.

 

I am wondering if it would be possible to write a logic within the "ltlchg" postblock to look ahead to the upcoming operation to see if it is rigid tapping, g84 to keep the spindle OFF.

 

With haas lathe I have found it is better to keep the spindle off before the g84 line and let the canned cylce turn it on.

 

So, I would like the 'ltlchg" postblock to still output the speed selection and RPM/CSS selection but NOT m03:

 

G97 S300

G84 x0. z-.50 r.1 f.039

 

Is this very difficult?

 

Here is my ltlchg:

ltlchg$          #Toolchange, lathe
      toolchng = one
      gcode$ = zero
      copy_x = vequ(x$)
      pcc_capture   #Capture LCC ends, stop output RLCC
      c_rcc_setup$  #Setup LCC on first 60000
      plcc_lead_begin  #Save original in sav_xa and shift copy_x for LCC comp.
      pcom_moveb    #Get machine position, set inc. from c1_xh
      c_mmlt$        #Position multi-tool sub, sets inc. current if G54...
      comment$      
            
      if home_type < two, #Toolchange G50/home/reference position
        [
        sav_xh = vequ(copy_x)
        sav_absinc = absinc$
        absinc$ = zero
        pmap_home   #Get home position, xabs
        ps_inc_calc #Set start position, not incremental
        #Toolchange home position
        if home_type = one,
          pbld, n$, *sgcode, pfxout, pfzout, e$
        else,
          [
          #Toolchange g50 position
          pbld, n$, *sg28ref, "U0.", "W0.", e$
          toolno = t$ * 100 + zero
          if home_type = m_one, pbld, n$, *sgcode, *toolno, e$
          else, pbld, n$, *sg50, pfxout, pfzout, e$
          ]
        pe_inc_calc #Update previous
        absinc$ = sav_absinc
        copy_x = vequ(sav_xh)
        ]
      toolno = t$ * 100 + tloffno$
      pbld, n$, *toolno, " ", ptoolcomment, e$
      pbld, n$, pwcs, e$
      pcom_moveb    #Reset machine position, set inc. from last position
      pcan
      pspindle
      #Added for 'css_start_rpm' logic
      if css_actv$,
        [
        if css_start_rpm,
          prpm # Direct RPM startup for programmed CSS
        else,
          pbld, pcssg50, pcss # NO RPM start - just output the CSS
        ]
      else, # Direct RPM was programmed
        [
        prpm # Output programmed RPM
        ]
      sav_absinc = absinc$
      if home_type > one, absinc$ = zero
      pcan1, pbld, n$, psccomp, *sgcode, pfxout, pfzout,
        pscool, strcantext, e$
      plcc_lead_end #Use sav_xa to position with comp. LCC
      pcom_movea    #Update previous, pcan2
      ps_inc_calc   #Reset current
      absinc$ = sav_absinc
      #Added for 'css_start_rpm' logic
      if css_start_rpm,
        pbld, pcssg50, pcss # CSS output AFTER a G97S???? RPM spindle startup
      c_msng$        #Position single-tool sub, sets inc. current if G54...
      toolchng = zero

 

 

And here is my rigid tap:

ltap$            #Canned tap cycle, lathe
      pdrlcommonb
      pcan1, pbld, n$, *sgdrillf, *sgdrlref, pfxout, pfzout,
        prdrlout, *feed, strcantext, e$
      pcom_movea

 

  • Like 2
Link to comment
Share on other sites

 

 

      pspindle

      #Added for 'css_start_rpm' logic

      if css_actv$,

        [

        if css_start_rpm,

          prpm # Direct RPM startup for programmed CSS

        else,

          pbld, pcssg50, pcss # NO RPM start - just output the CSS

        ]

      else, # Direct RPM was programmed

        [

        prpm # Output programmed RPM

        ]

That section calls prpm...that is where the spindle speed and M03 comes from.

You could limit the call to prpm; but then you need to output the speed here, or some other postblock.

Likely best done in the prpm postblock; you will need logic to see if the operation is tap or not.

It is too early in the nci to know what the ~opcode$ is so you have to use nextdc$ (next drill cycle)

 

Hope that helps

 

Allan

 

  • Like 1
Link to comment
Share on other sites

Hi Allen,

 

I modified my prpm:

prpm            #Output for start spindle
      speed = speedrpm
      if nextdc$ = ltap,
      "(next operation is rigid tap cycle)" e$
      if speed = zero,
        pbld, n$, *spindle_l, e$  #RPM = '0', output just an 'M05'
      else,
        pbld, n$, *sg97, *speed, *spindle_l, pgear, e$
      !css_actv$

 

 

But now, it posts out my test comment (next operation is rigid tap cycle) at every output of prpm. It seems that logic is not working. I get an error log on that line of The formula/boolean failed (general message), , Label has not been defined[20], and then at the end of the error log: The math calculation/formula has an error a bunch of times in a row

Link to comment
Share on other sites

Colin,

 

here is the section of the NCI

TAP M6 X 1 HOLE
1011
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
1012
2 0 0 0 0 0 0 0 0 0
1013
0 0.11811 0. 0 5 0. 0. 0. 105 M6 X 1 TAP, SPIRAL FLUTE
1014
0. 1. 0. 0. 0. 1. 1. 0. 0.
1016
7 4 64 1 0. 0. 0. 41 0 0 2 0 25.4000508 9 1 3 7 13
1017
1. 0. 0. 0. 1. 0. 0. 0. 1.
950
0 0 0 965 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1025
3050 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1027
1. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0.
1020
3.235 0.5 0.5 -1.6175 0. 0. 0 0. 0. 0. 0. 1 3000 STEEL inch - 1030 - 200 BHN
20010
TOP
20011
 

This is my ltap$ section in my lathe post

ltap$            #Canned tap cycle, lathe
      pdrlcommonb
      pcan1, pbld, n$, *sgdrillf, *sgdrlref, pfxout, pfzout,
        prdrlout, *feed, strcantext, e$
      pcom_movea

 

I had to copy the rigid tap section from my haas mill post because the original haas lathe post used G32 for tapping and its just not correct type of cycle for Haas.

 

Also, what does it mean when a variable or postblock ends with "$" or begins with " * "

Link to comment
Share on other sites

The Dollar Sign ($) means that a Post Block, String, or Numeric Variable is "Pre-Defined". That means that the variable is "reserved" by MP (The Post Engine).

 

You should be using the Mastercam Code Expert Editor to make Post Processor modifications. This is because the Editor has "auto-complete" enabled, which gives you a list of everything that is pre-defined.

 

An Asterisk character (*) is a "force output" modifier. It "forces" the output, meaning that when that bit of code is ran during the script, you will always get output.

 

You should get a copy of the MP Documentation. It is available from your Reseller, and gives you the reference material that explains how the post works, and how to write the logic.

 

 

When you posted your sample NCI code, you only posted part of it.

 

The NCI data is read from Top to Bottom, 2 lines at a time. This means that the post has a special method of gathering data. There are a sequence of NCI lines that start every "new operation". These NCI lines are "preparatory", meaning they are read "before" the tool change. The purpose is to set Variable Values, and then to call the Tool change event, and then the "motion" routines for the operation.

 

 

When  you posted the NCI data, you stopped short of the actual "Operation" data. All you got was the preparatory stuff. Please post the whole operation, and I can better advise you. I'm not in front of a computer with Mastercam on it today, so I'm just going by memory...

Link to comment
Share on other sites

Ok, this time I only posted out the Tap operation. Here is the whole NCI:

1050
16 53 26 9 2016 10 37 33 \\MACH1\CNC PROGRAMS\SHOP PROGRAMS\5.CAM PROGRAMS\MASTERCAM PROGRAMS\M00007444-00.MCX-7
20600
1804 9D3EAE0B-FBBA-11DA-991B-001111AFFC59 "" "" Machine Base
20600
1805 9D3EAE0D-FBBA-11DA-991B-001111AFFC59 "Z" "Z" Lathe Left Spindle Z Axis (-->+)
20600
1806 9D3EAE0F-FBBA-11DA-991B-001111AFFC59 "X" "X" Lathe Upper Turret X Axis
20600
1807 9D3EAE11-FBBA-11DA-991B-001111AFFC59 "" "" Lathe Upper Turret
20600
1808 9D3EAE13-FBBA-11DA-991B-001111AFFC59 "" "" Lathe Tailstock
20600
1809 9D3EAE15-FBBA-11DA-991B-001111AFFC59 "" "" Lathe Chuck
20600
1810 CA66FCA9-83F4-11E6-8574-001AA0C69940 "" "" Chuck Jaws
20600
1811 CA66FCAB-83F4-11E6-8574-001AA0C69940 "" "" Stock
20600
1812 9D3EAE17-FBBA-11DA-991B-001111AFFC59 "" "" Lathe Steady Rest
20601
1823 9D3EAE26-FBBA-11DA-991B-001111AFFC59 0 Left/Upper
999
64 0 7
1051
HAAS ST-10
1053
HAAS ST-10
1008
PARTIAL TAP M6 X 1 HOLE
1011
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
1012
2 0 0 0 0 0 0 0 0 0
1013
0 0.11811 0. 0 5 0. 0. 0. 105 M6 X 1 TAP, SPIRAL FLUTE
1014
0. 1. 0. 0. 0. 1. 1. 0. 0.
1016
7 4 64 1 0. 0. 0. 41 0 0 2 0 25.4000508 9 1 3 7 13
1017
1. 0. 0. 0. 1. 0. 0. 0. 1.
950
0 0 0 1823 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1025
3050 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1027
1. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0.
1020
3.235 0.5 0.5 -1.6175 0. 0. 0 0. 0. 0. 0. 1 3000 STEEL inch - 1030 - 200 BHN
20010
TOP
20011

20012
LATHE UPPER LEFT [TOP] 1
20013

20014
TOP
20015

20016
STEEL inch - 1030 - 200 BHN
20017
MEDIUM CARBON
20018
OPERATION 1
20019

20001
M6 X 1 TAP, SPIRAL FLUTE
20002
NONE
20100
3 4 1 0 0. 1 9 9 2
20101
0.03937008 82 0. 300 0 100. 100. 1 8 0 77
20102
5 0. 90. 0. 0. 0. 0. 0 0.
20103
M6 X 1 TAP, SPIRAL FLUTE
20104
68 0. 1.5 0. 0. 0 4 0
20105
0 0. 0. 0. 0. 0. 0.
20106
0 0 0 0. 0. 0. 0. 0. 0. 0. 0. 0
20107
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
20108
7 0.23622 0.375 180. 1.25 1.25 35. 2 0.1 0. 0. 0. 0.03937 2
20109
3 0. 0. 0. 0. 0.
20110
NONE
20111
0 1.625 0. 0. 0. 0.125 1.5 0. 0. 0. 0. 1 0 0 0
20112
C:\USERS\PUBLIC\DOCUMENTS\SHARED MCAMX7\LATHE\TOOLS\NONE
20800
0.
1001
74441 100 2 9 9 3000 5 300 -0.03937 0 0. 0. 0.1 5. 0. 10. 1 0.
0
0 0. 0. 0.1 1000. 0
82
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
81
3 0. 0. -0.25 0. -0.03937 0. 0. 0. 0. 0.1 0.1 0. 0. 0. 0. 0.1 0 0 0.
1003
5. 0. 10.
 

Link to comment
Share on other sites
prpm            #Output for start spindle
      speed = speedrpm
      if nextdc$ = ltap,
      "(next operation is rigid tap cycle)" e$
      if speed = zero,
        pbld, n$, *spindle_l, e$  #RPM = '0', output just an 'M05'
      else,
        pbld, n$, *sg97, *speed, *spindle_l, pgear, e$
      !css_actv$


Change to:

prpm            #Output for start spindle
      speed = speedrpm
      if nextdc$ = 3, [
      "(next operation is rigid tap cycle)" e$
      n$, *sg97, *speed, e$
      ]
      else, [
      if speed = zero,
        pbld, n$, *spindle_l, e$  #RPM = '0', output just an 'M05'
      else,
        pbld, n$, *sg97, *speed, *spindle_l, pgear, e$
        ]
      !css_actv$
  • 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...