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:

Sub Program


Jake L
 Share

Recommended Posts

How does the post decide when a new subprogram is needed?

I see "c_msng$" which seems to be the call to the sub program post blocks. But I can't figure out what tells the post to jump to the sub program post blocks and when not to. 

Furthermore, if I have a transform op which transforms a toolpath, if I don't include my origin in that transform then a new subprogram needs to be output for each transformed location. What tells the post when to output a new subprogram? I imagine it's a list of logic like:

if sub program is true & transform is true & include origin is false , then new sub program flag = true

but I can't find anything in the post that is handling this. 

I'm working with a modified MPFAN post. MC2023. Please let me know if more info is needed. TIA

Link to comment
Share on other sites
On 12/23/2023 at 6:46 AM, JParis said:

subout$

That's the command you're looking for...

Thanks for the reply. subout$ seems to be the answer to the question I asked, but I think I asked the wrong question.

After playing with the post a little more, the question I should have asked is what triggers main_prog_no$ to iterate? 

And while writing this I realize it may not matter because I can probably just do something like this:

if main_prg_no$ <> prv_main_prog_no, (do something)

Link to comment
Share on other sites

OK, now you're into this section...I had a feeling you needed something else besides the subout$ :)

 

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, mr_rt_actv = three  #Mirror
      if mr_rt_actv,
        [
        if sub_trnstyp$ = zero,
          [
          #The original pattern is not mirrored
          if sub_chn_no$ <> one,
            [
            absinc$ = zero
            psub_mirror
            ]
          ]
        else,
          [
          #The original pattern is not rotated, calculate the rotation incremental angle for G68
          rt_csav = atan2(sub_m2$, sub_m1$)
          if sub_sec_no$,
            [
            rt_cinc = prv_rt_csav - rt_csav
            while rt_cinc > 180, rt_cinc = rt_cinc - 360
            while rt_cinc < -180, rt_cinc = rt_cinc + 360
            if rot_ccw_pos = one, rt_cinc = -rt_cinc
            !rt_csav
            absinc$ = zero
            psub_rotate
            ]
          else,
            [
            !rt_csav
            ]
          ]
        #Set restore flag and sign mr_rt_actv to indicate active
        mr_rt_rst = one
        mr_rt_actv = -abs(mr_rt_actv)
        ]
      else, #Translate all, Rotate toolplane
        [
        if sub_mny_t$,
          [
          if mi1$ > one, absinc$ = zero
          if convert_rpd$, pconvert_rpd
          pbld, n$, [if gcode$, *sgfeed], *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfzout, pfcout, [if gcode$, *feed], e$
          pe_inc_calc
          ps_inc_calc
          ]
        ]
      absinc$ = sav_absinc
      #result = nwadrs(strp, main_prg_no$)
      result = nwadrs(strh, main_prg_no$)    #altered to get H output, 02/10/2020, jmp
      main_prg_no$ = main_prg_no$ + 40000   #alter to push subprograms #'s into the 40000 range, 02/10/2020, jmp
      #if progno$ = main_prg_no$, result = mprint(sprgnerror)
      pbld, n$, "M98", *main_prg_no$, e$
      result = force(feed)  # Force output of feed next time it's called for output (in sub)

You'll notice a section near the end dated 2/10/2020  I have to alter the code for my mazak required output ....

What are you trying to achieve might be a better way to go at what you need.

Link to comment
Share on other sites
22 minutes ago, JParis said:

OK, now you're into this section...I had a feeling you needed something else besides the subout$ :)

...

You'll notice a section near the end dated 2/10/2020  I have to alter the code for my mazak required output ....

What are you trying to achieve might be a better way to go at what you need.

Almost identical to my alterations:

	absinc$ = sav_absinc
    	#result = nwadrs(strp, main_prg_no$) 		---		Commented out 11/15/23
	result = nwadrs(strq, main_prg_no$) #		---		Added from above line 11/15/23
	#main_prg_no$ = t$ + (1000 * use_cnt) #		---		Added 11/15/23		---		Copied to next line 12/27/23
	main_prg_no$ =(t$ * 100) + main_prg_no$ #		---		Adjusted 12/27/23
    	if progno$ = main_prg_no$, result = mprint(sprgnerror)
    	pbld, n$, "M98", *main_prg_no$, e$
    	result = force(feed)  # Force output of feed next time it's called for output (in sub)

I am still trying to nail down a good way to do subprogram numbers. The biggest thing I want is for it to be easy for the setup guy to jump to a tool's sub incase slight alterations need to be made to the g-code.

 

My first idea was sub program number = t$ + (1000 * use_cnt) where use_cnt = callout number...

... so Q3122 would be T122 3rd call

