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:

Numbering Subs


kenfromlodi
 Share

Recommended Posts

Guest CNC Apps Guy 1

code:

psub_call_s$     #Call to sub level

sub_prg_no$ = 1000 # EXAMPLE MAKING SUBS START AT 1000

result = nwadrs(strp, sub_prg_no$)

sub_prg_no$ = sub_prg_no$ + sav_progno + 10 #Add sub number offset 10 in this case

if sav_progno = sub_prg_no$, result = mprint(sprgnerror,1)

pbld, n$, "M98", *sub_prg_no$, e$

 

psub_st_s$ #Header in sub level

result = nwadrs(stro, sub_prg_no$)

" ", e$

*sub_prg_no$, e$

spaces$ = 0

if scomm_sav <> snull, "(", *scomm_sav, ")", e$

spaces$ = sav_spc

pbld, n$, sgabsinc, e$

Look for code similar to the above snippet. Declare it's value right after the postblock, then on the subsequent sub section, make it equal to the last value plus another value.

 

HTH

Link to comment
Share on other sites

Thanks app guy, so the only way to define is in the post?

I was hoping for something a little more user friendly so I could be more specific when numbering.

I have a couple machine down here with a ton of programs that I cant delete and they use all different kinds of numbers. Putting a new one in is a task when I try to stick to my naming convention.

Link to comment
Share on other sites

No but you can make a mr to do. Set it in the operation and have it use it to start. Using MPFAN as the example.

 

Here is what you need to do in the post. 1st add this fmt statement

 

code:

fmt  P  7   mr2$         #Sub Program Number using mr2  

Change this part of the post to so:

code:

psub_call_trans #Translate level calls from toolchange, user

if mi1$ <= one, result = mprint(shomeserror)

sav_absinc = absinc$

pindex

#Mirror or Rotate Coord's

if sub_trnstyp$ = zero | (sub_trnstyp$ = one & mr_rt_actv),

[

#The original pattern is not mirrored or rotated

if sub_sec_no$,

[

absinc$ = zero

if sub_trnstyp$, psub_rotate

else, psub_mirror

]

mr_rt_actv = three

]

else, #Translate

[

if sub_mny_t$,

[

if mi1$ > one, absinc$ = zero

pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfzout,

pfcout, e$

pe_inc_calc

ps_inc_calc

]

]

absinc$ = sav_absinc

if mr2$ > 0, pbld, n$, "M98", mr2$, e$ #<--- Added for Ken

else, #<--- Added for Ken

[ #<--- Added for Ken

result = nwadrs(strp, main_prg_no$) #<--- Added for Ken

if progno$ = main_prg_no$, result = mprint(sprgnerror) #<--- Added for Ken

pbld, n$, "M98", *main_prg_no$, e$ #<--- Added for Ken

] #<--- Added for Ken

prv_feed = c9k #Force feed in sub

 

And this part:

 

psub_st_m$ #Header in main level

result = nwadrs(stro, main_prg_no$)

if mr2$ > 0, #<--- Added for Ken

[ #<--- Added for Ken

main_prg_no$ = mr2$ #<--- Added for Ken

" ", e$ #<--- Added for Ken

*main_prg_no$, e$ #<--- Added for Ken

] #<--- Added for Ken

else, #<--- Added for Ken

[ #<--- Added for Ken

" ", e$ #<--- Added for Ken

*main_prg_no$, e$ #<--- Added for Ken

] #<--- Added for Ken

#G51/G68 requires absolute position on first move

if mr_rt_actv & absinc$ = one,

[

sav_absinc = absinc$

absinc$ = zero

prv_absinc$ = m_one

prv_xabs = m_one

prv_yabs = m_one

]

else, pbld, n$, sgabsinc, e$


Now you can add this to the control definition text for operations and have it reflect what you are doing.

 

HTH

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