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:

maximum subprogram nesting levels?


Jody
 Share

Recommended Posts

Guest CNC Apps Guy 1

Most controls have a limit to the "depth" that you can go in Sub Programs. Usually it's 4.

 

O1

M98P111

M30

 

O111(LEVEL1)

M98P222

M99

 

O222(LEVEL2)

M98P333

M99

 

O333(LEVEL3)

M98P444

M99

 

O444(LEVEL4)

DO SOMETHING

M99

 

If in program 444 you had another sub call, you'd get an alarm.

 

HTH

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

Yes Jody. You got it. Going more than 1 or 2 deep gets dicey though when you go to troubleshoot something. The deeper you go in subs the harder it is to trace "issues".

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

That would be something you'd do manually and honestly I do not know what would posess someone to do that in all honesty. biggrin.gif I'm a KIS guy myself. (Keep It Simple) Mastercam goes 1 deep. Main, Sub, back to main.

Link to comment
Share on other sites

I go three deep every day and four deep about 10% - 15% of the time. Here's one I wrote today. (three deep)

 

main level;

code:

G91 G30 X0 Y0 Z0

M06 T32 (4.60MM COOLANT THROUGH CARBIDE DRILL)

#930=4010

T40

M[#926]

M[#925]

M[#927]

M98P5002 (<<<<<<<<<<<<<)

M09

M56

M58

M05

G91 G30 X0 Y0 Z0

M01

1 level deep

code:

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

2 levels deep

code:

O4014

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

N0150 G68 X0 Y0 R180.

N0160 M98 P4013 (<<<<<<<<<<<<<<<<<<)

N0170 G69

N0180 M99

3 levels deep

code:

O4013

(4.60MM COOLANT THROUGH CARBIDE DRILL)

N0010 #919=6.

N0020 #900=[#900+1]

N0030 G00 G90 X2.3 Y-.38 (B0.) B0. G54P[#900]

N0040 G43 H32 Z.375 S1687 M[#933]

N0050 Z.225

N0060 G99 G81 Z-.083 R.225 F4.16

N0070 X1.8

N0080 X1.3

N0090 X.8

N0100 X.3

N0110 G80

N0120 G00 Z.375

N0130 M99

My post writes it all biggrin.gif

Link to comment
Share on other sites

Subs are useful, nested subs are useful. With todays controllers where memory is not an issue you only really need to do it if you think you may need to do online edits. I like using subs for repetative work, in subs I do call other subs but only for drill locations because it is so nice to edit one sub with locations for all the drill toolpaths. Other instances may be for overriding a G10 work offset position, a probe cycle, or some engraving, a short warmup routine to go to a much higher spindle speed (this is usually done automatically now), etc....

 

HTH

Link to comment
Share on other sites

Many of us know that you can nest up to 4 levels (Fanuc) with a M98... This is from the Fanuc manual:

 

" Calls can be nested to a depth of four levels including simple calls (G65) and modal calls (G66). This does not include subprogram calls (M98). "

 

Is this to say that you can go 7 or 8 levels deep? So from the 4th level M98, you can macro call to a sub, then go 3 more levels from there? headscratch.gif

 

I'm with James though... KIS or KISS....

The Haas book doesn't say how deep you can nest. At least I've never found it. But with M97 available, why bother unless you have "common" subs for different parts.

Mazaks can nest to 8 levels.

 

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