586,089 active members*
3,883 visitors online*
Register for free
Login

Thread: Subroutine

Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2013
    Posts
    70

    Subroutine

    Just wondering if this is possible. I have written subroutines using incremental moves to machine counterbores and countersinks in v20.6. Is it possible to call subroutines in v27? The way the subroutines are written you have to position to the x,y coordinates of the hole that has been previously drilled then call the subroutine.

  2. #2
    Join Date
    Jun 2008
    Posts
    1838

    Re: Subroutine

    Quote Originally Posted by Idiod View Post
    Just wondering if this is possible. I have written subroutines using incremental moves to machine counterbores and countersinks in v20.6. Is it possible to call subroutines in v27? The way the subroutines are written you have to position to the x,y coordinates of the hole that has been previously drilled then call the subroutine.
    Yes, can be done, see the code below if this is something like what you are looking for;

    To enable Subprograms go to "Milling Job > Current Settings > Posting" and check the "Output Subprogram"

    This code is from a Mill Counterbore Feature, it has a drill and a counterbore (Using a counterbore drill) in three different positions, the main program does the first one and the subprogram calls the program again for the other two coordinates.

    %
    O1234 (PROGRAM NUMBER)

    (FIRST MACHINE SETUP - Machine Setup - 1)

    N10 G17 G21 G40 G49 G80 G94
    N20 G28 G91 Z0
    (STANDARD FEATURE COUNTERBORE HOLE - 8.0000)
    (TOOL #1 8.000 Dia.118.000 Deg. 15.000 CL)
    N30 T1 M06
    N40 G00 G90 G54 X-14.89 Y12.104 S191 M03
    N50 G43 H1 M08
    N60 Z5.
    N70 G83 G98 X-14.89 Y12.104 Z-17.403 R2. Q4. P0. F14.0973
    N80 M98 P10 (SUBPROGRAM CALL)
    N90 G80
    N100 G00 Z25.4
    N110 M09
    N120 M05
    N130 G91 G28 Z0.
    N140 G90

    (NEXT OPERATION - NEXT TOOL)
    (STANDARD FEATURE COUNTERBORE HOLE - 8.0000)

    (TOOL #2 13.000 Dia.6.500 SmDia. 2 Fl.)
    N150 T2 M06
    N160 G90 G54 X-14.89 Y12.104 S117 M03
    N170 G43 H2 Z25.4 M08
    N180 D2
    N190 G00 Z5.
    N200 G81 G98 X-14.89 Y12.104 Z-12.5 R2. F8.6753
    N210 M98 P10 (SUBPROGRAM CALL)
    N220 G80
    N230 G00 X-0.261 Y-15.412 Z25.4
    N240 M09
    N250 M05
    N260 G91 G28 Z0.
    (END OF FILE)
    N270 M30

    O10 (SUBPROGRAM OF O1234)
    N10 X12.626 Y8.969
    N20 X-0.261 Y-15.412
    M99

    (END OF PROGRAM)

    It`s a bit of a long winded way of doing it as BobCAD will do it anyway without the subprograms so I am a bit lost as to why you would need to have them ? ? I suppose it it what you are used to with the older V20

    See this code for no subprograms

    %
    O1234 (PROGRAM NUMBER)

    (FIRST MACHINE SETUP - Machine Setup - 1)

    N10 G17 G21 G40 G49 G80 G94
    N20 G28 G91 Z0
    (STANDARD FEATURE COUNTERBORE HOLE - 8.0000)
    (TOOL #1 8.000 Dia.118.000 Deg. 15.000 CL)
    N30 T1 M06
    N40 G00 G90 G54 X-14.89 Y12.104 S191 M03
    N50 G43 H1 M08
    N60 Z5.
    N70 G83 G98 X-14.89 Y12.104 Z-17.403 R2. Q4. P0. F14.0973
    N80 X12.626 Y8.969
    N90 X-0.261 Y-15.412
    N100 G80
    N110 G00 Z25.4
    N120 M09
    N130 M05
    N140 G91 G28 Z0.
    N150 G90

    (NEXT OPERATION - NEXT TOOL)
    (STANDARD FEATURE COUNTERBORE HOLE - 8.0000)

    (TOOL #2 13.000 Dia.6.500 SmDia. 2 Fl.)
    N160 T2 M06
    N170 G90 G54 X-14.89 Y12.104 S117 M03
    N180 G43 H2 Z25.4 M08
    N190 D2
    N200 G00 Z5.
    N210 G81 G98 X-14.89 Y12.104 Z-12.5 R2. F8.6753
    N220 X12.626 Y8.969
    N230 X-0.261 Y-15.412
    N240 G80
    N250 G00 Z25.4
    N260 M09
    N270 M05
    N280 G91 G28 Z0.
    (END OF FILE)
    N290 M30

    (END OF PROGRAM)
    %

    %

  3. #3
    Join Date
    Apr 2013
    Posts
    70

    Re: Subroutine

    The reason I use a subroutine for this is how quickly it is to program. I am setting up, programming and running multiple machines and to make the most of my time the quicker that I program the more parts come off the machines. I am actually at work today and will attach a file to illustrate what I want the code to look like. The way that I am doing it now is writing the program in V27 then opening it up in V20 to add the subroutines, unfortunately when I have to edit I have to redo the subroutine part of the program.
    Attached Files Attached Files

  4. #4
    Join Date
    Jun 2008
    Posts
    1838

    Re: Subroutine

    Sorry, still not with you, I don`t see how it can be quicker to do the program in V27 and then put it into V20 to create subprograms when everything is done in V27 in a single feature? Probably me just being a bit dim, it`ll be the age thing again

    See the attached file, as I don`t have V27 I have done it in V26 so you can open it but there is no difference in the method between the two Versions

    Code below, disregard any feeds/speeds, I didn`t bother setting them

    %
    O0001

    (Machine Setup - 1)

    N10 G17 G21 G40 G49 G80 G94
    N20 G28 G91 Z0
    (DRILL)
    (TOOL #1 8.500 Dia.118.000 Deg. 26.670 CL)
    N30 T1 M06
    N40 G00 G90 G54 X-40. Y30. S216 M03
    N50 G43 H1 M08
    N60 Z5.
    N70 G83 G98 X-40. Y30. Z-29.224 R2. Q4.25 P0. F15.9747
    N80 Y-30.
    N90 X40.
    N100 Y30.
    N110 G80
    N120 G00 Z25.4
    N130 M09
    N140 M05
    N150 G91 G28 Z0.
    N160 G90

    (NEXT OPERATION - NEXT TOOL)
    (COUNTERBORE MILL)

    (TOOL #2 8mm Flat End Mill 4Fl Carbide)
    N170 T2 M06
    N180 G90 G54 X-40. Y30. S230 M03
    N190 G43 H2 Z25.4 M08
    N200 G00 Z5.
    N210 Z2.
    N220 G01 Z-8. F33.9461
    N230 X-36.75 F67.8923
    N240 G17 G03 X-43.25 Y30. I-3.25 J0.
    N250 X-36.75 Y30. I3.25 J0.
    N260 G01 X-40.
    N270 G00 Z5.
    N280 Y-30.
    N290 Z2.
    N300 G01 Z-8. F33.9461
    N310 X-36.75 F67.8923
    N320 G03 X-43.25 Y-30. I-3.25 J0.
    N330 X-36.75 Y-30. I3.25 J0.
    N340 G01 X-40.
    N350 G00 Z5.
    N360 X40.
    N370 Z2.
    N380 G01 Z-8. F33.9461
    N390 X43.25 F67.8923
    N400 G03 X36.75 Y-30. I-3.25 J0.
    N410 X43.25 Y-30. I3.25 J0.
    N420 G01 X40.
    N430 G00 Z5.
    N440 Y30.
    N450 Z2.
    N460 G01 Z-8. F33.9461
    N470 X43.25 F67.8923
    N480 G03 X36.75 Y30. I-3.25 J0.
    N490 X43.25 Y30. I3.25 J0.
    N500 G01 X40.
    N510 G00 Z5.
    N520 Z25.4
    N530 M09
    N540 M05
    N550 G91 G28 Z0.
    (END OF FILE)
    N560 M30

    (END OF PROGRAM)
    %


    Regards
    Rob
    :rainfro: :rainfro: :rainfro:

  5. #5
    Join Date
    Apr 2013
    Posts
    70

    Re: Subroutine

    The reason that the subroutine is quicker, at least for me is. All it takes is three clicks on the mouse to create a consistent Counbterbore and or Countersink that is chamfered at the top and at the corner of the drilled hole. All I do is use the move to point option which writes the X, Y coordinates then I use a macro to write the subroutine call. I understand everybody does things differently, I was just wondering if there was some way to write the code I need in V27?

  6. #6
    Join Date
    Jun 2008
    Posts
    1838

    Re: Subroutine

    OK, fair play to you, if you already have a Macro that does the job for you then great, job done

    I just find it much easier to select all the options loke drill, counterbore mill, chamfer etc, etc all within a single Counterbore feature and generate the code, for me job done

    Regards
    Rob
    :rainfro: :rainfro: :rainfro:

Similar Threads

  1. subroutine
    By kendo in forum Okuma
    Replies: 3
    Last Post: 01-14-2010, 01:50 PM
  2. engraving subroutine
    By kendo in forum Haas Mills
    Replies: 7
    Last Post: 06-26-2009, 08:21 PM
  3. how to write a subroutine
    By Harryman in forum G-Code Programing
    Replies: 11
    Last Post: 08-04-2008, 05:04 PM
  4. Example of a Subroutine?
    By donl517 in forum Fadal
    Replies: 14
    Last Post: 06-27-2007, 04:05 PM
  5. Need help with subroutine
    By 2_jammer in forum Uncategorised CAM Discussion
    Replies: 1
    Last Post: 01-18-2005, 05:46 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •