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:

MP Sub Rep Post Question


BK
 Share

Recommended Posts

Yeah it's me again, got another question about a basicaly off the shelf mpsubrep post.

I made a few changes on this post only to accomodate thru spindle coolant or air blow. It seems to work just fine but one of our operators was complaining (imagine that) about the coolant cancellation codes being mucked up when using the sub rep post, specifically when using the air blow (M51, M59).

Anyway after taking a look at the code I noticed something really strange. The first tool in the program uses air blow and posts the M51 to turn it on. At the end of the machining op it is posting an M9 which doesn't shut off the air blow.

 

Here's the strange part, the next tool uses air blow, posts an M51 and when it is finished it posts an M59 which is correct.

 

I'm at a loss as to why this is occurring. I have posted the sample code and also the coolant definition section and the cancellation code also.

 

I'm also a little confused as to why there is a pcooloff and a pcooloff1 bonk.gif

 

If anybody has any ideas it would be much appreciated!

 

Sample code . . .

 

%

O2175

(PROGRAM NAME - T.NC)

(DATE - AUG-20-04 TIME - 10:27)

(OVERALL MAX | Z1.)

(OVERALL MIN | Z-.7083)

G0 G17 G20 G40 G49 G80 G90 G98

G91 G28 Z0

T23

M6 ( 3/4" 3 FLUTE ISCAR INDEXABLE END MILL)

(MAX | Z1.)

(MIN | Z.02)

G90 G56 X5.9599 Y-.5992 S5093 M3 T13

G43 H23 Z1. M51 (Good)

M98 P2176

G0 G90 G57 X5.9599 Y-.5992

M98 P2176

M5

G91 G28 Z0 M9 (Bad)

M1

T13

M6 ( INGERSOLL 90 DEGREE SPOT DRILL)

G0 G17 G20 G40 G49 G80 G90 G98

(MAX | Z1.)

(MIN | Z-.074)

G90 G57 X.2 Y-.175 S9250 M3 T5

G43 H13 Z1. M51 (Good)

M98 P2177

G0 G90 G56 X.2 Y-.175

M98 P2177

M5

G91 G28 Z0 M59 (Good)

M1

 

pcooloff # Coolant off "M" code output

if coolant > zero, *sm09

if coolant = 1, sm09 = sm09_0

if coolant = 2, sm09 = sm09_1

if coolant = 3, sm09 = sm09_2

 

 

pcooloff1 # Coolant off "M" code output

if coolant > zero, *sm09

if coolant = 1, sm09 = sm09_0

if coolant = 2, sm09 = sm09_1

if coolant = 3, sm09 = sm09_2

coolflg = 0

 

 

# ------------------------------------------------# Select Coolant G code

sm09 M9 #Coolant Off (Use sm09_0 through sm09_2)

sm08 M8 #Coolant Flood

sm08_1 M51 #Coolant Mist

sm08_2 M88 #Coolant Tool

sm09_0 M9 #Coolant Flood Off

sm09_1 M59 #Coolant Mist Off

sm09_2 M89 #Coolant Tool Off

 

smcool # Target string

 

fstrsel sm09 coolant smcool

 

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

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

code:

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

# Coolant M code selection

sm09 M9 #Coolant Off (Use sm09_0 through sm09_2)

sm08 M8 #Coolant Flood

sm08_1 M51 #Coolant Mist a.k.a. - Air Blast

sm08_2 M88 #Coolant Tool a.k.a. -High Pressure Coolant

sm09_0 M9 #Coolant Flood Off

sm09_1 M59 #Coolant Mist Off

sm09_2 M89 #Coolant Tool Off

scoolant #Target for string

 

fstrsel sm09 coolant scoolant

 

 

if coolant = 1, sm09 = sm09_0

if coolant = 2, sm09 = sm09_1

if coolant = 3, sm09 = sm09_2

HTH

Link to comment
Share on other sites

Thanks for the info James, any idea why my post would barf on this section . . .

 

fstrsel sm09 coolant scoolant

 

if coolant = 1, sm09 = sm09_0

if coolant = 2, sm09 = sm09_1

if coolant = 3, sm09 = sm09_2

 

Here is the post error message, seems kind of strange, I'm not sure why the if conditional is not working.

Thanks,

BK

 

 

Combined Mill and Lathe Post Processor Version 9.10 © Copyright 1992-2003 CNC Software, Inc.

Processing file with MPSUBREP...

Variable not defined: ifcoolant

Post line number 525

Program execution halted due to error(s) in .pst

Variable not defined: ifcoolant

Post line number 526

Program execution halted due to error(s) in .pst

Variable not defined: ifcoolant

Post line number 527

Program execution halted due to error(s) in .pst

Link to comment
Share on other sites

Here is the debug code, the post is back to it's original from . . .

 

T23 psof

M6 ( 3/4" 3 FLUTE ISCAR INDEXABLE END MILL) psof ptoolcomm

(MAX | Z1.) psof

(MIN | Z.02) psof

G90 G56 X5.9599 Y-.5992 S5093 M3 T13 prapid pstartabs

G43 H23 Z1. M51 prapid pstartabs

M98 P2176 prapid pstartabs

G0 G90 G57 X5.9599 Y-.5992 prapid psubrep

M98 P2176 prapid psubrep

M5 ptlchg

G91 G28 Z0 M9 ptlchg

M1 ptlchg

T13 ptlchg

M6 ( INGERSOLL 90 DEGREE SPOT DRILL) ptlchg ptoolcomm

G0 G17 G20 G40 G49 G80 G90 G98 ptlchg

(MAX | Z1.) ptlchg

(MIN | Z-.074) ptlchg

G90 G57 X.2 Y-.175 S9250 M3 T5 prapid pstartabs

G43 H13 Z1. M51 prapid pstartabs

M98 P2177 prapid pstartabs

G0 G90 G56 X.2 Y-.175 prapid psubrep

M98 P2177 prapid psubrep

M5 ptlchg

G91 G28 Z0 M59 ptlchg

Link to comment
Share on other sites

Man this bbs doesn't like me posting part of my post here.

Whenever I try to paste in the ptlchg section of the post I get this message . . .

 

Sorry, we do not permit the following HTML tag or attribute: Parenthesis in HTML tag

 

Any ideas?

Link to comment
Share on other sites

Tim,

Thanks for the tip, I got tired of pasting code and then geting HTML errors, here is the section of the post . .

 

code:

ptlchg0    # Null tool change

toolcount = toolcount + 1 #Index!

prvtp = rbuf(3,toolcountp) #Index!

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

else, nexttool = first_tool

 

if tlplnno <> prvtp, n, pinc, "G28", "Z0"

if tlplnno <> prvtp, pindex #Index!

 

if opcode = three, ptlchg0drl

 

#if opcode <> three & mi4<>prv_mi4, xabs = nextx

#if opcode <> three & mi4<>prv_mi4, yabs = nexty

#if opcode <> three & mi4<>prv_mi4, zabs = zr

#if opcode <> three & mi4<>prv_mi4 & z <> zabs, n, *sg00, *zabs, e

#if opcode <> three & mi4<>prv_mi4, n, *sg00, pabs, pwcs, *xabs, *yabs, e

 

spaces=0

comment

spaces=spaces_sav

 

if op_id<>last_op_id, pstock #Stock!

 

n, speed

n, smcool

if tplnout = one, ptplane

last_op_id = op_id

 

ptlchg # Tool change

if numsub>0, n, "Z4.", e #Added for safe clear between vises

n, "M99", e

if numsub>0, " "

 

subout = 0

mi4 = mi4org

 

toolcount = toolcount + 1 #Index!

tcount = tcount + 1

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

else, nexttool = first_tool

 

if numsub>0, n = nsav

# if prv_opcode <> 3, n, "G8 P0", e

!opcode

n, "M5"

#if coolflg = 1, pcooloff

n, pinc, "G28", "Z0", pcooloff

if absinc = one, n, "G28", "Y0"

n, "M1", e

 

#if workofs<=0, workofs=54 #WCS!

#if workofs=92, pg92_sof #WCS!

#if mi4 <= three & mi4 > zero, pg92_out

 

pinit

# if numsub>0, " "

n, *t, e

n, "M6", ptoolcomm #Tool!

n, "G0 G17 G20 G40 G49 G80 G90 G98", e

#if stagetool = one, n, *next_tool

 

spaces=0

if output_z = 1, preadbuf5

if output_z = 1, n, " (", "MAX | ", *max_depth, ")"

if output_z = 1, n, " (", "MIN | ", *min_depth, ")"

comment

spaces=spaces_sav

 

if tplnout = one, ptplane

 

startflg = one

nobrk_sav = nobrk

nobrk = one

 

pstock #Stock!

pindex #Index!

last_op_id = op_id

Link to comment
Share on other sites

Well Ron it looks like you win todays grand prize . . . whatever that is!

 

Okay first off in defense of my post hacking skills (NOT), the ifcoolflg is what was really throwing me.

 

It does not exist in the post at all, (I'm mean I'm not saying Ive never fumble fingered something in a post).

 

Now for the good news, by removing the # from the "if coolflg = 1, pcooloff" the post works perfect!

 

Thanks again for the tip and to all for the info!

Bob

cheers.gif

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