Recommended Posts

Hello everyone,

  I am trying to make XXX digits as show shown.  I think it is something about LEADING NUMBERS but don't know where to start.  Please see below and thanks for the help.

 

==============

#602 = 2 (T2= 1.25, 1,1/4 INSERT EM, R0.0828, * Z-7.2595)                    Should be T002
#603 = 3 (T3= 1., 1 Inch EM, * Z-3.1563)                                                     Should be T003
#604 = 4 (T4= .3594, 23/64 STUB DRILL, * Z-3.7983)                                Should be T004
#605 = 5 (T5= 2., 2" SHM 90DEG, R0.0250, FIN, * Z0.)                              Should be T005
#607 = 7 (T7= .5156, 33/64 STUB DRILL, * Z-1.7575)                                Should be T007
#608 = 8 (T8= .6094, .6094, 39/64 STUB DRILL, * Z-1.465)                      Should be T008
#610 = 10 (T10= .6042, 1/2-13 FLAT BOTTOM CUT TAP, * Z-1.375)       Should be T010 
#612 = 12 (T12= .375, 3/8 EM, RG, * Z-3.75)                                              Should be T012 
#613 = 13 (T13= .415, .415" REAMER, * Z-3.7313)                                    Should be T013
#614 = 14 (T14= .246, LTR. D STUB DRILL, * Z-.4208)                               Should be T014
#615 = 15 (T15= .2505, .2505 REAMER, * Z-.3312)                                   Should be T015
#617 = 17 (T17= .25, 1/4 Keyseater, * Z-.62)                                             Should be T017
#620 = 20 (T20= .1875, 3/16 EM, * Z-.65)                                                   Should be T020
#623 = 23 (T23= .5, 1/2 EM, RG, * Z-1.5)                                                     Should be T023
#625 = 25 (T25= 1., 1" INSERT MILL, R0.0316, * Z-3.1875)                      Should be T025
#630 = 30 (T30= .25, 1/4 CHMF, * Z-3.7313)                                              Should be T030
#631 = 31 (T31= .25, 1/4 SPOTTER - 90°, * Z-.1)                                        Should be T031

Share this post


Link to post
Share on other sites

fs2 6   3 0 3 0l     #Integer, force three leading

fmt  "T" 6  t$       #Tool number

Share this post


Link to post
Share on other sites

Here is the issue. 

Both the Tool List output, and the Tool Number output (in your NC Code), use the same output variable. So if you edit the Format Assignment for 't$' in the Tool Table output, it will affect all of your code.

You have 2 options, depending on your level of understanding of the MP Language.

You can create a User Defined variable, and copy the value of 't$', so that you can have independent formats for the two variables. This is probably the easiest way for a beginner to use.

The other option is to use the 'New Format Function', to assign a different Format Statement (numeric output format), to 't$', and then re-assign the 'Integer Format, Not-Leading, (4)', back to 't$', at the start of 'psof$'.

 

Share this post


Link to post
Share on other sites
On 1/24/2021 at 7:55 AM, Elvincnc said:

fs2 6   3 0 3 0l     #Integer, force three leading

fmt  "T" 6  t$       #Tool number

 

I changed and it didn't work.

Share this post


Link to post
Share on other sites
18 hours ago, PcRobotic said:

 

I changed and it didn't work.

Are you positive that 't$' is the output variable for the Tool Table? I think there is a different output variable, which possibly gets assigned the numeric value from 't$'.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Colin Gilchrist said:

Are you positive that 't$' is the output variable for the Tool Table? I think there is a different output variable, which possibly gets assigned the numeric value from 't$'.

Agreed, here was my attempt at this back in X7 that never worked out. I kept getting the Tool Number in the Tooltable off by 1 when the tool offset repeated.

pwrtt$           #Buffer toolchange information, tooltable = 3 calls on 1003
      if gcode$ = 1001, psetup
      pcut_cctyp
      if opcode$=104 | opcode$=105 | opcode$=three | opcode$=16, cc_pos$ = zero
      if gcode$ <> 1001, plast_recd
      pcur_recd
      if gcode$ <> 1003, cc_pos$ = zero
      !opcode$, !tool_op$
      if gcode$ = 1003,
        [
        size1 = rbuf (one, zero)
        rc1 = one
        if rc1 < size1, preadcur_nxt
        if cc_1013$ = zero, cc_pos$ = zero
        ]
      #if you want repetitive tool output, keep the abs( ) in ptooltable and remove the >= t$ from the pwrtt call to this block        
      #if (tool_info = 2 | tool_info = 3) & gcode$ <> 1003 & op_id$ <> last_op_id & last_tloffno <> tloffno$ & t$ >= 0, ptooltable
      if (tool_info = 2 | tool_info = 3) & gcode$ <> 1003 & op_id$ <> last_op_id & last_tloffno <> tloffno$, ptooltable #This allows us to see the same tool with different offset
      last_tloffno = tloffno$ #This controls the different offset tracking not to duplicate it when they are used in the operations
      last_op_id = op_id$
      last_t = t$ #Trying to save the tool to keep subtraction from happening in the tool list when the same tool is called


