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:

Macros and misc integers


Bob W.
 Share

Recommended Posts

I have a Renishaw probe with my machine (Haas VMC) and I would like to use misc integers to add tool breakage macro routines after an operation. The macro is already written as included with the probe package so the line would look something like:

 

G65 P9853 b1. Txx Hyy

 

9853.nc is the macro tool breakage routine, xx is the tool just used in the operation, and yy is the desired tolerance where breakage is assumed if it is exceeded.

 

How would I go about doing this?

 

I have been playing around with these macros and I have the tool setting routine also setting my programmable coolant position at the same time. Nice time saver :-)

 

Thanks,

Bob

Link to comment
Share on other sites

mi seem to be better suited for on/off - yes/no type situations but it possible. I think custom drill cycles would be better at handling the the transfer of the constantly changing values of tool breakage detection. do a search for custom drill cycles and check it out before you decide which way to go. In the mean time you can use a manual entry operation to perform the detection.

Link to comment
Share on other sites

Colin Gilchrist helped me out and inserting the line

 

if mi5$ = 1, n$, "G49 G65 P9023 A24.", *prv_t$, "H.003", e$

 

into the ptlchg and peof sections of the post it runs the tool breakage routine with a simple selection of a misc integer (#5 in this case). This makes it really handy to incorporate detection into programs.

 

I have read elsewhere that custom drill cycles are handy for probing but I don't even know what those are. How are they implemented? Do you have any examples?

 

Thanks,

Bob

 

Thanks,

Bob

Link to comment
Share on other sites

Search custom drill cycles. You will find a few probing routines there. Custom drill cycle would open the door for more options for probing, as you can run out of mi's and mr's really fast when you start customizing a post.

 

Custom drill cycle will add 10 more parameters to pass to post, and there are 11 possible cycles you could create for different tasks. That's almost like 110 more mr's.

 

A couple of examples:

 

1) pickup cl of a hole and set datum from cl

 

2) pickup part corner and set datum from intersection point

 

3) probe for lateral bow in part to shift y axis per delta measured

 

4) probe for vertical bow in part to shift z axis per delta measured (ramp cutting)

 

5) probe for hole dia or taper and adjust cutter comp per actual or delta measured

 

Custom drill cycles can be linked to any routine you want to use within the post. Many options here. It's just a question of how much you are willing to learn, to understand how to code these functions.

Ask your Mastercam dealer for the MP Online Post Reference.

It will give you all the basic rules of the MP script language, and check out the documentation folder in MCX. There is a pdf that covers the chages to MP in X and new parameters added in X. This is a mountain of information that can be very helpful if you are willing to dive in.

 

--20 years in the trade and I'm still learning new tricks. LOL--

Link to comment
Share on other sites

