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:

Genereic Haas post, N# only at tool change


jlw™
 Share

Recommended Posts

Doesn't look like it, but easy to add. If you want to get trick you can even add a switch in the post to control it.

 

Here from MPMASTER:

tseqno      : 0     #Output sequence number at toolchanges when omitseq = yes
                    #0=off, 1=seq numbers match toolchange number, 2=seq numbers match tool number
ptlchg_com      #Tool change common blocks
      if force_output | sof,
        [
        result = force(ipr_type,ipr_type)
        result = force(absinc$,absinc$)
        result = force(plane$,plane$)
        ]
      pcom_moveb
      pcheckaxis      #Check for valid rotary axis
      if sof, uninhibit_probe$
      c_mmlt$ #Multiple tool subprogram call
      #ptoolcomment
      if sof & scomm_sav <> snull,
        [
        spaces$ = 0
        n$, pspc, scomm_str, *scomm_sav, scomm_end, e$
        spaces$ = sav_spc
        ]
      if sof = 0, scomm_sav = snull
      comment$
      pcomment3
      pmisccheck
      pcan
      if stagetool >= zero,
        [
        if omitseq$ = 1 & tseqno > 0,
          [
          if tseqno = 2, n$ = t$
          pbld, *n$, *t$, "M06", ptoolcomm, e$
          ]
        else, pbld, n$, *t$, "M06", ptoolcomm, e$
        ]
pheader$         #Call before start of file                         
      hour = int(time$)
      min = int((time$ - hour)* 100)
      if hour > 12, hour = hour - 12
      if hour = 0, hour = 12
      year$ = year$ + 2000

      "%", e$
      spaces$=0
      *progno$, " ", scomm_str, sprogname$, scomm_end, e$
      spathnc$ = ucase(spathnc$)
      smcname$ = ucase(smcname$)
      comment$  # File descriptor
      spaces$=0
      #scomm_str, "PROGRAM NAME - ", sprogname, scomm_end, e
      #scomm_str, "DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, scomm_end, e
      #scomm_str, "MASTERCAM - V", *vers_no$, scomm_end, e$
#      scomm_str, "MASTERCAM - X", scomm_end, e$
      scomm_str, "MCX FILE  - ", smcpath$, smcname$, smcext$, scomm_end, e$
      if spostname_sav = snull, spostname_sav = spostname
#      scomm_str, "POST      - ", snamepst$, scomm_end, e$
      #scomm_str, "MP        - V", *dll_vers$, scomm_end, e$
      stck_matl$ = ucase(stck_matl$)
#      scomm_str, "MATERIAL  - ", stck_matl$, scomm_end, e$
      scomm_str, "PROGRAM   - ", sprogname$, sextnc$, scomm_end, e$
      scomm_str, "DATE      - ", *smonth, "-", *day$, "-", *year$, scomm_end, e$   # MON-DD-YYYY
      #scomm_str, "DATE      - ", *year$, "/", *month$, "/", *day$, scomm_end, e$  # YYYY/MN/DD
      #scomm_str, "DATE      - ", *day$, "/", *month$, "/", *year$, scomm_end, e$  # DD/MN/YYYY
      #scomm_str, "DATE      - ", date$, scomm_end, e$                             # DD-MM-YR
      scomm_str, "TIME      - ", *hour, ":", *min, [if time$ < 12, " AM"], [if time$ >= 12, " PM"], scomm_end, e$  # 12 hour
      #scomm_str, "TIME      - ", time$, scomm_end, e$  # 24 hour
#      scomm_str, "POST DEV  - ", *slicense, scomm_end, e$
      spaces$=sav_spc

      if seqno$ = 0, omitseq$ = yes$
      sav_progno = progno$

      if tseqno = 1 & omitseq$ = 1,
        [
        seqno$ = 1
        seqinc$ = 1
        n$ = seqno$
        ]
      sav_rot_on_x = 0
      header = 0
Link to comment
Share on other sites

I prefer to go into the control def, turn off N number output

 

then go into the post, in 2 places

 

psof$ & ptlchg$

 

find this line

pbld, n$, *t$, sm06, e$

change it to this

pbld, *n$, *t$, sm06, e$

Voila!

 

Many ways to skin a cat

Link to comment
Share on other sites
  • 2 weeks later...

To expand on the idea I have been thinking how to set n sequence to match tool number and leave sequence on.

Example

N1

N2

N0016 T16 M6

N3

N4

N0216 T16 M6 (WITH A TOOL COUNTER IF A TOOL IS CALLED UP TWICE- COMMON AT OUR SHOP)

N5

N6

N0022 T22 M6

etc.

 

Good Luck, pretty sure you're into buffers for that task..

Link to comment
Share on other sites

To expand on the idea I have been thinking how to set n sequence to match tool number and leave sequence on.

Example

N1

N2

N0016 T16 M6

N3

