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:

Posting sub programs


Michael Sullivan
 Share

Recommended Posts

I would like to post sub programs for thread milling locations that are not in a pattern.

Is this possible in a automated way other than cut/paste/edit etc.

I am aware of the sub output settings in tool path transform but i can’t get it configured for point locations from a reference tool path.

Am I missing something or is there a different way to go about it?

I am currently using modified versions of the “out of the box” generic Fanuc and Haas post processors.

Thanks!

 

-Mike

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

It seems to me there used to be a older post that allowed a Drill routine to call a subprogram number....

Looks lost in the later posts....

But a staggered distance is not easily done...

Interesting. It seems like such a common function, I was sure that it had to be built in somewhere.

with still so little program memory  in Fanuc controllers…🙄

Thanks John.

Link to comment
Share on other sites
46 minutes ago, Michael Sullivan said:

Interesting. It seems like such a common function, I was sure that it had to be built in somewhere.

with still so little program memory  in Fanuc controllers…🙄

Thanks John.

im pretty positive that both Inhouse solutions post team https://www.emastercam.com/post-request/ as well as Postabilities post team https://postability.com/ can both alter a post to accomplish that, so if your looking to have this implemented I would suggest reaching out to them or go through your reseller directly and they can likely make it happen for a small fee. 

i would just describe to them that your looking to have a drill cycle added that can be used to output another toolpath as a subprogram using the drill point positions as the sub program location or details similar to that. I think both inhouse and Postability offer great posts, support and their pricing is reasonable and competitive. 

  • Like 1
Link to comment
Share on other sites
5 hours ago, Michael Sullivan said:

with still so little program memory  in Fanuc controllers…🙄

FANUC controls only come with what memory size the Machine Tool Builder specifies, or the customer purchases the option for.

If you have large programs, look here for an easy, and inexpensive alternative - it's an old topic put still very relevant;

 

  • Like 5
Link to comment
Share on other sites
6 hours ago, Michael Sullivan said:

I would like to post sub programs for thread milling locations that are not in a pattern.

Is this possible in a automated way other than cut/paste/edit etc.

I am aware of the sub output settings in tool path transform but i can’t get it configured for point locations from a reference tool path.

Am I missing something or is there a different way to go about it?

I am currently using modified versions of the “out of the box” generic Fanuc and Haas post processors.

Thanks!

 

-Mike

Download a copy of MPMaster from this website.

The "9th" Drill Cycle in the Drop-Down list is "Subprogram Call".

