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:

next_tool$ comment


Plastmo
 Share

Recommended Posts

Look at the way MP master handles the tool list in the header. It is buffers.

Here is part of (my modified)postblock that gets the info from the buffer......

You can make another call that uses rc2 = next_tool$ instead of rc2 = t$. You would also want to remove the recursive countdown of all tools. The buffer wrt's for buf2 and buf4 would be the same as in MPmaster, that I didn't include..

 

 

code:

  ptooltable # Write tool table, scans entire file, null tools are negative

# Modified 8-11-09 RB to place tools in numeric order using Buffer 2 and 4

tnote = t$

toffnote = tloffno$

tlngnote = tlngno$

spaces$=0

size4 = rbuf(4, 0)

rc4 =1

while rc4 <= size4,

[

t$ = rbuf(4, rc4)

 

if t$ > zero,

[

rc2 = t$

strtool$ = rbuf(2, rc2)

if tcr$>0, "(", *t$, ptspace, " * ", plistcomm, " * ", ")", e$

if tcr$=0, "(", *t$, ptspace, " * ", plistcomm, " * ", ")", e$

!tcr$

]

]

rc4 =1

#!tS

#!strtool$

 

spaces$=sav_spc

Link to comment
Share on other sites

Zoober - My method is similar. Here it is:

 

 

As always, back up your post first. OK.

 

Buffered comments are working fine for me.

 

My example is added to the X4 Mpmaster post.

 

Add a string buffer:

 

code:

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

# Buffer 8 - Holds the string 'strlool$' for each toolpath segment

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

rc8 : 1 #RP

wc8 : 1 #RP

index : 1 #RP

snext_comment : "" #RP

fbuf 8 1 80 0 1 # Buffer 8

Fill the buffer while the tooltable is being output:

 

code:

plistcomm  # Comments from tool library

strtool$=ucase(strtool$)

if strtool$=snull, strtool$ = snocomm

 

index = t$ #RP

strtool$ = wbuf(8,index) #RP

*strtool$

 

nstrlen = strlen(strtool$)

counter = 1

while counter <= (20-nstrlen), pspace


Then add the read and output lines to ptlchg_com:

 

code:

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

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$

]

index = next_tool$ #RP

snext_comment = rbuf(8,index) #RP

next_tool$, "(", snext_comment, ")", e$ #RP

spaces$=0

if output_z = yes$,

[

preadbuf5

if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,

[

n$, pspc, scomm_str, "MAX - ", *max_depth, scomm_end, e$

n$, pspc, scomm_str, "MIN - ", *min_depth, scomm_end, e$

]

]

spaces$=sav_spc

pstock

if plane$ < 0 | opcode$ = 3 | opcode$ = 16, plane$ = 0

sav_absinc = absinc$

if wcstype > one, absinc$ = zero

pindex

if safe_index,

[

if lock_codes = one & not(index) & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$

pbld, n$, pgear, e$

pcan1, pbld, n$, *sgcode, sgplane, [if not(index), sgabsinc, pwcs], pfcout, strcantext, e$

if lock_codes = one & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$

if convert_rpd$ = one,

[

gcode$ = one

feed = maxfeedpm

ipr_type = zero

]

pbld, n$, sgcode, [if gcode$ = 1, sgfeed], pfxout, pfyout, pfspindleout, [if gcode$ = 1, *feed], e$

]

else,

[

if lock_codes = one & not(index) & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$

pbld, n$, pgear, e$

if convert_rpd$ = one,

[

gcode$ = one

feed = maxfeedpm

ipr_type = zero

]

pcan1, pbld, n$, *sgcode, sgplane, [if not(index), sgabsinc, pwcs], [if gcode$ = 1, sgfeed], pfcout, pfxout, pfyout,

pfspindleout, [if gcode$ = 1, *feed], strcantext, e$

if lock_codes = one & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$

]

phsm1_on #must remain before G43

pbld, n$, "G43", *tlngno$, pfzout, scoolant, e$ #next_tool$, e$ #RP Commented out next_tool$

pcan2 #Added so M and G codes in canned text will output before phsm2_on

phsm2_on #must remain after G43

sav_coolant = coolant$

if coolant$ = 1, sm09 = sm09_0

if coolant$ = 2, sm09 = sm09_1

if coolant$ = 3, sm09 = sm09_2

absinc$ = sav_absinc

pcom_movea

toolchng = zero

c_msng$ #Single tool subprogram call

plast

Now I'm outputting like this:

 

code:

%

O0100 (NEW)

(MC-510VF MATSUURA)

(MCX FILE - D:X2MR2SP1MCXMILLNEW.MCX)

(PROGRAM - NEW.NC)

(DATE - DEC-15-2009)

(TIME - 9:28 AM)

(T1 - 3" FACE MILL - H1 - D24 - D3.0000")