N4

N0216 T16 M6 (WITH A TOOL COUNTER IF A TOOL IS CALLED UP TWICE- COMMON AT OUR SHOP)

N5

N6

N0022 T22 M6

etc.

Need to create a sequential counter that will use the sav_tool process so every time the same tool is called it adds + XXX number you want to the information. I still have the hardest time with buffers. Why I think about a math process this way. If buffers were as easy as dumping a number out and then querying it if that number is called again and if it is add a value to it then I could get it, but it is a lot more involved that that. You have to know the logic process of when and where they must be used. If the process is not aligned with MP.dll the black box hidden in the back ground that does slide of hand stuff that is not documented and hidden from most 3rd party companies then good luck. You have to build a process to initialize a buffer. Then you have to know how much information will be dumbed in the the buffer and then at what place of that information will be from the start of the end of the data being dumped into and then you have to decide how you and where you want to call it. Then you have to remember if MP.dll is going to add or subtract a value from what was dumped into it to then do more work to restore it back to what you dumped into it to then use that information. I did a process where I wanted my mill tools all called many times on a Turn/Mill to be listed in the header. I followed every detail step by step and have several people look at my process, but I could never get the buffer to output the values correctly. I would always get the values dumped into the buffer back out wrong. Why can't I dump a number into the buffer and get that exact number back out? No you must add or subtract or to the value placed into the buffer depending on if it is before or after a tool change. Huh? I want to dump a number in and then get that value back. Then if that values was used before then I want to do a simple math process with that number. Now you must lift your leg to a certain place, bend your elbow to 8.25 degrees when you have looked through some special lens all the time jumping on one leg hoping you have tricked the MP.dll into doing what you need. Now if you are into keeping stuff hidden so a majority of people can't follow what you have built it is brilliant, but for me I just want to have a tool that is being used 8 times give me back a value used not some weird off the wall value that makes no sense.

 

Best of luck, but I am convinced unless you go work at CNC Software in the post department or do like Dave Thompson and spend your every waking moment only doing posts for Mastercam you are just better off sticking to making toolpaths and machining parts. Hopefully Colin can chime it and show us how easy it is, but really odd I can make some of the most difficult parts I can, but a "simple" thing like buffers after all the years still alludes me. Tons of respect for those of you that have completed figured out MP buffers and get them working perfectly. I get all the logic for processing 5 Axis toolpaths, Mill Turn toolpaths, Roll Die, transform operations, and many others math things need to get good G-Code. Buffers for me don't follow a mathematical process they follow a smoke and mirrors process. One day I will commit a month in solitude and lock myself in a room with dry erase markers and a 100 white boards and map it all out and maybe then I get buffers, but until that day I will leave buffers to the buffer experts.

 

There is humor in my response and seriousness I will leave up to those who read this to figure that out.

  • Like 2
Link to comment
Share on other sites

To expand on the idea I have been thinking how to set n sequence to match tool number and leave sequence on.

Example

N1

N2

N0016 T16 M6

N3

N4

N0216 T16 M6 (WITH A TOOL COUNTER IF A TOOL IS CALLED UP TWICE- COMMON AT OUR SHOP)

N5

N6

N0022 T22 M6

etc.

 

http://www.emastercam.com/board/topic/88396-5-axis-tool-repeat-n-number/?p=1071158

# --------------------------------------------------------------------------
fs2 22  4 0 4 0lt   #Integer, force leading & trailing

flktbl  3  50
        0  1
        0  2
        0  3
        0  4
        0  5
        0  6
        0  7
        0  8
        0  9
        0  10
        0  11
        0  12
        0  13
        0  14
        0  15
        0  16
        0  17
        0  18
        0  19
        0  20
        0  21
        0  22
        0  23
        0  24
        0  25
        0  26
        0  27
        0  28
        0  29
        0  30
        0  31
        0  32
        0  33
        0  34
        0  35
        0  36
        0  37
        0  38
        0  39
        0  40
        0  41
        0  42
        0  43
        0  44
        0  45
        0  46
        0  47
        0  48
        0  49
        0  50
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------

fmt  "N" 22 times_used          #Sequence number 
fmt  "N" 22 my_times_used    

# --------------------------------------------------------------------------


psof$
.
.
.
.
      times_used = finc(3, t$)
      if times_used = 1, my_times_used = t$
       else, my_times_used = (times_used*100)+t$
      pbld, *my_times_used, *t$, sm06, e$
.
.
.
.
ptlchg$
.
.
.
.
      times_used = finc(3, t$)
      if times_used = 1, my_times_used = t$
       else, my_times_used = (times_used*100)+t$
      pbld, *my_times_used, *t$, sm06, e$
.
.
.
.
  • Like 1
Link to comment
Share on other sites

