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:

McamX Post Guru Help Please


Guest CNC Apps Guy 1
 Share

Recommended Posts

Guest CNC Apps Guy 1

Ok,

 

Here's the citch;

 

My program number is set in the Operations Manager. Cool, works good.

Now I want to set up something funky so follow close. At each tool

change after the height offset executes I want to create a sub call

with a specific starting program number for the first tool and have

it increment up for each subsequent tool change. After posting, I'll

cut out the tool motion portion and paste it in a new file.

 

O100 (TEST)

T1039M06

#148=1

(CHECK CURRENT TOOL OFFSET)

#101=#[10000+#506]

IF[#101LE3.0]GOTO99999

T1040

#148=1

WHILE[#148LE#517]DO1

M11

B0.

G00G54.1P#148G90X0.Y0.S500

G43H99Z2.

M198P2100

 

(START SUB HERE)

O2100 (PROGRAM NAME)

M11

B0.

M10

Z.5

(***** SET XY BORE ZERO *****)

G65P9800R-0.S.375W54.1V#148Z-.2I0.J0.

Z2.

#148=#148+1

M99

(SUB END HERE)

 

END1

M11

G52 X0 Y0 Z0 B0M09

G28 G91 Z0 M219

G30 G91X0 Y0

G49

M01

 

T1040M06

#148=1

(CHECK CURRENT TOOL OFFSET)

#101=#[10000+#506]

IF[#101LE3.0]GOTO99999

T1001

#148=1

WHILE[#148LE#517]DO1

M11

B0.

G00G54.1P#148G90X0.Y0.S500

G43H99Z2.

M198P2100

 

%

O2100 (PROGRAM NAME)

(***START SUB***)

M11

B0.

M10

Z.5

(***** SET XY BORE ZERO *****)

G65P9800R-0.S.375W54.1V#148Z-.2I0.J0.

Z2.

#148=#148+1

(SUB END HERE)

M99

 

END1

M11

G52 X0 Y0 Z0 B0M09

G28 G91 Z0 M219

G30 G91X0 Y0

G49

M01

 

etc...

 

I know that I'll need to cut and paste that's not the issue,

the issue is I can't seem to create a variable to use for the

program number and M198 call and have it count up. It either

stays the same or zeros out for some reason at the next tool

change.

 

What I've tried is creating a new variable;

 

fmt P 3 prognosub1

fmt O 3 prognosub2

 

prognosub1 : 0

prognosub2 : 0

 

sav_prognosub1 = prognosub1

sav_prognosub2 = prognosub2

 

 

 

 

prognosub1=2100

prognosub2=prognosub1

prv_prognosub1=prognosub1

!prognosub1

"M198", *prognosub1, e$

" ", e$

"%", e$

*prognosub2, "(", comment$, ")", e$

"(***START SUB***)", e$

 

I have the above in psof.

 

prognosub1=prv_prognosub1 + 10

prognosub2=prognosub1

prv_prognosub1=prognosub1

!prognosub1

"M198", *prognosub1, e$

" ", e$

"%", e$

*prognosub2, "(", comment$, ")", e$

"(***START SUB***)", e$

 

I have the above in ptlchg

 

Any ideas why it will not count up???

 

Any help would be GREATLY appreciated.

 

Oh, sorry for the long post.

Link to comment
Share on other sites
Guest CNC Apps Guy 1

quote:

...How have you been, I am playing with it...

Don,

I've been doing ok. Running my own business is tough in many respects. There's the "business" side of the business that I'm struggling with. The technical side of the business on the other hand... I have a pretty good handle on things. How you doing?

 

 

Jim,

This is not an MPMaster based post and I'm not really doing true subs and this post does not have any sub variables. It's cut and paste subs where I'm breaking out everything after the height ofset call and before the spindle turn off.

 

Thanks for looking into it guys. I REALLY appreciate it!!!

Link to comment
Share on other sites

This is how my post creates sub numbers; Caution --- this is going to be long!!!

 

code:

process_count : 4000  # Counter start for cutting tools

 

fmt 7 process_count #Counter start for repeat tools

 

ptlchg_com #Tool change common blocks

pcom_moveb

c_mmlt$ #Multiple tool subprogram call

pcan

psubmacroswitch

if mi7$ <> 0, pstopcomment

if (mi2$ = 12 | mi2$ = 22) & toolcount <> 1 & mi2count = 0, pinvertmacro12

if (mi2$ = 13 | mi2$ = 23) & toolcount <> 1 & mi2count = 0, pinvertmacro13

if mi2$ = 35 & toolcount <> 1 & mi2count = 0, pinvertmacro35

if mi2$ = 38 & toolcount <> 1 & mi2count = 0, pinvertmacro38

sav_mr3 = mr3$

if plane$ < 0, plane$ = 0

if stagetool >= zero,

[

pbld, "G91", "G30", "X0", "Y0", "Z0", e$

pbld, "M06", *t$, ptoolcomm, e$

]

process_count = process_count + 10 #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

35, no_spc$, "930=", process_count, e$ #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

spaces$=0

if output_z = yes$,

[

preadbuf5

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

[

n$, pspc, "(", "MAX - ", *max_depth, ")", e$

n$, pspc, "(", "MIN - ", *min_depth, ")", e$

]

]

spaces$=sav_spc

# pstock

pindex

sav_absinc = absinc$

if wcstype > one, absinc$ = zero

if lock_codes = 1 & not(index) & rot_on_x, pbld, n$, *sunlock, "(UNLOCK)", e$

if t$ <> next_tool$, pbld, next_tool$, e$

pcoolanton

if sav_mi2 = 43, mi1$ = process_count #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

sav_mi1 = mi1$ #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

"M98P", *mi1$, e$ #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

subout$ = 3 #ext NC sub #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

psub_st_s$ #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

comment$

 

ptlchg0$ #Call from NCI null tool change (tool number repeats)

if sav_mr3 > zero & tlplnno$ <> prvtpsub, pbld, n$, sg00, "Z", no_spc$, *sav_mr3, e$

sav_mr3 = mr3$

pcuttype

pcom_moveb

toolcount = toolcount + 1

prvtp = rbuf(3,toolcountp)

if toolcountn <= tooltotal, nexttool = rbuf(4,toolcountn)

else, nexttool = first_tool$

if mi10$=one & op_id$<>last_op_id | (tlplnno$ <> prvtp & ret_on_indx), pstop

c_mmlt$ #Multiple tool subprogram call

if tlplnno$ <> prvtpsub, #/ / / / / / / / / / / / / /

[

prv_feed = c9k

if (sav_mi2 = 11 | sav_mi2 = 12 | sav_mi2 = 13) & tlplnno$ <> 5 & prvtpsub = 5,

[

psub_end_s$

p4006

psub_st_s$

]

if (sav_mi2 = 11 | sav_mi2 = 12 | sav_mi2 = 13)

& tlplnno$ = 6 & prvtpsub <> 5 & prvtpsub <> 6,

[

psub_end_s$

p4004

psub_st_s$

]

if (sav_mi2 = 21 | sav_mi2 = 22 | sav_mi2 = 23 | sav_mi2 = 34 | sav_mi2 = 35

| sav_mi2 = 36) & ((tlplnno$ = 2 | tlplnno$ = 5 | tlplnno$ = 6)

| (prvtpsub = 5 | prvtpsub = 6)),

[

psub_end_s$

if mi1$ <> 0 & sav_mi1 <> mi1$,

[

subout$ = 0 #main NC program

sav_mi1 = mi1$

"M98P", *mi1$, e$

subout$ = 3 #ext NC sub

]

psub_st_s$

]

] #/ / / / / / / / / / / / / / /

 

 

psub_st_s$ #Header in sub level

result = nwadrs(stro, sub_prg_no$)

#sav_n2 = n

#n = seqno

 

if sav_mi2 = 43, sub_prg_no$ = process_count

 

if tlplnno$ = 2 & (sav_mi2 = 11 | sav_mi2 = 12 | sav_mi2 = 13),

sub_prg_no$ = process_count + 3

if tlplnno$ = 5 & (sav_mi2 = 11 | sav_mi2 = 12 | sav_mi2 = 13),

sub_prg_no$ = process_count + 1

if tlplnno$ = 6 & (sav_mi2 = 11 | sav_mi2 = 12 | sav_mi2 = 13),

sub_prg_no$ = process_count + 5

if tlplnno$ <> 2 & tlplnno$ <> 5 & tlplnno$ <> 6 & (sav_mi2 = 11 | sav_mi2 = 12

| sav_mi2 = 13), sub_prg_no$ = process_count + 3

 

if tlplnno$ = 2 & (sav_mi2 = 21 | sav_mi2 = 22 | sav_mi2 = 23 | sav_mi2 = 34

| sav_mi2 = 35 | sav_mi2 = 36 | sav_mi2 = 38), sub_prg_no$ = process_count + 2

if tlplnno$ = 5 & (sav_mi2 = 21 | sav_mi2 = 22 | sav_mi2 = 23 | sav_mi2 = 34

| sav_mi2 = 35 | sav_mi2 = 36 | sav_mi2 = 38), sub_prg_no$ = process_count + 1

if tlplnno$ = 6 & (sav_mi2 = 21 | sav_mi2 = 22 | sav_mi2 = 23 | sav_mi2 = 34

| sav_mi2 = 35 | sav_mi2 = 36 | sav_mi2 = 38), sub_prg_no$ = process_count + 3

if tlplnno$ <> 2 & tlplnno$ <> 5 & tlplnno$ <> 6 & (sav_mi2 = 21 | sav_mi2 = 22

| sav_mi2 = 23 | sav_mi2 = 34 | sav_mi2 = 35 | sav_mi2 = 36

| sav_mi2 = 38), sub_prg_no$ = process_count + 2

" ", e$

*sub_prg_no$, e$

spaces$ = 0

# if scomm0 <> snull, "(", no_spc, *scomm0, no_spc, ")", e

spaces$ = sav_spc

# pbld, n, sgabsinc, e

 

psub_st_sm #Header in sub level for system macros

# --NOTE--

# all folowing postblocks are subs,

# I loaded a few to show different ways of giving them numbers

 

result = nwadrs(stro, sub_prg_no$)

spaces$ = 0

spaces$ = sav_spc

if sav_mi2 = 11 | sav_mi2 = 21, p11_5501

if sav_mi2 = 12 | sav_mi2 = 22, p12_5501

if sav_mi2 = 13 | sav_mi2 = 23, p13_5501

if sav_mi2 = 34 | sav_mi2 = 36, p34_5501

if sav_mi2 = 35, p35_5501

if sav_mi2 = 38, p38_5501

if s5502 = 1, p5502

if s5001 = 1, p5001

if s5002 = 1, p5002

if s5003 = 1, p5003

if s5004 = 1, p5004

if s5005 = 1, p5005

if s5006 = 1, p5006

if s5007 = 1, p5007

if s5101 = 1, p5101

if s5102 = 1, p5102

if s5103 = 1, p5103

if s5104 = 1, p5104

if s5105 = 1, p5105

if s5106 = 1, p5106

if s5107 = 1, p5107

if s5201 = 1, p5201

if s5202 = 1, p5202

if s5203 = 1, p5203

if s5204 = 1, p5204

if s5205 = 1, p5205

if s5206 = 1, p5206

if s5207 = 1, p5207

if s5301 = 1, p5301

if s5302 = 1, p5302

if s5303 = 1, p5303

if s5304 = 1, p5304

if s5305 = 1, p5305

if s5306 = 1, p5306

if s5307 = 1, p5307

 

p4002 # subprogram for g68 macro right side

sub_prg_no$ = process_count + 2

" ", e$

sub_prg_no$ , e$

n$, "G90", "G00", "X0", "Y0", "B0", "G54", e$

n$, "G68", "X0", "Y0", "R180.", e$

sub_prg_no$ = process_count + 5

psub_call_s$

n$, "G69", e$

psub_end_s$

 

p4004 # subprogram for g68 macro front side

sub_prg_no$ = process_count + 4

" ", e$

sub_prg_no$ , e$

n$, "G90", "G00", "X0", "Y0", "G54P", no_spc$, 91, no_spc$,

35, no_spc$, "4130+1", no_spc$, 93, e$

n$, "G68", "X0", "Y0", "R180.", e$

sub_prg_no$ = process_count + 3

psub_call_s$

n$, "G69", e$

psub_end_s$

 

p4006 # subprogram for g68 macro left side

sub_prg_no$ = process_count + 6

" ", e$

sub_prg_no$ , e$

n$, "G90", "G00", "X0", "Y0", "B0", "G54", e$

n$, "G68", "X0", "Y0", "R180.", e$

sub_prg_no$ = process_count + 1

psub_call_s$

n$, "G69", e$

psub_end_s$

 

p11_5501 # Start subprogram for system macros 11 & 21

sub_prg_no$ = 5501

" ", e$

sub_prg_no$, "(START)", e$

"G91G30X0Y0Z0", e$

"G91G28B0", e$

pdryrun

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "913EQ1", no_spc$, 93, no_spc$,

"(PALLET TO BE MACHINED)GOTO2", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "913EQ2", no_spc$, 93, no_spc$,

"(PALLET TO BE MACHINED)GOTO3", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ1", no_spc$, 93, no_spc$,

"(PALLET IN WORK AREA)GOTO3", e$

"N2", "M61", e$

35, no_spc$, "910=1", e$

35, no_spc$, "903=", no_spc$, 35, no_spc$, "901", e$

"GOTO4", e$

"N3", "M62", e$

35, no_spc$, "910=2", e$

35, no_spc$, "903=", no_spc$, 35, no_spc$, "911", e$

"N4", "(END PALLET MACRO)", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ1", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "909=", no_spc$, 35, no_spc$, "902", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ2", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "909=", no_spc$, 91, no_spc$, 35, no_spc$,

"912-8", no_spc$, 93, e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ1", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "920=0", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ2", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "920=160", e$

psub_end_s$

 

p12_5501 # Start subprogram for system macros 12 & 22

sub_prg_no$ = 5501

" ", e$

sub_prg_no$, "(START)", e$

"G91G30X0Y0Z0", e$

"G91G28B0", e$

pdryrun

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "914EQ1", no_spc$, 93, no_spc$,

"(PALLET TO BE MACHINED)GOTO2", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "914EQ2", no_spc$, 93, no_spc$,

"(PALLET TO BE MACHINED)GOTO3", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ1", no_spc$, 93, no_spc$,

"(PALLET IN WORK AREA)GOTO3", e$

"N2", "M61", e$

35, no_spc$, "910=1", e$

35, no_spc$, "903=", no_spc$, 35, no_spc$, "901", e$

"GOTO4", e$

"N3", "M62", e$

35, no_spc$, "910=2", e$

35, no_spc$, "903=", no_spc$, 35, no_spc$, "911", e$

"N4", "(END PALLET MACRO)", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ1", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "909=", no_spc$, 35, no_spc$, "902", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ2", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "909=", no_spc$, 91, no_spc$, 35, no_spc$,

"912-8", no_spc$, 93, e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ1", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "920=0", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "910EQ2", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "920=160", e$

"IF", no_spc$,91, no_spc$, 35, no_spc$, "914NE3", no_spc$, 93, no_spc$,

"GOTO104 (PROCESS COUNTING)", e$

"IF", no_spc$, 91, no_spc$, 35, no_spc$, "915GE4", no_spc$, 93, no_spc$,

"THEN", no_spc$, 35, no_spc$, "915=0", e$

35, no_spc$, "915=", no_spc$, 91, no_spc$, 35, no_spc$, "915+1", no_spc$,

93, e$

"N104", "(END PROCESS COUNTING)", e$

psub_end_s$

 

ptoolend$ #End of tool path, before reading new tool data

if nextop$ = 1002,

[

psub_end_s$

if sav_mi1 = 5001, p4006

if sav_mi1 = 5002, p4004

if sav_mi1 = 5003, p4002

subout$ = 0 #main NC program

pcoolantoff

]

 

peof$ #End of file for non-zero tool

if mr3$ > zero & opcode$ <> 3, pbld, n$, sg00, "Z", no_spc$, *mr3$, e$

if plane$ <> 0, plane$ = 0

pbld, n$, sgplane, e$

psub_end_s$ #/ / / / / / / / / /<<<<<<<<<<<<<<<<<<<<<<<<<<

if sav_mi1 = 5001, p4006

if sav_mi1 = 5002, p4004

if sav_mi1 = 5003, p4002

if sav_mi1 = 5004, p4002

if sav_mi1 = 5005, p4004

if sav_mi1 = 5006, p4002

if sav_mi1 = 5007, p4002

subout$ = 0 #main NC program #/ / / / / / / /<<<<<<<<<<<<<

if nexttool = next_tool$, pcoolantoff

pretract

if lock_codes = 1 & rot_on_x, pbld, n$, *sunlock, "(UNLOCK)", e$

rotretflg = 1

pbld, "G91", "G28", "B0", e$

rotretflg = 0

if lock_codes = 1 & rot_on_x, pbld, n$, *slock, "(LOCK)", e$

# comment

#Remove pound character to output first tool with staged tools

#if stagetool = one, pbld, n, *first_tool, e

*sg90, "G53", e$

if (sav_mi2 = 11 | sav_mi2 = 21 | sav_mi2 = 34 | sav_mi2 = 36), peof11

if (sav_mi2 = 12 | sav_mi2 = 22 | sav_mi2 = 38) & mi2count = 1, peof12

if (sav_mi2 = 13 | sav_mi2 = 23 | sav_mi2 = 35) & mi2count = 1, peof13

psub_st_sm

mergesub$

clearsub$

mergeaux$

clearaux$

mergeext$

clearext$

"%", e$

 

snci = spathnci$ + snamenci$ + sextnci$

sparams1 = ssq + sdq + snci + sdq + sspace + sdq

+ spathpst$ + spost1 + sdq + sspace + sdq + spathnc$ + sdq + ssq

This is how my programs look;

code:

%

O0174(619-041)

(DATE: FEB-16-06)

(MASTERCAM POST - ENSHU JE60S)

 

N1 #919=4.

M98P5501

 

G00 G17 G20 G40 G49 G80 G90 G94

IF[#914EQ2](OPERATION TO BE MACHINED)GOTO5(START OPERATION2)

IF[#910EQ2](CURRENT PALLET RUNNING)GOTO5(START OPERATION2)

 

G91 G30 X0 Y0 Z0

M06 T01 (3" DIA FACE MILL FOR ALUM)

#930=4010

T16

M[#926]

M[#927]

M98P5002

M09

M58

M05

G91 G30 X0 Y0 Z0

M01

 

G91 G30 X0 Y0 Z0

M06 T16 (NO.2 CENTER DRILL)

#930=4020

T40

M[#926]

M[#925]

M[#927]

M98P5002

M09

M56

M58

M05

G91 G30 X0 Y0 Z0

M01

 

blah

blah

blah

 

IF[#914EQ1](OPERATION TO BE MACHINED)GOTO6(END PROGRAM)

G91G30X0Y0Z0

G91G28B0

M62

#910=2

#909=#912

#903=#911

N5 (START OPERATION 2)

 

G91 G30 X0 Y0 Z0

M06 T01 (3" DIA FACE MILL FOR ALUM)

#930=4100

T09

M[#926]

M[#927]

M98P5302

M09

M58

M05

G91 G30 X0 Y0 Z0

M01

 

G91 G30 X0 Y0 Z0

M06 T09 (3/8" THREE FLUTE CARBIDE END MILL)

#930=4110

T45

M[#926]

M[#925]

M[#927]

M98P5302

M09

M56

M58

M05

G91 G30 X0 Y0 Z0

M01

 

more blah

 

G91 G30 X0 Y0 Z0

M06 T19 ( 1/4" 90 DEGREE SPOTTING DRILL)

#930=4160

T01

M[#926]

M[#925]

M[#927]

M98P5302

M09

M56

M58

M05

G91 G30 X0 Y0 Z0

G91 G28 B0

G90 G53

 

IF[#914EQ2](OPERATION TO BE MACHINED)GOTO6(END PROGRAM)

M06 T01

/M30

M99P1

N6 M30(END PROGRAM)

 

O5501 (START)

G91G30X0Y0Z0

G91G28B0

IF[#908EQ1]THEN#922=94

IF[#908EQ1]THEN#923=5

IF[#908EQ1]THEN#924=81

IF[#908EQ1]THEN#925=56

IF[#908EQ1]THEN#926=9

IF[#908EQ1]THEN#927=58

IF[#908EQ1]THEN#928=81

IF[#908EQ1]THEN#929=81

IF[#908EQ1]THEN#932=81

IF[#908EQ1]THEN#933=5

IF[#908EQ1]THEN#934=5

IF[#908NE1]THEN#922=95

IF[#908NE1]THEN#923=29

IF[#908NE1]THEN#924=84

IF[#908NE1]THEN#925=51

IF[#908NE1]THEN#926=8

IF[#908NE1]THEN#927=52

IF[#908NE1]THEN#928=83

IF[#908NE1]THEN#929=74

IF[#908NE1]THEN#932=73

IF[#908NE1]THEN#933=3

IF[#908NE1]THEN#934=4

IF[#914EQ1](PALLET TO BE MACHINED)GOTO2

IF[#914EQ2](PALLET TO BE MACHINED)GOTO3

IF[#910EQ1](PALLET IN WORK AREA)GOTO3

N2 M61

#910=1

#903=#901

GOTO4

N3 M62

#910=2

#903=#911

N4 (END PALLET MACRO)

IF[#910EQ1]THEN#909=#902

IF[#910EQ2]THEN#909=#912

IF[#910EQ1]THEN#920=0.

IF[#910EQ2]THEN#920=[[#904]*4*20]

M99

 

O5002 (1 SIDE FRONT FOR CLUSTER VISES 8 PARTS)

#900=[#903-1] (-START FRONT SIDE BOTTOM 0-)

M98P[#930+3] (-RUN FRONT SIDE BOTTOM 0-)

IF[#909LT2]GOTO103(END TOOL)

M98P[#930+4] (-RUN FRONT SIDE TOP 0-)

IF[#909LT3]GOTO103(END TOOL)

G00 Z[#919] (RETRACT)(-END FRONT 0-)

M98P[#930+3] (-RUN FRONT SIDE BOTTOM 90-)

IF[#909LT4]GOTO103(END TOOL)

M98P[#930+4] (-RUN FRONT SIDE TOP 90-)

IF[#909LT5]GOTO103(END TOOL)

G00 Z[#919] (RETRACT)(-END FRONT 90-)

M98P[#930+3] (-RUN FRONT SIDE BOTTOM 180-)

IF[#909LT6]GOTO103(END TOOL)

M98P[#930+4] (-RUN FRONT SIDE TOP 180-)

IF[#909LT7]GOTO103(END TOOL)

G00 Z[#919] (RETRACT)(-END FRONT 180-)

M98P[#930+3] (-RUN FRONT SIDE BOTTOM 270-)

IF[#909LT8]GOTO103(END TOOL)

M98P[#930+4] (-RUN FRONT SIDE TOP 270-)

N103 G00 Z[#919] (RETRACT)(-END TOOL-)

M99

 

O5302 (1 SIDE FRONT FOR TOMBSTONE SAME POSITION 4 FIXTURES)

#900=[#903-1]

#906=0

N1 #900=[#900+1] (-START FRONT SIDE-)

#906=[#906+1]

M98P[#930+2] (-RUN FRONT SIDE-)

IF[#906EQ#904]GOTO2 (RETRACT)

IF[#900LT#909]GOTO1 (START FRONT SIDE)

N2 G00 Z[#919] (-RETRACT-)

#906=0

IF[#900LT#909]GOTO1 (START FRONT SIDE)

G00 Z[#919] (-RETRACT-)

M99

 

O4013

(3" DIA FACE MILL FOR ALUM)

N0100 #919=4.

N0102 #900=[#900+1]

N0104 G00 G90 X1.6 Y-.675 (B0.) B0. G54P[#900]

N0106 G43 H01 Z.75 S6000 M[#933]

N0108 Z.49

N0110 G01 Z.37 F100.

N0112 X-3.75 F20.

N0114 G00 Z.75

N0116 M99

 

O4014

N0118 G90 G00 X0 Y0 G54P[#4130+1]

N0120 G68 X0 Y0 R180.

N0122 M98 P4013

N0124 G69

N0126 M99

 

O4023

(NO.2 CENTER DRILL)

N0128 #900=[#900+1]

N0130 G00 G90 X-.258 Y-.23 (B0.) B0. G54P[#900]

N0132 G43 H16 Z.62 S10000 M[#933]

N0134 Z.47

N0136 G99 G82 Z.192 R.47 P6 F40.

N0138 Y-1.104

N0140 X-1.883

N0142 Y-.23

N0144 G80

N0146 G00 Z.62

N0148 M99

 

O4024

N0150 G90 G00 X0 Y0 G54P[#4130+1]

N0152 G68 X0 Y0 R180.

N0154 M98 P4023

N0156 G69

N0158 M99

 

skip a few subs

 

O4132

(NO.0 CARBIDE CENTER DRILL)

N0954 G00 G90 X.98 Y-.437 (B0.) B0. G54P[#900]

N0956 G43 H15 Z.5 S13000 M[#933]

N0958 Z.35

N0960 G99 G82 Z.21 R.35 P5 F40.

N0962 X.26

N0964 G80

N0966 G00 Z.5

N0968 M99

 

O4142

(NO.60 DRILL)

N0970 G00 G90 X.98 Y-.437 (B0.) B0. G54P[#900]

N0972 G43 H43 Z.5 S13000 M[#933]

N0974 Z.35

N0976 G99 G[#928] Z-.042 R.35 Q.012 F13.44

N0978 X.26

N0980 G80

N0982 G00 Z.5

N0984 M99

%

HTH

I did most of this a few years ago but I think all you need is here.

Link to comment
Share on other sites

James,

 

I dropped your code in the MPFAN.PST and I'm using the std. 'Default' mill MD/CD.

You have some redundant code, but I don't see how that is the problem.

I get this -->

 

code:

%

O0000

N100 G20

N102 G0 G17 G40 G49 G80 G90

=========================+

M198 P2100.

 

%

O2100. ( )

(***START SUB***)

=========================+

N104 T1 M6

....

N140 G28 X0. Y0. A0.

N142 M01

=========================+

M198 P2110.

 

%

O2110. ( )

(***START SUB***)

=========================+

 

N144 T236 M6

N146 G0 G90 G54 X.383 Y.8066 A0. S1711 M3

....

N190 M01

=========================+

M198 P2120.

 

%

O2120. ( )

(***START SUB***)

=========================+

N192 T18 M6

.....

N212 G28 X0. Y0. A0.

N214 M30

%

Link to comment
Share on other sites

Hi folks!

 

About logic of the Post of Mr. Tim Johnson, I would like to say that I know the capabilities of MP Language, but it´s awesome what I saw above. That´s the reason why when a guy comes to me to talk about post-processing in another CAM systems, as Catia, Powermill... I tell to them that their systems really don´t have a true post language. Please, if someone here knows, because I really don´t, which are the CAM systems in the market that has a post languages so powerfull like Mastercam? I never saw something like that in another systems. I´m moved away from Mastercam at this moment, the company that I´m working now chose Catia as CAM systems, but IMHO was a political decision, not technical. I tried hard to open their eyes and make them choose Mastercam, but some guys that are working with me were thinking in place on their resumes Catia experience, and I lost the fight. But when I see our parts and the possibilities that Mastercam allows to us and Catia don´t, especially in post-processing, I really stay sad. We´ve got 10 DMU70Evo on our shop, and during my conversations with the Catia´s dealer, specifically with the post developer, I had to hear the blasfeme that helical interpolation was not available in the post, would be a problem for them (Well, helical interpolation is not a problem, it´s a solution IMHO) because Catia don´t place in the CLdata informations about helical interpolations. Lie. He is lazy.

After that I looked for ICAM software in Canada, and they told me that would not be a problem. As you can see, the dealers sometimes don´t have even the technical expertise to solve the problems and needs of their customers. But I´ve to admit that they have a great marketing. There are another things also, for instance, Catia and the most of systems in the market, as far as I know, doesn´t have a place like this for its users. It´s miserable.

 

Politics, sometimes I hate them ....

 

But thanks for the posts guys. My faith in MC remains untouchable.

 

And good bless the MP language and its creators. At least I´m aware that exists a software like Mastercam and its MP language. Would be worse reverence a trash like the post builders in the market, believing that they are the most outstanding thing that the man created so far. That´s the reason why I agreed with CNC software to keep Mastercam based on MP Language. Post builders IMHO throw away all the imagination and the customization allowed by high-level languages. Your hands keep tied by the switches on the GUI.

 

And sorry for the long post and for the english errors.

 

Regards

 

[ 02-16-2006, 05:02 PM: Message edited by: CAMPOST ]

Link to comment
Share on other sites
Guest CNC Apps Guy 1

Problem solved,

 

I had an "o" and a "p" switched in one of my variables.

 

Guess spelling does matter. tongue.gifbiggrin.gif

 

Thanks a TON guys for pointing me down the right path.

 

CAMPOST,

 

One of Mastercam's greatest assets is the MP Post Language and the ability to severly customize output.

 

Tim,

 

That's some real nice work there. My hats off to you. cheers.gif

 

I just wish I knew how to create buffers. I'd really like to chop out the motion code, and dump that stuff down at the bottom of the program. That would help with the cut and paste. Any suggestions where to start for that? :shrug:

 

Again, thanks a TON cheers.gif

Link to comment
Share on other sites

Now i know that there is a company in Saint Joseph Michigan that is "seriously screwed" if the programmer leaves. Looks like job security to me. Dont get me wrong i picked up a few idea's for myself, but damn at least label the variables incase somebody needs to figure them out one day.

 

lol

:D

Link to comment
Share on other sites

Real nice Tim sorry but copied it to my notebook. biggrin.gifbiggrin.gif

 

Thanks.

 

James could you write a tmp file using the multi post. The one post would be stripped to do the above sub program set-up then the second with be taylored to do the sub the way you want. If memory serves me correct been a couple years but you pick the multipost as one post set your directions or if you use the vbscript method to set the dictories using the standard windows method to put the files where you want and be done with it. Just a thought wish I had time but been so busy altely hard to tell which way is up.

Link to comment
Share on other sites
Guest CNC Apps Guy 1

That may be an option. I want to explore a few other avenues first but that idea definitely has some potential... definitely has potential.

 

 

Thanks a bunch Ron. cheers.gif

Link to comment
Share on other sites

RE: Redundant code

 

prognosub1=2100

prognosub2=prognosub1

prv_prognosub1=prognosub1

!prognosub1

 

It’s good to note that “prv_” variables are somewhat special, as they are automatically created by MP.

You do not have to declare these “prv_” variables. And it’s usually a good idea not to, as this can lead to confusion.

 

If you want/need your own “previous” variables for some reason, I’d suggest using a prefix other than “prv_”. Use “prev_” or “last_” or “saved_”. You get the idea…

 

If in a PST you see this -> *x, *y

The values in these variables are written to output (NC file, etc) and

MP pushes a copy of the value into that variables’ “prv_” var.

In other words, the current values in both x & y are forced to output (* = force the output) and MP also pushes the value that was output from x into “prv_x” and the value that was output from y into ”prv_y”.

 

If in a PST you see this -> !x, !y

The values in X & Y are not output, but the vales in the x & y variables are pushed into “prv_x” and “prv_y”. (! = force update without any output)

 

If in a PST you see this -> x, y

You know that (depending on the output format assigned to x & y) nothing may be output if the values in x & y haven’t changed. The way the MP determines “if the value has changed” is by the ue of the auto “prv_name” variables.

 

Now about that redundant code

 

In James’ sample code I noticed this ->

prv_prognosub1=prognosub1

!prognosub1

 

Line #1 explicitly assigns the value in “prognosub1” into “prv_prognosub1”.

Line #2 also takes the value in “prognosub1” and pushes it into “prv_prognosub1”.

 

Now this in itself may not cause a problem, but items like this have to potential to create confusion. (aka. “The WTF?!?, Why doesn’t this work?” Factor)

Link to comment
Share on other sites

Thanks for the kind words guys. Almost all the info I needed to modify my posts came from what I've learned on this forum and I thank everyone that's helped me.

 

Roger,

Thanks for this info. I knew the prv_ was used for MC variables but didn't realize it was for all of them. I guess I should have figured that out when I've had to put an * before some of mine. redface.gif

 

James,

No buffers were used to put the tool paths at the enf of the file shown. I also need to learn buffers but for a completely different reason. What you use is subouts;

code:

      "M98P", *mi1$, e$ #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

subout$ = 3 #ext NC sub #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

psub_st_s$ #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

comment$

a little further down;

code:

          if mi1$ <> 0 & sav_mi1 <> mi1$,

[

subout$ = 0 #main NC program

sav_mi1 = mi1$

"M98P", *mi1$, e$

subout$ = 3 #ext NC sub

]

psub_st_s$

in peof;

code:

      psub_st_s

mergesub$

clearsub$

mergeaux$

clearaux$

mergeext$

clearext$

"%", e$

There's a very nice v9 subout tutorial post on the ftp site created by Jimmy Wakeford.

 

ftp://www.ppcadcam.com/Mastercam_forum/Te...STRP_subout.zip

 

I was using subouts within a few hours after reading this post.

 

HTH

Link to comment
Share on other sites
Guest CNC Apps Guy 1

Roger,

 

Thank you VERY much for the tutorial. biggrin.gif I have the "!" because I wanted to make certain that it's value was updated and because the values were not kicking over and counting up . So now, I'll go edit my post to do some "tidying up". biggrin.gif

 

Thanks again Roger.

Link to comment
Share on other sites

James,

 

I use subout$ = 0 to send the output to the .nct

and subout$ = 1 to send the output to the .sub

 

In the ops manager, I change the program number for each different sub needed, post it, then it's cut & paste time.

 

In the subs themselves I'll attempt to fit all the code I need for a single WCS ,mill code & drill code and use I(#5) from the main and an IF statement w/ closing Goto to jump to the section of the sub I need.

 

(call from main)(L=# of sides of tombstone)

(.500 EMILL)

G65P21L___ S3200 F18.I1.

|

tool change

|

(.375 EMILL)

G65P21L___ Z-.25S4800 F16.I2.

|

tool change

|

(.250 DRILL)

G65P21L___ T83.E98.Z-.4215V-.3R.1Q.312S4800 F16.I3.

|

End of main prg code

 

(sub code)

O21(SUB FOR WCS 1)

IF [#5 EQ 2.] GOTO 120

IF [#5 EQ 3.] GOTO 130

N110(.500 EMILL)

G90G00X___Y___S#19M03

|

|

|

GOTO 197

N120(.375 EMILL)

G90G00X___Y___S#19M03

|

|

|

GOTO 197

N130(DRILLS)

G90G00X___Y___S#19M03

Z.25M08

G#20

G#8

X0.Y0.Z#26R#18Q#17F#9

X-.5Y.375Z#22R[#18-.1]

|

etc

|

N197(OUTTA HERE CODE )

 

if there is multiple identical parts in that plane I'll enclose the sub code w/in a loo like this

O21

#21=55

WHILE[#21LE58]DO1

prevoius code

N197( CLEARANCE PLANE CODE)

#21=[21+1]

END1

N198(OUTTA HERE CODE)(+ call to incremental index of tombstone sub)

 

 

cp

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