(T2 - 1/2" EM - H2 - D25 - D0.5000")

(T3 - #2 C'DRILL - H3 - D26 - D0.0800")

(T4 - #38 DRILL - H4 - D27 - D0.1015")

(T5 - #1 C'DRILL - H5 - D28 - D0.0500")

(T6 - #47 DRILL - H6 - D29 - D0.0785")

(T7 - 3/16" C'SINK - H7 - D30 - D0.0600")

(T8 - 4-40 ROLL TAP - H8 - D31 - D0.1120")

(T9 - 2-56 ROLL TAP - H9 - D32 - D0.0860")

(OVERALL MAX - Z.05)

(OVERALL MIN - Z-.625)

G00 G17 G20 G40 G80 G90

G91 G28 Z0.

(SKIM TOP)

(COMPENSATION TYPE - COMPUTER)

T1 M06 ( 3" FACE MILL)

T2 ( 1/2" EM )

(MAX - Z.05)

(MIN - Z-.01)

G90 G54

G00 G17 X5.0443 Y-.9016 S5800 M03

G43 H1 Z.05 M08

Z.01

G94 G01 Z-.01 F40.

X-2.5461

G02 Y1.0734 I0. J.9875

G01 X5.0443

G00 Z.05 M09

M05

G91 G28 Z0.

M01

(PROFILE)

(COMPENSATION TYPE - WEAR COMP)

T2 M06 ( 1/2" EM)

T3 ( #2 C'DRILL )

(MAX - Z.05)

(MIN - Z-.625)

G90 G54

G00 G17 X3.4993 Y1.8235 S6000 M03

G43 H2 Z.05 M08

Z.01

G94 G01 Z-.1563 F2.

G41 D25 Y1.4235 F25.

Y-1.2517

G02 X2.9943 Y-1.7567 I-.505 J0.

G01 X-2.8961

G02 X-3.4011 Y-1.2517 I0. J.505

G01 Y1.4235

G02 X-2.8961 Y1.9285 I.505 J0.

G01 X2.9943

G02 X3.4993 Y1.4235 I0. J-.505

G01 G40 X3.8993

X3.4993 Y1.8235

Z-.3125 F2.

G41 D25 Y1.4235 F25.

Y-1.2517

G02 X2.9943 Y-1.7567 I-.505 J0.

G01 X-2.8961

G02 X-3.4011 Y-1.2517 I0. J.505

G01 Y1.4235

G02 X-2.8961 Y1.9285 I.505 J0.

G01 X2.9943

G02 X3.4993 Y1.4235 I0. J-.505

G01 G40 X3.8993

X3.4993 Y1.8235

Z-.4688 F2.

G41 D25 Y1.4235 F25.

Y-1.2517

G02 X2.9943 Y-1.7567 I-.505 J0.

G01 X-2.8961

G02 X-3.4011 Y-1.2517 I0. J.505

G01 Y1.4235

G02 X-2.8961 Y1.9285 I.505 J0.

G01 X2.9943

G02 X3.4993 Y1.4235 I0. J-.505

G01 G40 X3.8993

X3.4993 Y1.8235

Z-.625 F2.

G41 D25 Y1.4235 F25.

Y-1.2517

G02 X2.9943 Y-1.7567 I-.505 J0.

G01 X-2.8961

G02 X-3.4011 Y-1.2517 I0. J.505

G01 Y1.4235

G02 X-2.8961 Y1.9285 I.505 J0.

G01 X2.9943

G02 X3.4993 Y1.4235 I0. J-.505

G01 G40 X3.8993

X3.4943 Y1.8235

G41 D25 Y1.4235

Y-1.2517

G02 X2.9943 Y-1.7517 I-.5 J0.

G01 X-2.8961

G02 X-3.3961 Y-1.2517 I0. J.5

G01 Y1.4235

G02 X-2.8961 Y1.9235 I.5 J0.

G01 X2.9943

G02 X3.4943 Y1.4235 I0. J-.5

G01 G40 X3.8943

G00 Z.05 M09

M05

G91 G28 Z0.

M01

(C'DRILL FOR .1015)

T3 M06 ( #2 C'DRILL)

T4 ( #38 DRILL )

(MAX - Z.05)

(MIN - Z-.1186)

G90 G54

G00 G17 X-2.2348 Y.8508 S6000 M03

G43 H3 Z.05 M08

G94

G98 G81 Z-.1186 R.01 F12.

X-1.2586 Y.619

X-1.5881 Y-.1254

X-1.1976 Y-.6135

X-.8193 Y-.3206

X.047 Y.2407

X.9866 Y.1065

X1.7676 Y-.4792

G80 M09

M05

G91 G28 Z0.

M01

(DRILL FOR 4-40)

T4 M06 ( #38 DRILL)

T5 ( #1 C'DRILL )

(MAX - Z.05)

(MIN - Z-.4)

G90 G54

G00 G17 X-2.2348 Y.8508 S2634 M03

G43 H4 Z.05 M08

G94

G98 G83 Z-.4 R.01 Q.0305 F4.22

X-1.2586 Y.619

X-1.5881 Y-.1254

X-1.1976 Y-.6135

X-.8193 Y-.3206

X.047 Y.2407

X.9866 Y.1065

X1.7676 Y-.4792

G80 M09

M05

G91 G28 Z0.

M01

(C'DRILL FOR .0785)

T5 M06 ( #1 C'DRILL)

T6 ( #47 DRILL )

(MAX - Z.05)

(MIN - Z-.0847)

G90 G54

G00 G17 X2.2557 Y-.5768 S6000 M03

G43 H5 Z.05 M08

G94

G98 G81 Z-.0847 R.01 F9.

X2.3289 Y.1187

X1.8774 Y.8631

X1.4381 Y.619

X.5473

X-.4045 Y.8508

X-.7705 Y.2773

X-2.064 Y.2041

X-2.1494 Y-.6013

X-.075 Y-.345

X.2789 Y-.6623

X.8402 Y-.4182

X1.3283 Y-.4914

G80 M09

M05

G91 G28 Z0.

M01

(DRILL FOR 2-56)

T6 M06 ( #47 DRILL)

T7 ( 3/16" C'SINK )

(MAX - Z.05)

(MIN - Z-.28)

G90 G54

G00 G17 X2.2557 Y-.5768 S3406 M03

G43 H6 Z.05 M08

G94

G98 G83 Z-.28 R.01 Q0. F3.82

X2.3289 Y.1187

X1.8774 Y.8631

X1.4381 Y.619

X.5473

X-.4045 Y.8508

X-.7705 Y.2773

X-2.064 Y.2041

X-2.1494 Y-.6013

X-.075 Y-.345

X.2789 Y-.6623

X.8402 Y-.4182

X1.3283 Y-.4914

G80 M09

M05

G91 G28 Z0.

M01

(4-40 TO .130)

T7 M06 ( 3/16" C'SINK)

T8 ( 4-40 ROLL TAP )

(MAX - Z.05)

(MIN - Z-.065)

G90 G54

G00 G17 X-2.2348 Y.8508 S6000 M03

G43 H7 Z.05 M08

G94

G98 G81 Z-.065 R.01 F8.

X-1.2586 Y.619

X-1.5881 Y-.1254

X-1.1976 Y-.6135

X-.8193 Y-.3206

X.047 Y.2407

X.9866 Y.1065

X1.7676 Y-.4792

G80

(2- 56 TO .100)

X2.2557 Y-.5768

G98 G81 Z-.05 R.01 F8.

X2.3289 Y.1187

X1.8774 Y.8631

X1.4381 Y.619

X.5473

X-.4045 Y.8508

X-.7705 Y.2773

X-2.064 Y.2041

X-2.1494 Y-.6013

X-.075 Y-.345

X.2789 Y-.6623

X.8402 Y-.4182

X1.3283 Y-.4914

G80 M09

M05

G91 G28 Z0.

M01

(TAP 4-40)

T8 M06 ( 4-40 ROLL TAP)

T9 ( 2-56 ROLL TAP )

(MAX - Z.05)

(MIN - Z-.35)

G90 G54

G00 G17 X-2.2348 Y.8508

G43 H8 Z.05 M08

G95

M29 S3200

G98 G84 Z-.35 R.01 F.025

X-1.2586 Y.619

X-1.5881 Y-.1254

X-1.1976 Y-.6135

X-.8193 Y-.3206

X.047 Y.2407

X.9866 Y.1065

X1.7676 Y-.4792

G80 M09

M05

G91 G28 Z0.

M01

(TAP 2-56)

T9 M06 ( 2-56 ROLL TAP)

T1 ( 3" FACE MILL )

(MAX - Z.05)

(MIN - Z-.245)

G90 G54

G00 G17 X2.2557 Y-.5768

G43 H9 Z.05 M08

G95

M29 S3200

G98 G84 Z-.245 R.01 F.0179

X2.3289 Y.1187

X1.8774 Y.8631

X1.4381 Y.619

X.5473

X-.4045 Y.8508

X-.7705 Y.2773

X-2.064 Y.2041

X-2.1494 Y-.6013

X-.075 Y-.345

X.2789 Y-.6623

X.8402 Y-.4182

X1.3283 Y-.4914

G80 M09

M05

G91 G28 Z0.

G28 Y0.

M30

%

Sorry so long and I hope this helps. smile.gif

 

[ 12-15-2009, 10:05 AM: Message edited by: Mastercam Guru ]

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