The easiest way to accomplish this is to do the following:

  1. Program the Thread Mill Cycle. Check the "Subroutine" checkbox, so that the entire Thread Mill Cycle is output as a Subroutine.
  2. Enable the "Miscellaneous Integer #2" option (set to "1"), so that the entire Subroutine output is done in "incremental". All the NC Code to rough/finish should be either "1" subroutines, or "2" subroutines, one for rough, the other for finish. That way you can just run the "2nd subroutine" when adjusting Cutter Comp.
  3. Make sure you lead in/out from the center, and use Perpendicular Entry. Use "wear" comp. That will output G41/G42 with "D" command on the Perp. entry move.
  4. Now, program a series of holes using a Drill Cycle, and use the "subroutine call" drill cycle. Enter the Subroutine Number (typically they start at O1000, and increment by 1, when using the "subroutine check box" option.

 

  • Like 4
Link to comment
Share on other sites
5 hours ago, cncappsjames said:

FANUC controls only come with what memory size the Machine Tool Builder specifies, or the customer purchases the option for.

If you have large programs, look here for an easy, and inexpensive alternative - it's an old topic put still very relevant;

 

 

5 hours ago, cncappsjames said:

 

Thats a really good tip with the ATA card, thanks.

Unfortunately, when you work for the department of defense (federal employee), any kind of flash memory is poo poo’d for security reasons.

Regardless of the machine builder, the maximum memory for some of these controls is like 3 MB and it costs thousands of dollars to upgrade, it’s ridiculous! What year is it in Fanucland?!?! 😆

 

 

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

Download a copy of MPMaster from this website.

The "9th" Drill Cycle in the Drop-Down list is "Subprogram Call".

The easiest way to accomplish this is to do the following:

  1. Program the Thread Mill Cycle. Check the "Subroutine" checkbox, so that the entire Thread Mill Cycle is output as a Subroutine.
  2. Enable the "Miscellaneous Integer #2" option (set to "1"), so that the entire Subroutine output is done in "incremental". All the NC Code to rough/finish should be either "1" subroutines, or "2" subroutines, one for rough, the other for finish. That way you can just run the "2nd subroutine" when adjusting Cutter Comp.
  3. Make sure you lead in/out from the center, and use Perpendicular Entry. Use "wear" comp. That will output G41/G42 with "D" command on the Perp. entry move.
  4. Now, program a series of holes using a Drill Cycle, and use the "subroutine call" drill cycle. Enter the Subroutine Number (typically they start at O1000, and increment by 1, when using the "subroutine check box" option.

 

This sounds promising, I will give it a go, thanks!

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

Download a copy of MPMaster from this website.

The "9th" Drill Cycle in the Drop-Down list is "Subprogram Call".

The easiest way to accomplish this is to do the following:

  1. Program the Thread Mill Cycle. Check the "Subroutine" checkbox, so that the entire Thread Mill Cycle is output as a Subroutine.
  2. Enable the "Miscellaneous Integer #2" option (set to "1"), so that the entire Subroutine output is done in "incremental". All the NC Code to rough/finish should be either "1" subroutines, or "2" subroutines, one for rough, the other for finish. That way you can just run the "2nd subroutine" when adjusting Cutter Comp.
  3. Make sure you lead in/out from the center, and use Perpendicular Entry. Use "wear" comp. That will output G41/G42 with "D" command on the Perp. entry move.
  4. Now, program a series of holes using a Drill Cycle, and use the "subroutine call" drill cycle. Enter the Subroutine Number (typically they start at O1000, and increment by 1, when using the "subroutine check box" option.

 

Where is the subroutine check box?

I see the subroutine settings in the control definition which appear to be turned on but I don’t see anything related to subroutine in the thread mill toolpath tree

Link to comment
Share on other sites
1 hour ago, Michael Sullivan said:

Where is the subroutine check box? 

I see the subroutine settings in the control definition which appear to be turned on but I don’t see anything related to subroutine in the thread mill toolpath tree

You have to create a new drill cycle and select it in there.  All it does, is post out a sub call routine for each point you select.

  • Like 1
Link to comment
Share on other sites
1 hour ago, neurosis said:

You have to create a new drill cycle and select it in there.  All it does, it post out a sub call routine for each point you select.

I see that I need to select Subprogram call in the drill cycle drop down menu.

# 1 on his instructions refers to a subprogram checkbox in relation to the threadmill toolpath. I don’t see anything like that available.

it appears to post out properly if I use a different NC file name for each tool path and post as separate files. 
its already way better than what I was doing so :oldforumcheers:

I was just wondering if what I am missing will post them together in the same file.

I am using version 2021.

Link to comment
Share on other sites
1 hour ago, Michael Sullivan said:

Where is the subroutine check box?

I see the subroutine settings in the control definition which appear to be turned on but I don’t see anything related to subroutine in the thread mill toolpath tree

When you create a new Drill Toolpath in Mastercam 2022, the checkbox is located on the "Linking Parameters" Page.

There will be a checkbox named [Subprogram]. When you enable the checkbox, you will get a choice of Radio Buttons for [Absolute] or [Incremental]. Pick the 'incremental option'. (This means you shouldn't need to change the Miscellaneous Integer #2.

The output from this NC Code should give you a "Sub Program Call" in your NC Code:

TxxM06
G00 G90 G55 X_ Y_ S_ M03
G43 Hxx Z_
M98 P1000

Then, depending on the Control Definition Switch for "Subs before/after", you'll get your "O1000" Subroutine either before the "main program", or "after the main program (M30)".

You should use this to Thread Mill the first hole in your group.

Next you should create a new Drill Toolpath, and set the "subroutine" option in the Drill Cycle.

For this path, it should not output any "tool change code", unless you've got the "Force Tool Change" option enabled.

This path should just be a series of "M98 Pxxxx" calls. (You enter the Subroutine # in the 'Peck 1' parameter in the Drill Cycle Parameters.

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

When you create a new Drill Toolpath in Mastercam 2022, the checkbox is located on the "Linking Parameters" Page.

There will be a checkbox named [Subprogram]. When you enable the checkbox, you will get a choice of Radio Buttons for [Absolute] or [Incremental]. Pick the 'incremental option'. (This means you shouldn't need to change the Miscellaneous Integer #2.

The output from this NC Code should give you a "Sub Program Call" in your NC Code:


TxxM06
G00 G90 G55 X_ Y_ S_ M03
G43 Hxx Z_
M98 P1000

Then, depending on the Control Definition Switch for "Subs before/after", you'll get your "O1000" Subroutine either before the "main program", or "after the main program (M30)".

You should use this to Thread Mill the first hole in your group.

Next you should create a new Drill Toolpath, and set the "subroutine" option in the Drill Cycle.

For this path, it should not output any "tool change code", unless you've got the "Force Tool Change" option enabled.

This path should just be a series of "M98 Pxxxx" calls. (You enter the Subroutine # in the 'Peck 1' parameter in the Drill Cycle Parameters.

Ah, it’s time to update to 2022!

thanks again!

Link to comment
Share on other sites
13 hours ago, Michael Sullivan said:

Unfortunately, when you work for the department of defense (federal employee), any kind of flash memory is poo poo’d for security reasons.

Regardless of the machine builder, the maximum memory for some of these controls is like 3 MB and it costs thousands of dollars to upgrade, it’s ridiculous! What year is it in Fanucland?!?! 😆

As a US Tax payer I give you permission to appropriately option your machine. The time you spend fiddlefarting around instead will be paid for in short order. :cheers:

The memory in your FANUC control is not the same as the memory in your PC. We've had this this discussion here several times at least ad nauseum. Your FANUC control is designed to operate without fail for decades. The iron may be another story. FANUC takes it's MTBF numbers VERY stats seriously. It's more reliable than server memory. It is also an SRAM type of memory whereas your computer is DRAM. The SRAM is the cache memory on your CPU, and your CPU's MAX memory is 16MB. I don't hear anyone complaining about the cost of a CPU chip with 16MB of cache. :rofl:

  • Haha 1
Link to comment
Share on other sites
1 hour ago, Michael Sullivan said:

Ah, it’s time to update to 2022!

thanks again!

Michael,

I did some quick checking and it looks like the 'Subprogram' switch is missing from the Thread Mill Toolpath! Sorry about giving you bad advice.

This is a bummer, but there is a way to overcome it. It just isn't pretty.

Creat the Thread Mill path like normal. You'll generate a Toolpath with rough/finish passes. 

> Backplot the Toolpath, and save it as geometry. Trim the start/end of the path, and remove any lines from entry/exit. Just keep the arcs. (Be sure 'Linearize Helix' is off.)

> Chain these helical paths, using Contour. Set Comp to Control. (You want centerline of tool to follow centerline of the helix).

> for Lead In/out, set to Perpendicular, and set Arc to 0.0. Use a small linear entry/exit. 

> Enable the Subprogram checkbox, Incremental. 

 

The extra steps make it a pain, but it will work to generate a single Subroutine that can then be called anywhere else using an absolute position move, then calling M98 with an incremental Subroutine.

Link to comment
Share on other sites
29 minutes ago, Colin Gilchrist said:

Michael,

I did some quick checking and it looks like the 'Subprogram' switch is missing from the Thread Mill Toolpath! Sorry about giving you bad advice.

This is a bummer, but there is a way to overcome it. It just isn't pretty.

Creat the Thread Mill path like normal. You'll generate a Toolpath with rough/finish passes. 

> Backplot the Toolpath, and save it as geometry. Trim the start/end of the path, and remove any lines from entry/exit. Just keep the arcs. (Be sure 'Linearize Helix' is off.)

> Chain these helical paths, using Contour. Set Comp to Control. (You want centerline of tool to follow centerline of the helix).

> for Lead In/out, set to Perpendicular, and set Arc to 0.0. Use a small linear entry/exit. 

> Enable the Subprogram checkbox, Incremental. 

 

The extra steps make it a pain, but it will work to generate a single Subroutine that can then be called anywhere else using an absolute position move, then calling M98 with an incremental Subroutine.

Why not draw the Helix and drive that with Contour 3D, Other thing is use Ramp grabbing a circle and make the Ramp amount the Pitch of the thread. Then call the contour operation without all the extra work of having to save out geometry? How we did it before we had a threadmilling toolpath. I wrote this as a Macro program over 25 years ago. 6 lines of code and I could threadmill any size to any depth with a single point tool all day long. Back before we had full profile threadmills we have now.

Here is a file showing both ways:

https://www.dropbox.com/s/chbh5uoycen05iq/5TH%20AXIS%20OLD%20SCHOOL%20THREADMILL.mcam?dl=0

Edited by crazy^millman
Dropbox Link added
  • Like 2
Link to comment
Share on other sites
1 minute ago, crazy^millman said:

Why not draw the Helix and drive that with Contour 3D, Other thing is use Ramp grabbing a circle and make the Ramp amount the Pitch of the thread. Then call the contour operation without all the extra work of having to save out geometry? How we did it before we had a threadmilling toolpath. I wrote this as a Macro program over 25 years ago. 6 lines of code and I could threadmill any size to any depth with a single point tool all day long. Back before we had full profile threadmills we have now.

Yes, I agree Ron. There are many different ways to accomplish the task at hand. Fanuc Macro B is a great solution. Technically, if you wanted to keep in inside Mastercam, you could create a new Machine Group, and use a Manual Entry Path to hand-code the Subroutine. That way it could reside in the Control, and you could simply call it with a Macro Call.

G65 is a one-shot call, meaning you can pass variable values.

A trick I just learned is to use G66.1/G67 to repeat a subroutine at multiple locations.

With G66.1 & G67, you could execute the Subroutine call like a Canned Drill Cycle. After you call the 1st G66.1 line of code, it would then repeat just like a G81 cycle, by entering successive XY locations. But also, you could change any of the arguments, on any of the call lines. This would let you program multiple depths, sizes, anything, and just continue calling the same Subprogram (Pxxxx), at new locations. The call is cancelled by a "G67". (similar to how G80 cancels a Canned Drill Cycle.)

That would let anyone set up a "Canned Cycle", that simply executes a particular Subroutine, at multiple locations. (Just change the arguments on each line, or add new lines)

  • Like 3
Link to comment
Share on other sites

I think that I was able to get this to work but double check me on this.

 

I created the thread milling operation at the first location.

I used transform to create the sub checking sub - incremental.  I set to copy source and disable posting in selected source.   Transformed it X0 Y0 Instances 1 and 1

Then I created the drill sub as colin suggested.  

here was the output. 

 

 

%
O0010 (mc2022_T OP1)
(DATE  - AUG-25-2021 - TIME  - 9:57 AM)
(T1   - CARMEX 0.197 MTSH0250C57 28 UN THREAD MILL - H1   - D1   - D0.1970")
G91 G30 Z0.
N1 T1 M06 (CARMEX 0.197 MTSH0250C57 28 UN THREAD MILL)
M1
G20 G40 G49 G80
M68 (TURN ON CHIP CONVEYOR)
G00 G17 G90 G54 X1.0569 Y1.0332 S2909 M04
G43 H1 Z1.
M98 P0011
G90 X.7146 Y1.8663
G00 G90 X.7146 Y1.8663
M98 P0011
G00 G90 X-.2797 Y1.2908
M98 P0011
G00 G90 X-1.0665 Y.4713
M98 P0011
G00 G90 X-.5748 Y-.4101
M98 P0011
G00 G90 X.9841 Y-.5303
M98 P0011
G00 G90 X1.6252 Y.4276
M98 P0011
G91 G30 Z0.
G30 Y0.
G90
M69 (TURN OFF CHIP CONVEYOR)
M01
M30

O0011
G91
Z-.9
G94 G01 Z-.35 F100.
Y-.0015 F3.33
G03 X.0265 Y.0015 Z.0089 I.0132 J.0015
Z.0357 I-.0265 J0.
Z.0358 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
X-.0265 Y-.0265 Z.0268 I-.0265 J0.
X.0015 Y.0265 Z.0089 I0. J.0133
G01 X-.0015
G00 Z.0911
Z.9
M99
%

 

threadmill sub test.mcam

  • Like 5
Link to comment
Share on other sites
2 hours ago, neurosis said:

I think that I was able to get this to work but double check me on this.

 

I created the thread milling operation at the first location.

I used transform to create the sub checking sub - incremental.  I set to copy source and disable posting in selected source.   Transformed it X0 Y0 Instances 1 and 1

Then I created the drill sub as colin suggested.  

here was the output. 

 

 

%
O0010 (mc2022_T OP1)
(DATE  - AUG-25-2021 - TIME  - 9:57 AM)
(T1   - CARMEX 0.197 MTSH0250C57 28 UN THREAD MILL - H1   - D1   - D0.1970")
G91 G30 Z0.
N1 T1 M06 (CARMEX 0.197 MTSH0250C57 28 UN THREAD MILL)
M1
G20 G40 G49 G80
M68 (TURN ON CHIP CONVEYOR)
G00 G17 G90 G54 X1.0569 Y1.0332 S2909 M04
G43 H1 Z1.
M98 P0011
G90 X.7146 Y1.8663
G00 G90 X.7146 Y1.8663
M98 P0011
G00 G90 X-.2797 Y1.2908
M98 P0011
G00 G90 X-1.0665 Y.4713
M98 P0011
G00 G90 X-.5748 Y-.4101
M98 P0011
G00 G90 X.9841 Y-.5303
M98 P0011
G00 G90 X1.6252 Y.4276
M98 P0011
G91 G30 Z0.
G30 Y0.
G90
M69 (TURN OFF CHIP CONVEYOR)
M01
M30

O0011
G91
Z-.9
G94 G01 Z-.35 F100.
Y-.0015 F3.33
G03 X.0265 Y.0015 Z.0089 I.0132 J.0015
Z.0357 I-.0265 J0.
Z.0358 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
X-.0265 Y-.0265 Z.0268 I-.0265 J0.
X.0015 Y.0265 Z.0089 I0. J.0133
G01 X-.0015
G00 Z.0911
Z.9
M99
%

 

threadmill sub test.mcam

That's a great way to do it!

I didn't think of using Transform, with a X0. Y0. offset, to get the ability to change the output into a Subroutine. Very clever Dave!

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

I didn't think of using Transform, with a X0. Y0. offset, to get the ability to change the output into a Subroutine. Very clever Dave!

I like to contribute something at least once every 5 years  :D  

To be honest, when you mentioned the subprogram button in the drilling operation linking parameters, I remember that transform had the subroutine built in.  I just played off of your suggestion. 

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

A trick I just learned is to use G66.1/G67 to repeat a subroutine at multiple locations.

With G66.1 & G67, you could execute the Subroutine call like a Canned Drill Cycle. After you call the 1st G66.1 line of code, it would then repeat just like a G81 cycle, by entering successive XY locations. But also, you could change any of the arguments, on any of the call lines. This would let you program multiple depths, sizes, anything, and just continue calling the same Subprogram (Pxxxx), at new locations. The call is cancelled by a "G67". (similar to how G80 cancels a Canned Drill Cycle.)

That would let anyone set up a "Canned Cycle", that simply executes a particular Subroutine, at multiple locations. (Just change the arguments on each line, or add new lines)

I see someone reads Modern Machine Shop magazine.  :yes That was a good article.

  • Like 3
Link to comment
Share on other sites

 

4 hours ago, neurosis said:

I think that I was able to get this to work but double check me on this.

 

I created the thread milling operation at the first location.

I used transform to create the sub checking sub - incremental.  I set to copy source and disable posting in selected source.   Transformed it X0 Y0 Instances 1 and 1

Then I created the drill sub as colin suggested.  

here was the output. 

 

 

%
O0010 (mc2022_T OP1)
(DATE  - AUG-25-2021 - TIME  - 9:57 AM)
(T1   - CARMEX 0.197 MTSH0250C57 28 UN THREAD MILL - H1   - D1   - D0.1970")
G91 G30 Z0.
N1 T1 M06 (CARMEX 0.197 MTSH0250C57 28 UN THREAD MILL)
M1
G20 G40 G49 G80
M68 (TURN ON CHIP CONVEYOR)
G00 G17 G90 G54 X1.0569 Y1.0332 S2909 M04
G43 H1 Z1.
M98 P0011
G90 X.7146 Y1.8663
G00 G90 X.7146 Y1.8663
M98 P0011
G00 G90 X-.2797 Y1.2908
M98 P0011
G00 G90 X-1.0665 Y.4713
M98 P0011
G00 G90 X-.5748 Y-.4101
M98 P0011
G00 G90 X.9841 Y-.5303
M98 P0011
G00 G90 X1.6252 Y.4276
M98 P0011
G91 G30 Z0.
G30 Y0.
G90
M69 (TURN OFF CHIP CONVEYOR)
M01
M30

O0011
G91
Z-.9
G94 G01 Z-.35 F100.
Y-.0015 F3.33
G03 X.0265 Y.0015 Z.0089 I.0132 J.0015
Z.0357 I-.0265 J0.
Z.0358 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
Z.0357 I-.0265 J0.
X-.0265 Y-.0265 Z.0268 I-.0265 J0.
X.0015 Y.0265 Z.0089 I0. J.0133
G01 X-.0015
G00 Z.0911
Z.9
M99
%

 

threadmill sub test.mcam

I’m glad I started such a good discussion after so many years. 🙂
 

This is what I tried first but I was missing the subprogram switch that is in the MPmaster post at the time.

 

I didn’t think to try it again after adding MPMaster.

Now that I have that piece of the puzzle! perfect!!!

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

The  best discussions on this forum are always spawned by someone asking a good question. Sometimes it is the simplest of tasks that really shows how much power is built into Mastercam by default. Many people have contributed amazing information over the years. I dearly miss Tim Markoski.

Agreed and yes he is missed.

  • Like 3
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...