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:

Tool Recalls


Recommended Posts

I need some help with getting my tool recalls at the top of my program below my tool list as I'm tired of "copy/paste"

 

Heres the output I have so far. In red is what I need to add, but for the life of me I can't get the out put I need.  I hope this can be done without a buffer as my head is not wrap tightly around them yet. Maybe I just need to walk away from this for a few days :wallbash: :wallbash:

 

 

 

%
O2001( SC2001 REVD MILL PROGRAM )


#6=1
M97 P9900 (TOOL/PROGRAM CHECK SUB)
(NO COMMENTS ABOVE THIS LINE)

(CUSTOMER      - ADD CUSTOMER)
(PROGRAM REV  - N/C)
( DATE - MAR. 08 2015 )

(SET #600= TO PROGRAM NUMBER)
(PROGRAM# 2001 )

(*****BEGIN TOOL LIST*****)
(---------------------------------------------------------)
( T11 -  NO. 47 CARB DRILL MELIN BRD - H11 | D11 )
( HOLDER STYLE - CT40 SMALL KEYLESS CHUCK )
( TOOL PROJECTION - 1.25 )
( ================================= )
( T12 -  NO. 2-56 YMW FORM TAPRH - H12 | D12 )
( HOLDER STYLE - CT40 - SOLID - JACOBS CHUCK )
( TOOL PROJECTION - 1.2 )
( ================================= )
(---------------------------------------------------------)
(*****END TOOL LIST*****)
I need to add this here

IF[#592EQ1101]GOTO1101 (RESTART FOR T11 FIRST CALL)
IF[#592EQ1201]GOTO1201 (RESTART FOR T12 FIRST CALL)
IF[#592EQ1102]GOTO1102 (RESTART FOR T11 SECOND CALL)

....

....

....

#3000=123(INVALID RESTART)

G20
G0 G17 G40 G49 G80 G90 (SAFETY LINE)




N1101
G103 P1
#592= HERE I NEED TO ADD 1101 FROM 2 LINES ABOVE
G103
(  NO. 47 CARB DRILL MELIN BRD - TOOL - 11 )
T11 M6
IF [ #6 NE 1 ] THEN #3000= 666 (RESET AND CYCLE START)
/M8
G0 G90 G55 X-.5512 Y-.5512 A0. S7299 M3
G43 H11 Z.25 T12
G98 G83 Z-1.0873 R-.5 Q.1 F7.3
X.5512
Y.5512
X-.5512
G80
M09
M5
G91 G28 Z0.
G90 G49
T#3026
G0 G90
G103 P1
G65 P9853 B1. T#3026 H.01
G103
N1201
G103 P1
#592= HERE I NEED TO ADD 1201 FROM 2 LINES ABOVE
G103
(  NO. 2-56 YMW FORM TAPRH - TOOL - 12 )
T12 M6
IF [ #6 NE 1 ] THEN #3000= 666 (RESET AND CYCLE START)
/M8
G0 G90 G55 X-.5512 Y-.5512 A0. S2000 M3
G43 H12 Z.25 T11
G98 G84 Z-1.03 R-.35 J2 F35.7
X.5512
Y.5512
X-.5512
G80
M09
M5
G91 G28 Z0.
G90 G49
T#3026
G0 G90
G103 P1
G65 P9853 B1. T#3026 H.01
G103
N1102
G103 P1
#592= HERE I NEED TO ADD 1102 FROM 2 LINES ABOVE
G103
(  NO. 47 CARB DRILL MELIN BRD - TOOL - 11 )
T11 M6
IF [ #6 NE 1 ] THEN #3000= 666 (RESET AND CYCLE START)
/M8
G0 G90 G55 X-.5512 Y-.5512 A0. S7299 M3
G43 H11 Z.25 T11
G98 G83 Z-1.0873 R-.5 Q.1 F7.3
X.5512
Y.5512
X-.5512
G80
M09
M5
G91 G28 Z0.
G28 Y0.
GOTO9999
N9900(TOOL LENGTH/PROGRAM # CHECKS)
G103 P1
(THIS ROUTINE INCLUDES LENGTH CHECKS FOR PROBE ONLY )
IF[#2025 NE 5.5122] THEN #3000=333 (PROBE LENGTH WRONG)
IF[#2225 NE 0] THEN #3000=334 (NO LENGTH WEAR ALLOWED)
IF[#2625 NE 0] THEN #3000=335 (NO DIA WEAR ALLOWED)
IF[#600 NE2001 ]GOTO9601
IF[#800NE-24.1905]THEN#3000=336(WRONG X VALUE DNL#1)
IF[#801NE-10.0269]THEN#3000=337(WRONG Y VALUE DNL#1)
IF[#806NE-12.1896]THEN#3000=336(WRONG X VALUE DNL#2)
IF[#807NE-10.0271]THEN#3000=337(WRONG Y VALUE DNL#2)
G103
M99
N9600 (ERRORS)
N9601 #3000=336 (WRONG PROGRAM TO RUN)
M99
G103
N9999
G103 P1
G0 G90 G55 X0.
#592=0 (PROGRAM COMPLETE)
G28 G91 A0.0
G103
M30
%
 

Thanks

Link to comment
Share on other sites

I'm not much with macros but by using the logic to get the NXXXX to defining the #592= value.

 

Then change the last #592=  from 0 to 1.

 

And at the beginning add a N1

 

Then you may only need one line to direct the program, something like goto #592.

Link to comment
Share on other sites

After some thought, 

Depending on your post  you are using, you might be able to append  the  following, ptoolcomment,  ptooltable,  psof$,  and useing the subout$ function, you can  obtain this with very little work this was added to the Generic Fanuc 4X Mill, see the result at the posted bottom.

 

Note: Backup you post before you attempt to edit. 

 

# Toolchange / NC output Variable Formats

 

Add in 

fmt  "T" 4  tt          #Tool number GOTO

 

#Address string definitions

 

Add in

stt          : ""
srtt         : "T"

 

 

ptoolcomment    #Comment for tool
 
        Add in after 
        #TOOL RECALL
        tt = t$ + 1000
        "#592=", *tt, e$
        #TOOL RECALL
 
ptooltable      #Tooltable output
 
        Add in  after
        subout$ = 1
        #TOOL RECALL
        tt = t$ + 1000
        result = nwadrs(stt, tt)
        "IF[#592EQ", *tt, "]GOTO", *tt, "(RESTART FOR",  [result = nwadrs(srtt, tt)], *tt,"FIRST CALL)", e$
        result = nwadrs(stt, tt)
        #TOOL RECALL
        subout$ = 0
 
 
psof$            #Start of file for non-zero tool number
 
     Add in before pbld, n$, *smetric, e$
      mergesub$
      clearsub$ 

 

 

%
O0000(T)
(MCX FILE - T)
(MATERIAL - ALUMINUM INCH - 2024)
( T237 |  3/8 FLAT ENDMILL | H237 )
( T239 |  1/2 FLAT ENDMILL | H239 )
( T232 |  1/8 FLAT ENDMILL | H232 )
IF[#592EQ1237 ]GOTO1237 (RESTART FOR T1237 FIRST CALL)
IF[#592EQ1239 ]GOTO1239 (RESTART FOR T1239 FIRST CALL)
IF[#592EQ1232 ]GOTO1232 (RESTART FOR T1232 FIRST CALL)
G20
G0 G17 G40 G49 G80 G90
#592=1237 (TOOL RECALL)
N237 T237 M6
G0 G90 G54 X-.6671 Y-.0023 C0. S1426 M3
G43 H237 Z.25 M8
Z.2
G1 Z0. F6.33
G3 X-.3687 Y-.1502 I.2984 J.2271
G1 X-.0295
Y.0015
X-.7078
Y-.1502
X-.3687
G3 X-.0702 Y-.0023 I0. J.375
G1 Z.2
G0 Z.25
M5
G91 G28 Z0. M9
C0.
M01
#592=1239 (TOOL RECALL)
N239 T239 M6
G0 G90 G54 X-.8687 Y-1.5877 C0. S1069 M3
G43 H239 Z.25 M8
Z.2
G1 Z0. F6.42
Y-1.0877
G2 X-.3687 Y-.5877 I.5 J0.
G1 X.158
G3 X.408 Y-.3377 I0. J.25
G1 Y.189
G3 X.158 Y.439 I-.25 J0.
G1 X-.8953
G3 X-1.1453 Y.189 I0. J-.25
G1 Y-.3377
G3 X-.8953 Y-.5877 I.25 J0.
G1 X-.3687
G2 X.1313 Y-1.0877 I0. J-.5
G1 Y-1.5877
Z.2
G0 Z.25
M5
G91 G28 Z0. M9
C0.
M01
#592=1232 (TOOL RECALL)
N232 T232 M6
G0 G90 G54 X-.4937 Y-.0252 C0. S4278 M3
G43 H232 Z.25
Z.2
G1 Z0. F6.16
Y-.1502
G3 X-.3687 Y-.2752 I.125 J0.
G1 X.0955
Y.1265
X-.8328
Y-.2752
X-.3687
G3 X-.2437 Y-.1502 I0. J.125
G1 Y-.0252
Z.2
G0 Z.25
M5
G91 G28 Z0.
G28 X0. Y0. C0.
M30
%
  • Like 1
Link to comment
Share on other sites
  • 2 weeks later...

What am I doing wrong here? :help:

 

I get this out put with this logic - just a single line with multiple tools and calling the tools at different places within the program

IF[#592EQ1211]GOTO1211 (RESTART FOR : T12)

 

 

 

 

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

# Buffer 1 - Tool Recall Table
# --------------------------------------------------------------------------
wc1         : 1     #Initial count for write buffer 1
rc1         : 1     #Initial count for read buffer 1
size1     : 0     #Buffer 1 size
b1_tool_number    : 0          #Saved Tool number at tool change
b1_ntooltrack    : 0          #Saved tool count
fbuf 1 0 2 0 0    

# Format of Recall List Variables
fmt ""     4    b1_tool_number          #Saved Tool number at tool change
fmt ""     4    b1_ntooltrack          #Saved tool count
fmt ""     5  ptool_count3
recalltable_out    : 1 #Recall Table is written to NC code - flag

pWriteBuffer_1 # Write Tool Buffer at every opertion (@ pre-read)
    b1_tool_number = abs(t$)          #Saved Tool number at tool change
    b1_ntooltrack = ptool_count3      #Tool call count at tool change
    b1_tool_number = wbuf(1,wc1)
    
pRecallTable    #Writes standalone recall table
    size1 = rbuf(1,0)
    rc1 = 1
    recalltable_out = 1
    while rc1 < size1, # Loop to find
        [
        b1_tool_number = rbuf(1, rc1)
        b1_ntooltrack = rbuf(1, rc1)
        ]
            if recalltable_out = 1, "IF[#592EQ", *b1_tool_number, *b1_ntooltrack,"]", "GOTO", *b1_tool_number, *b1_ntooltrack, "(RESTART FOR", ":", "T", *b1_tool_number, ")", e$
            if recalltable_out = 0,

 

 

 

# --------------------------------------------------------------------------      
ptool_count3     # Track number of times each tool is used
      tused3 = finc(11,t$)
      *tused3

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

 

 

pwrtt$          #Pre-read NCI file
      if tool_info > 1 & t$ > 0 & gcode$ <> 1003, ptooltable
      if op_id$ <> prv_op_id$ & gcode$ <> 1003,
         [
         pWriteBuffer_1 # Tool Number // Tool Count    
         ]
         !op_id$

 

 

 

 

psof$            #Start of file for non-zero tool number  
    
      "(*****TOOL RESTART LIST*****)",e$
     pRecallTable

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