I have my Haas post to use mi5 for tool setting and mi6 for tool breakage. I had to do pparamemter read of nci line 20004 (if I remember the nci# correctly). Then the post can use the tool info to populate the macro command.

 

If I enter a 3 in mi5 I get a tool length and diameter setting like this.

 

G65 P9853 T1 D1 Q3. B3. S.375 I.375

 

If I enter a 1 in mi5 I get a tool length only that will move tool off-center and rotate backwards for shell/insert mills etc, like this

 

G65 P9853 T1 B1. Q3. S2. I2.

 

If I enter a 4 into mi5 I get an on-center tool touch off for drills etc, like this.

 

G65 P9853 T1. Q3. B1.

 

If I enter a 4 into mi6 I get a tool breakage cycle after the tool retracts (G28 Z0) like this.

 

G65 P9853 T1. Q3. B1. H.005

 

If your interested more in this I can post the sections from my post on Monday for you. Just let me know.

Link to comment
Share on other sites

Well, I figured out that I put the probing routine in the wrong section of the post. When I put it in the ptlchg section it executes the probe routine BEFORE the machine loads the tool to be probed. I need this routine to come at the END of the operation before the tool is swapped out.

 

So basically if I do contouring (T4) and then a drill cycle (T10). If I turn on probing for the drill cycle the macro call comes at the very end of the contour cycle. Where do I need to insert my line to fix this? The code goes something like this...

 

if mi4$ = 1, n$, "G49 G65 P9023 A24.", *prv_t$, "H.003", e$

 

Thanks,

Bob

Link to comment
Share on other sites

No mine is setup to stage tools.

 

code:

 pretract        #End of tool path, toolchange

sav_absinc = absinc$

absinc$ = one

sav_coolant = coolant$

coolant$ = zero

 

# if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless

[ # explicitely turned off through a canned text edit

if all_cool_off,

[

#all coolant off with a single off code here

if coolant_on, pbld, n$, *sall_cool_off, e$

coolant_on = zero

]

else,

[

local_int = zero

coolantx = zero

while local_int < 20,

[

coolantx = and(2^local_int, coolant_on)

local_int = local_int + one

if coolantx > zero,

[

coolantx = local_int

pbld, n$, scoolantx, e$

]

coolantx = zero

]

coolant_on = zero

]

]

#cc_pos is reset in the toolchange here

cc_pos$ = zero

gcode$ = zero

pbld, n$, sccomp, *sm05, psub_end_mny, e$

pbld, n$, sgabsinc, sgcode, *sg28ref, "Z0.", scoolant, e$

if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "X0.", "Y0.", protretinc, e$

else, pbld, n$, protretinc, e$

absinc$ = sav_absinc

coolant$ = sav_coolant

if mi5$ = 1, n$, "G49 G65 P9023 A24.", *prv_t$, "H.003", e$


Gives this

 

code:

 G20

G0G17G40G49G80G90

(1/4 SPOTDRILL|TOOL - 1|DIA. OFF. - 41|LEN. - 1|TOOL DIA. - .25)

(SPOT CLAMP HOLES 2X)

T1M6

G0G90G54X-4.Y0.A0.S3000M3

G43H1Z2.T2

M8

G98G81Z-.12R.1F10.

X4.

G80

(SPOT .216 HOLES 4X)

X1.0622Y3.2693

G98G81Z-.11R.1F10.

X-1.0622

Y-3.2693

X1.0622

G80

M5

G91G28Z0.M9

A0.

G49 G65 P9023 A24.T1H.003

M01

(.203 13/64 STUB DRILL|TOOL - 2|DIA. OFF. - 42|LEN. - 2|TOOL DIA. - .20313)

(DRILL CLAMP HOLES 2X)

T2M6

G0G90G54X-4.Y0.A0.S2500M3

G43H2Z2.T3

M8

G98G83Z-.75R.1Q.05F5.

X4.

G80

(DRILL .216 HOLES 4X)

X1.0622Y3.2693

G98G83Z-.75R.1Q.05F5.

X-1.0622

Y-3.2693

X1.0622

G80

M5

G91G28Z0.M9

A0.

G49 G65 P9023 A24.T2H.003

M01

(.216 HSS REAMER|TOOL - 3|DIA. OFF. - 43|LEN. - 3|TOOL DIA. - .216)

(REAM .216 HOLES 4X)

T3M6

G0G90G54X1.0622Y3.2693A0.S600M3

G43H3Z2.T4

M8

G98G86Z-.625R.1F5.

X-1.0622

Y-3.2693

X1.0622

G80

M5

G91G28Z0.M9

A0.

G49 G65 P9023 A24.T3H.003

M01

(1/4-20 TAPRH|TOOL - 4|DIA. OFF. - 44|LEN. - 4|TOOL DIA. - .25)

(TAP CLAMP HOLES 2X)

T4M6

G0G90G54X-4.Y0.A0.S200M3

G43H4Z2.T5

M8

G98G84Z-.5R.1F10.

X4.

G80

M5

G91G28Z0.M9

A0.

G49 G65 P9023 A24.T4H.003

M01

This is from X2 Generic Haas 4X Mill Post

 

[post_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V11.00 E1 P0 T1120058875 M11.00 I0

# Post Name : Generic Haas 4X Mill.pst

# Product : Mill

# Machine Name : Haas

# Control Name : Hass

# Description : Generic 4 Axis Mill Post

# 4-axis/Axis subs. : Yes

# 5-axis : No

# Subprograms : Yes

# Executable : MP 11.0

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

Do a search for "M1" or "M01" in your post and put what Colin showed you above that line, then, do a search for M30 and put it above that line (or thereabouts depending on if you're using a Contact Type liil breackage check or Laser Type) as well.

 

Use a Misc. Int. if you want to be able to turn it on and off, otherwise remove the "if" statement and it will always do it.

 

HTH

Link to comment
Share on other sites

Here is my pretract section:

 

code:

  

pretract #End of tool path, toolchange

phsm_off

sav_absinc = absinc$

absinc$ = one

sav_coolant = coolant$

coolant$ = zero

# if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless

# [ # explicitely turned off through a canned text edit

if all_cool_off,

[

#all coolant off with a single off code here

if coolant_on, pbld, n$, *sall_cool_off, e$

coolant_on = zero

]

else,

[

local_int = zero

coolantx = zero

while local_int < 20,

[

coolantx = and(2^local_int, coolant_on)

local_int = local_int + one

if coolantx > zero,

[

coolantx = local_int

pbld, n$, scoolantx, e$

]

coolantx = zero

]

coolant_on = zero

]

# ]

 

#cc_pos is reset in the toolchange here

cc_pos$ = zero

if convert_rpd$ = one,

[

gcode$ = one

feed = maxfeedpm

ipr_type = zero

]

else, gcode$ = zero

pbld, n$, sccomp, *sm05, psub_end_mny, e$

pbld, n$, sgabsinc, sgcode, [if gcode$ = 1, sgfeed], *sg28, "Z0.", [if gcode$ = 1, feed], scoolant, e$

#if lock_codes = one & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$

#pbld, n$, *sg28, "X0.", "Y0.", protretinc, e$

#if lock_codes = one & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$

if abs(fmtrnd(cabs)) > 360 & nextop$ <> 1003 & not(index),

[

if lock_codes = one, pbld, n$, *sunlock, sunlockcomm, e$

rotretflg = 1

pbld, n$, `sg28, protretinc, e$

rotretflg = 0

if lock_codes = one & cuttype = 0, pbld, n$, *slock, slockcomm, e$

]

absinc$ = sav_absinc

coolant$ = sav_coolant

if mi5$ = 1, n$, "G49 G65 P9023 A24.", *prv_t$, "H.003", e$

Produces this:

code:

  

 

N100 G00 G17 G20 G40 G80 G90

N105(.375 CARBIDE MILL - MA FORD TOOL-4 DIA-OFF.-4 LEN.-4 DIA.-.375)

N110 T4 M06

N115 (MAX - Z.1)

N120 (MIN - Z0.)

N125 G00 G90 G54 X0. Y0. S12000 M03

N130 G43 H4 Z.1 M08 T8

N135 G94

N140 G98 G81 Z0. R.08 F140.

N145 G80 M09

N150 M05

N155 G91 G28 Z0.

N160 G49 G65 P9023 A24. T4 H.003

N165 M01

N170(3/32 END MILL TOOL-8 DIA-OFF.-8 LEN.-8 DIA.-.09375)

N175 T8 M06

N180 (MAX - Z.1)

N185 (MIN - Z0.)

N190 G00 G90 G54 X0. Y0. S12000 M03

N195 G43 H8 Z.1 M08 T6

N200 G94

N205 G98 G81 Z0. R.08 F20.

N210 G80 M09

N215 M05

N220 G91 G28 Z0.

N225 M01

N230(3/16" MA FORD END MILL TOOL-6 DIA-OFF.-6 LEN.-6 DIA.-.1875)

N235 T6 M06

N240 (MAX - Z.1)

N245 (MIN - Z0.)

N250 G00 G90 G54 X0. Y0. S12000 M03

N255 G43 H6 Z.1 M08 T10

N260 G94

N265 G98 G81 Z0. R.08 F60.

N270 G80 M09

N275 M05

N280 G91 G28 Z0.

N285 G49 G65 P9023 A24. T6 H.003

N290 M01

N295(.125" SPOT DRILL TOOL-10 DIA-OFF.-10 LEN.-10 DIA.-.125)

N300 T10 M06

N305 (MAX - Z.1)

N310 (MIN - Z0.)

N315 G00 G90 G54 X0. Y0. S6000 M03

N320 G43 H10 Z.1 M08 T4

N325 G94

N330 G98 G81 Z0. R.08 F30.

N335 G80 M09

N340 M05

N345 G91 G28 Z0.

N350 G49 G65 P9023 A24. T10 H.003

N355 G53 G90 G0 X-15. Y0.

N360 M30

%

For this I had tool breakage enabled for the second and last operations (T8 and T10).

 

James, I tried what you suggested and the results were very similar to above.

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