This worked for the first job we sub programmed, but the next job we're doing is setup on all 4 sides of a rectangular tombstone. Each face has origin at POR so the sub program for the large faces is different than the sub program for the small faces. 

 

So my idea for a fix was have the sub program number = t$ + (1000 * use_cnt) + (10000 * (#num subprograms since tool change))...

... so Q21010 would be T10, 1st call, 2nd sub

This naming convention would work, except I couldn't figure out how to get "#num subprograms since tool change"

 

The idea shown in the code is sub number = (t$ * 100) + main_prg_no$

I realize I still need some kind of iterator, in this case main_prg_no$. In the original example the iterator was a mix between the tool number and tool call, but had no iterator for if the same tool needed more than 1 sub program. The problem I foresee with the current case is if main_prg_no$ > 99 then all the sub numbers will be screwed up. This wouldn't break the code, it would just screw up the naming convention.

 

At this point it might be easier to do it like you, start with 40001, add 1 for each sub, and create a separate op sheet chart for which sub numbers correspond to which tool.

 

Link to comment
Share on other sites
38 minutes ago, Jake L said:

This naming convention would work, except I couldn't figure out how to get "#num subprograms since tool change"

If you want to pull the tool number...you'll want to save the tool value at the tool change...you can then access later in the OP's and it will update at the next tool change

Link to comment
Share on other sites

Decided to go with the 40,000 + main_prg_no$ approach. This seems like a more robust setup.

I realize it adds 1 step for the machinist if an adjustment needs to be made. Instead of searching straight to the sub program, you can search to the M6 line and see what the sub number is for that tool, then search to the sub program.

Thanks for the help JP

  • Like 1
Link to comment
Share on other sites

I do a lot of hand work to my programs after I post them...one of the things I do is add notes in the Tool Comments as to which subprogram/subprograms are called for that tool change. It helps them narrow down where to look

 

N1550
G20
G0G17G40G49G80G90
G0G28G91Z0.
M00
(3/8 3FL ENDMILL TOOL - 11010375 DIA. OFF. - 51999 LEN. - 51999 TOOL DIA. - .375)
(3/8 ENDMILL / ROUGH TOP OF STOCK / Z+.01)
(MAX Z DEPTH - Z1.)
(MIN Z DEPTH - Z-.39)
(OPERATION #1)
(SUBPROGRAM N40001)
(SUBPROGRAM N40003)
(SUBPROGRAM N40005)
N1000
T11010375M6
T12010250
G90G10L10P#51999R0
G90G10L12P#51999R0
S18000M3
M8
()
IF[#925EQ1]GOTO10101
IF[#900EQ1]GOTO10101
IF[#900EQ0]GOTO30101
N10101
()
G0G90B90.
G0G90G54.1P1X.5718Y-1.5515
G43H#51999Z1.
M98H40001
(3/8 ENDMILL / ROUGH TOP OF STOCK / Z+.01)
(OPERATION #1)
N1002
G0G90Z12.
()
IF[#925EQ1]GOTO10105

Link to comment
Share on other sites
54 minutes ago, JParis said:

I do a lot of hand work to my programs after I post them...one of the things I do is add notes in the Tool Comments as to which subprogram/subprograms are called for that tool change. It helps them narrow down where to look

 

I'll do just about anything to avoid hand editing after posting. It just opens a can of fat-fingering errors that I don't want to open.

  • Like 1
Link to comment
Share on other sites
2 minutes ago, Jake L said:

I'll do just about anything to avoid hand editing after posting. It just opens a can of fat-fingering errors that I don't want to open.

I worked with Dave Thomson from Postability trying to come up with a way to get the macro statements added via the post....there was no good way to do.

So we hand edit that stuff in...there's no gcode editing, the post in that respect is bulletproof

  • Like 1
Link to comment
Share on other sites
22 hours ago, JParis said:

I do a lot of hand work to my programs after I post them...one of the things I do is add notes in the Tool Comments as to which subprogram/subprograms are called for that tool change. It helps them narrow down where to look

 

N1550
G20
G0G17G40G49G80G90
G0G28G91Z0.
M00
(3/8 3FL ENDMILL TOOL - 11010375 DIA. OFF. - 51999 LEN. - 51999 TOOL DIA. - .375)
(3/8 ENDMILL / ROUGH TOP OF STOCK / Z+.01)
(MAX Z DEPTH - Z1.)
(MIN Z DEPTH - Z-.39)
(OPERATION #1)
(SUBPROGRAM N40001)
(SUBPROGRAM N40003)
(SUBPROGRAM N40005)
N1000
T11010375M6
T12010250
G90G10L10P#51999R0
G90G10L12P#51999R0
S18000M3
M8
()
IF[#925EQ1]GOTO10101
IF[#900EQ1]GOTO10101
IF[#900EQ0]GOTO30101
N10101
()
G0G90B90.
G0G90G54.1P1X.5718Y-1.5515
G43H#51999Z1.
M98H40001
(3/8 ENDMILL / ROUGH TOP OF STOCK / Z+.01)
(OPERATION #1)
N1002
G0G90Z12.
()
IF[#925EQ1]GOTO10105

Hey John,

I'm planning a Mastercam Meetup at my house in Connecticut. Not sure if that would be too far of a drive to be of interest, but I'll extend the invitation if you'd like to come. I'd be curious to see if we could engineer a process using Manual Entry Paths, to input the hand-edited data you're adding to your NC Programs, directly from Mastercam. Where there is a will, there is a way! I've done some crazy things to develop solutions for Mastercam Posts before, so if you're up for the challenge, I'd love to help solve this for you. We could always do this over Teams, since I would bet you live 2+ hours from me in East Hartford, and that is a lot of driving for one day.

So far, I've got three other guys who all happen to live in Connecticut or reasonably close, who would be joining me.

We are looking at a Saturday, possibly the 6th or the 13th, to host this event at my place.

@Aaron Eberhard, if you've got any interest in this, you're welcome to join us as well. Nothing fancy, just a bunch of guys with laptops and possibly a larger screen, hanging out and learning about Posts and/or toolpath techniques.

  • Thanks 1
  • Like 2
Link to comment
Share on other sites
4 hours ago, Colin Gilchrist said:

Hey John,

I'm planning a Mastercam Meetup at my house in Connecticut. Not sure if that would be too far of a drive to be of interest, but I'll extend the invitation if you'd like to come. I'd be curious to see if we could engineer a process using Manual Entry Paths, to input the hand-edited data you're adding to your NC Programs, directly from Mastercam. Where there is a will, there is a way! I've done some crazy things to develop solutions for Mastercam Posts before, so if you're up for the challenge, I'd love to help solve this for you. We could always do this over Teams, since I would bet you live 2+ hours from me in East Hartford, and that is a lot of driving for one day.

So far, I've got three other guys who all happen to live in Connecticut or reasonably close, who would be joining me.

We are looking at a Saturday, possibly the 6th or the 13th, to host this event at my place.

@Aaron Eberhard, if you've got any interest in this, you're welcome to join us as well. Nothing fancy, just a bunch of guys with laptops and possibly a larger screen, hanging out and learning about Posts and/or toolpath techniques.

Hell yeah I'm in :) I've been meeting to reach out and grab some lunch with you anyway, this would be fun.  Keep me in the loop.

 

  • Like 1
Link to comment
Share on other sites
On 12/29/2023 at 4:00 PM, Kyle F said:

@Colin Gilchrist Any chance you're planning on filming that for personal use or Youtube? 😁 I'm sure 90% would go over my head but I would be super grateful to be a fly on the wall for that discussion.

Will certainly record whatever we do and post it to YouTube afterwards. Trying to do "YouTube Live" takes a lot of production, but we may end up doing a Teams meeting invite, and just recording that. Teams is a bit easier to manage than a broadcast stream.

@Jake L, you're welcome to join as well!

  • Thanks 1
Link to comment
Share on other sites
1 hour ago, Colin Gilchrist said:

Will certainly record whatever we do and post it to YouTube afterwards. Trying to do "YouTube Live" takes a lot of production, but we may end up doing a Teams meeting invite, and just recording that. Teams is a bit easier to manage than a broadcast stream.

@Jake L, you're welcome to join as well!

oh yeah, live is no necessity! That is awesome to hear though. thanks. y'all rock

  • Like 1
Link to comment
Share on other sites
On 12/29/2023 at 10:56 AM, Colin Gilchrist said:

Hey John,

I'm planning a Mastercam Meetup at my house in Connecticut. Not sure if that would be too far of a drive to be of interest, but I'll extend the invitation if you'd like to come

@Colin Gilchrist Thanks...with everything I have going on in real life my weekends are mostly taken up with taking care of things at home, spending time with Wifey and getting ready to do it all over again the next week.

I greatly appreciate the offer, at this point though it's nothing I would be able to make the time to do...

 

Link to comment
Share on other sites

I completely understand @JParis! Much of my home life is dedicated to taking care of my wife as well. I missed your post as well about working with Dave on this issue. It sounds like one of the big "missing pieces" is the ability to pass strings as parameters along with the operations, and perhaps only having 10 misc. integers and decimals as well. That said, I've done some unique things with Manual Entry toolpaths, using 'strstr' function to pass "intent" for the data and use this as a form of "flow control" within the Post. That, coupled with the new 'opinfo' function, gives us some very cool tools to play with. I can read forwards or backwards with opinfo in some unique ways. Truthfully, I don't even mess with Mastercam Posts much these days anymore. I'm getting rusty. That's why I want to do some of these Mastercam meetup sessions before I forget it all. Lol.

 

  • Like 2
Link to comment
Share on other sites
21 hours ago, Colin Gilchrist said:

Will certainly record whatever we do and post it to YouTube afterwards. Trying to do "YouTube Live" takes a lot of production, but we may end up doing a Teams meeting invite, and just recording that. Teams is a bit easier to manage than a broadcast stream.

@Jake L, you're welcome to join as well!

Huge thanks for the invite Colin, really wish I could make it, but I'm in the same boat as JP, minus the wife part. My GF goes back to college in two weeks and we're going on a small vaca to Texas next week so my next couple weekends are already full. 

I'd absolutely watch a video of the discussion tho, sounds like you're pulling together a bunch of very talented, very experienced guys.

  • Like 2
Link to comment
Share on other sites
On 1/3/2024 at 12:42 PM, Jake L said:

Huge thanks for the invite Colin, really wish I could make it, but I'm in the same boat as JP, minus the wife part. My GF goes back to college in two weeks and we're going on a small vaca to Texas next week so my next couple weekends are already full. 

I'd absolutely watch a video of the discussion tho, sounds like you're pulling together a bunch of very talented, very experienced guys.

Date changed to Saturday, February 3rd... Not sure if that changes anything? Either way, you're welcome to join or just watch the videos when you can.

Link to comment
Share on other sites
On 12/29/2023 at 3:28 PM, Aaron Eberhard said:

Hell yeah I'm in :) I've been meeting to reach out and grab some lunch with you anyway, this would be fun.  Keep me in the loop.

 

Sweet! Looking at February 3rd, at my place. Start around 9:30-10:00 AM, I'm hosting lunch (we'll break around 12:30 PM), and we'll wrap around 3:00-4:00 PM, based on how everyone is feeling. Of course, everyone is welcome to attend as much, or as little, as they wish.

I've also decided to do a limited Teams Meeting for those who are outside the New England area. First Come, First Served, for those who wish to join. I'm somewhat limiting attendance to no more than 10-15 people. My main intent in hosting was to meet more actual flesh-and-blood people, and not just host an online meeting, but I also don't want to let distance be a barrier to learning.

  • Like 1
Link to comment
Share on other sites
On 12/27/2023 at 3:53 PM, Jake L said:

Thanks for the reply. subout$ seems to be the answer to the question I asked, but I think I asked the wrong question.

After playing with the post a little more, the question I should have asked is what triggers main_prog_no$ to iterate? 

And while writing this I realize it may not matter because I can probably just do something like this:

if main_prg_no$ <> prv_main_prog_no, (do something)

Just talking out loud....How big is your control memory Jake?

Because if you can, you can't beat running internal sub progs - ones that stay in the 1x main program. This way no one forgets to save the subs at the end of the job run, because they're within the prog....

FWIW, after going round in circles with this back in the day, we decided to just use 0001 for 1st sub call and 0002 for second etc. Because the subs are saved in the folder with the main prog, and the sub header also stated "SUB FOR PROG NO XXXX", so there was never any issue with potential mixup.

Obviously later controls and 8 digit prog numbers would allow better file numbering (ie all subs to start 5xxxx for example)

Link to comment
Share on other sites
20 hours ago, Colin Gilchrist said:

Date changed to Saturday, February 3rd... Not sure if that changes anything? Either way, you're welcome to join or just watch the videos when you can.

Awesome, I'm in! 

Link to comment
Share on other sites
5 hours ago, Newbeeee™ said:

Just talking out loud....How big is your control memory Jake?

Because if you can, you can't beat running internal sub progs - ones that stay in the 1x main program. This way no one forgets to save the subs at the end of the job run, because they're within the prog....

FWIW, after going round in circles with this back in the day, we decided to just use 0001 for 1st sub call and 0002 for second etc. Because the subs are saved in the folder with the main prog, and the sub header also stated "SUB FOR PROG NO XXXX", so there was never any issue with potential mixup.

Obviously later controls and 8 digit prog numbers would allow better file numbering (ie all subs to start 5xxxx for example)

Funny you say that... JP told me about internal subs a couple months ago:

Internal subs is how we are running now. 

To answer the question anyway, one machine has 2MB, I believe the other 3 have 10MB. 

Always cool to hear how others set things up.  

Link to comment
Share on other sites
On 1/5/2024 at 9:46 AM, Jake L said:

Funny you say that... JP told me about internal subs a couple months ago:

Internal subs is how we are running now. 

To answer the question anyway, one machine has 2MB, I believe the other 3 have 10MB. 

Always cool to hear how others set things up.  

I'm glad to hear you're running internal subs. Just the reduced time in programming multiple parts pays for itself. :thumbup:

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