I added this to Mpmaster. I changed it a little, but hopefully this helps someone who is using Mpmaster, but wants to keep the tool sequence process abilities in tact. Thanks to Colin for the original and Albert for reposting it. It doesn't do all the different variations Colin described in the linked thread, but hopefully this helps someone.

# --------------------------------------------------------------------------
# Format statements - n=nonmodal, l=leading, t=trailing, i=inc, d=delta
# --------------------------------------------------------------------------
#Default english/metric position format statements
fs2 1   0.7 0.6     #Decimal, absolute, 7 place, default for initialize (
fs2 2   0.4 0.3     #Decimal, absolute, 4/3 place
fs2 3   0.4 0.3d    #Decimal, delta, 4/3 place
#Common format statements
fs2 4   1 0 1 0     #Integer, not leading
fs2 5   2 0 2 0l    #Integer, force two leading
fs2 6   3 0 3 0l    #Integer, force three leading
fs2 7   4 0 4 0l    #Integer, force four leading
fs2 8   5 0 5 0l    #Integer, force five leading
fs2 9   0.1 0.1     #Decimal, absolute, 1 place
fs2 10  0.2 0.2     #Decimal, absolute, 2 place
fs2 11  0.3 0.3     #Decimal, absolute, 3 place
fs2 12  0.4 0.4     #Decimal, absolute, 4 place
fs2 13  0.5 0.5     #Decimal, absolute, 5 place
fs2 14  0.3 0.3d    #Decimal, delta, 3 place
fs2 15  0.2 0.1     #Decimal, absolute, 2/1 place (feedrate)
fs2 16  1 0 1 0n    #Integer, forced output
fs2 17  1.4 1.3lt   #Decimal, absolute, 4/3 trailing
#Custom format statements
fs2 22  4 0 4 0lt   #Integer, force leading & trailing for Tool Sequence N Block #3 Process
tseqno      : 3     #Output sequence number at toolchanges when omitseq = yes
                    #0=off, 1=seq numbers match toolchange number, 2=seq numbers match tool number 3=seq number increments if repeated
# --------------------------------------------------------------------------
# Define the Number for Incrementing Tool Number Call where N=Tool number and the tool is called many times
flktbl  3  50
        0  1
        0  2
        0  3
        0  4
        0  5
        0  6
        0  7
        0  8
        0  9
        0  10
        0  11
        0  12
        0  13
        0  14
        0  15
        0  16
        0  17
        0  18
        0  19
        0  20
        0  21
        0  22
        0  23
        0  24
        0  25
        0  26
        0  27
        0  28
        0  29
        0  30
        0  31
        0  32
        0  33
        0  34
        0  35
        0  36
        0  37
        0  38
        0  39
        0  40
        0  41
        0  42
        0  43
        0  44
        0  45
        0  46
        0  47
        0  48
        0  49
        0  50
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Toolchange / NC output Variable Formats
# --------------------------------------------------------------------------
fmt  "T" 4  t$          #Tool No
fmt  "T" 4  first_tool$ #First Tool Used 
fmt  "T" 4  next_tool$  #Next Tool Used  
fmt  "D" 4  tloffno$    #Diameter Offset No
fmt  "H" 4  tlngno$     #Length Offset No
fmt  "G" 4  g_wcs       #WCS G address
fmt  "P" 4  p_wcs       #WCS P address
fmt  "S" 4  speed       #Spindle Speed
fmt  "M" 4  gear        #Gear range
# --------------------------------------------------------------------------
fmt  "N" 4  n$          #Sequence number
fmt  "N" 22 tu          #Sequence number for tools
fmt  "N" 22 xtu         #Sequence Number Counter Tracker
ptlchg_com      #Tool change common blocks
      if force_output | sof,
        [
        result = force(ipr_type,ipr_type)
        result = force(absinc$,absinc$)
        result = force(plane$,plane$)
        ]
      pcom_moveb
      pcheckaxis      #Check for valid rotary axis
      if sof, uninhibit_probe$
      c_mmlt$ #Multiple tool subprogram call
      #ptoolcomment
      if sof & scomm_sav <> snull,
        [
        spaces$ = 0
        n$, pspc, scomm_str, *scomm_sav, scomm_end, e$
        spaces$ = sav_spc
        ]
      if sof = 0, scomm_sav = snull
      comment$
      pcomment3
      pmisccheck
      pcan
      if stagetool >= zero,
        [
        if omitseq$ = 1 & tseqno > 0 & tseqno < 3,
          [
          if tseqno = 2, n$ = t$
          pbld, *n$, *t$, "M06", ptoolcomm, e$
          ]
        if omitseq$ = 1 & tseqno = 3,
          [
          tu = finc(3, t$)
          if tu = 1, xtu = t$
          else, xtu = (tu*100)+t$
          pbld, *xtu, *t$, "M06", e$
          ]  
        else, pbld, n$, *t$, "M06", ptoolcomm, e$
        ]
      spaces$=0
  • 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...