ptooltable # Write tool table, scans entire file, null tools are negative
           #if you want repetitive tool output, keep the abs( ) in ptooltable and remove the >= t$ from the pwrtt call to this block
           toolno = t$ * 100 + tloffno$
           tnote = abs(toolno) #use to be this abs(t$), but we want it to look different so we changed
           tldianote = abs(tldia$) #Oct-20-08 AEH
           [if spindle_no$ = 0, ntooltrack = t$],[if spindle_no$ = 1, ntooltrack = t$ + 1000]
           ntooltrack = abs(ntooltrack) #See it used else where Figure why not
           if opcode$ = 3 | opcode$ = 16, toffnote = tlngno$
           else, toffnote = tloffno$
           stinsert2 = ucase(stinsert2)
           !spaces$
           spaces$ = zero
           if posttype$ = 2,    #lathe tools
             [
             scomm_str, *tnote, " - ", *ntooltrack, " - ", plistcomm, " - ", *toffnote, pdspace, " - ", *stinsert, *stinsert2, " - ", *stholder, *stholder2, scomm_end, e$
             #scomm_str, *tnote, ptspace, " - ", *toffnote, pdspace, " - ", *stinsert, *stinsert2, " - ", *stholder, *stholder2, scomm_end, e$
             ]
           else,                  #mill tools
             [
             if opcode$ = 3 | opcode$ = 16,
               [
               if tcr$ = 0, scomm_str, *tnote, " - ", *ntooltrack, " - ", plistcomm, " - ", *tldianote, punit, pdiamspc, scomm_end, e$
               ]
             else,
               [
               if tcr$ > 0, scomm_str, *tnote, " - ", *ntooltrack, " - ", plistcomm, " - ", *toffnote, pdspace, " - ", *tldianote, punit, pdiamspc, " - ", *tcr$,  punit, scomm_end, e$
               if tcr$ = 0, scomm_str, *tnote, " - ", *ntooltrack, " - ", plistcomm, " - ", *toffnote, pdspace, " - ", *tldianote, punit, pdiamspc,  scomm_end, e$
               ]
             ]
           spaces$ = prv_spaces$

 

Share this post


Link to post
Share on other sites
On 1/26/2021 at 6:43 PM, PcRobotic said:

 

I changed and it didn't work.

This worked for me. Are u using the correct variable?

ptooltable      #Tooltable output
      !spaces$, spaces$ = 0
	  result = newfs(6, t$)
      sopen_prn, *t$, sdelimiter, sdelimiter, pstrtool, sdelimiter, *tlngno$,
        [if comp_type > 0 & comp_type < 4, sdelimiter, *tloffno$, sdelimiter, *scomp_type, sdelimiter, *tldia$],
        [if xy_stock <> 0 | z_stock <> 0, sdelimiter, *xy_stock, sdelimiter, *z_stock],
        sclose_prn, e$
      xy_stock = 0, z_stock = 0  #Reset stock to leave values
         #Reset stock to leave values
      result = newfs(4, t$)
      spaces$ = prv_spaces$

I used newfs to change the output.

Result:

(T001||VLAKFREES Ø50/Ø57.8 TEAGUTEC |H1)
(T002||10 FLAT ENDMILL |H2|XY STOCK TO LEAVE - 1.|Z STOCK TO LEAVE - 0.)
(T057||12 FLAT ENDMILL |H57)

 

Share this post


Link to post
Share on other sites
On 1/28/2021 at 8:15 AM, Werktuigbouwer said:

This worked for me. Are u using the correct variable?

ptooltable      #Tooltable output
      !spaces$, spaces$ = 0
	  result = newfs(6, t$)
      sopen_prn, *t$, sdelimiter, sdelimiter, pstrtool, sdelimiter, *tlngno$,
        [if comp_type > 0 & comp_type < 4, sdelimiter, *tloffno$, sdelimiter, *scomp_type, sdelimiter, *tldia$],
        [if xy_stock <> 0 | z_stock <> 0, sdelimiter, *xy_stock, sdelimiter, *z_stock],
        sclose_prn, e$
      xy_stock = 0, z_stock = 0  #Reset stock to leave values
         #Reset stock to leave values
      result = newfs(4, t$)
      spaces$ = prv_spaces$

I used newfs to change the output.

Result:

(T001||VLAKFREES Ø50/Ø57.8 TEAGUTEC |H1)
(T002||10 FLAT ENDMILL |H2|XY STOCK TO LEAVE - 1.|Z STOCK TO LEAVE - 0.)
(T057||12 FLAT ENDMILL |H57)

 

This is exactly what I was referring to above. Using the 'newfs' function to apply a "new format statement number" to the variable, and then changing it back after you've finished outputting the value (the 2nd 'newfs' function occurs below the output line, and has the effect of "switching the output back to the original format statement number".

Thanks for providing the sample code. Hopefully Steven can apply this to his Post, but he will have to figure out which variable he is actually using inside 'ptooltable'.

Werktuigbouwer,

Steven (PCRobotic) has been a member for a long time, and has developed a Post Processor that has probably 100's of customized functions. Often there is so much customization made, that it has broken the 'default structure' of how the NCI variables normally work. As in this example; he modified the Format Assignment for 't$', but he said that didn't modify the output. That tells me he has a different 'user-defined' output variable in use in the Tool Table output. So keep this history in mind when suggesting code solutions, as there is always a potential that Steven's Post has a much different structure than either the Generic Fanuc 4X Mill Post, or the MPMaster 4X Mill Post.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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