Need Help! How do I repeat a small part many times on a flat sheet.


Results 1 to 9 of 9

Thread: How do I repeat a small part many times on a flat sheet.

  1. #1

    Default How do I repeat a small part many times on a flat sheet.

    I need help.
    I don't have any CAD/CAM software (yet), so I just manually G-code at the control.
    I have a job coming up that is a small, simple rectangular part about 1" x .437".
    I want to mill several of these out of a 1/16" sheet of aluminum.
    So how do I repeat the basic part program a number of times in a pattern?
    I really don't want to write a subroutine with several different offsets. G54, G55, G56, G57 etc (Last resort?)
    Is there a code in MACH3 for nesting? Array? something?
    Any help is greatly appreciated.

    Similar Threads:


  2. #2
    Member
    Join Date
    Dec 2010
    Location
    USA
    Posts
    1230
    Downloads
    0
    Uploads
    0

    Default Re: How do I repeat a small part many times on a flat sheet.

    I would make the code O001, then call

    M98 P001 L1 (CALLS CODE)
    G52 X1.5. (OFFSET TO NEXT PART)
    M98 P001 L1. (CALLS CODE IN NEW LOCATION)
    G52 X3.0. OFFSET ANYTHING 1.5")
    M98 P001 L1. (CALL CODE NEW LOCATION)

    G52 X0 Y0 Z0 (CLEARS OFFSET BACK TO ORIGINAL LOCATION)

    be sure to change your program start/stop to something that makes since. I'll upload a file I'm running on the HAAS right now in a second. Not on the HAAS I'm using m97, on Mach u use m98. Also on Mach you need % between each program / sub-program

    Brian
    WOT Designs



  3. #3
    Member
    Join Date
    Dec 2010
    Location
    USA
    Posts
    1230
    Downloads
    0
    Uploads
    0

    Default Re: How do I repeat a small part many times on a flat sheet.

    This example is going to illustrate conditional programming also. This file runs tool one on 6 parts in a row, then the same tool from a different file on the next row. It calculates the distance between them by adjusting the 1.5"-ish value.

    Code:
    %
    O00001 ( RUN 6 LETTERS ) 
    
    G20 G17 G90 G54 
    G52 X0 Y0 Z0 
    
    (X-, Y+, Z@H) 
    (FACE THEN TOUCH Z) 
    
    #600= 1.5138 ( ACTUAL SIZE OF PARTS BLOCK ) 
    #601= [ #600 / 6 ] (6 PARTS WIDE) 
    #602= [ #601 / 2 ] (OFFSET TO FIRST PART) 
    #603= [ #601 + #602 ] (SECOND PART OFFSET) 
    #700= 0 (N#) 
    
    
    ( ** TOOL 1 - ROW 1 ** ) 
    G52 Y [ #602 * -1 ] 
    #700= 1 
    () M97 P1000 L1 
    ( ** TOOL 1 - ROW 2 ** ) 
    G52 Y [ [ #602 * -1 ] - #601 ]
    #700= 4 
    () M97 P1000 L1 
    ( ** TOOL 1 - ROW 3 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 2 * #601 ] ] 
    #700= 7 
    () M97 P1000 L1 
    ( ** TOOL 1 - ROW 4 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 3 * #601 ] ] 
    #700= 10 
    () M97 P1000 L1 
    ( ** TOOL 1 - ROW 5 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 4 * #601 ] ] 
    #700= 13 
    () M97 P1000 L1 
    ( ** TOOL 1 - ROW 6 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 5 * #601 ] ] 
    #700= 16 
    () M97 P1000 L1 
    
    (----------------------)
    
    ( ** TOOL 2 - ROW 1 ** ) 
    G52 X0 Y [ #602 * -1 ] 
    #700= 2 
    () M97 P1000 L1 
    ( ** TOOL 2 - ROW 2** ) 
    G52 Y [ [ #602 * -1 ] - #601 ] 
    #700= 5 
    () M97 P1000 L1 
    ( ** TOOL 2 - ROW 3 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 2 * #601 ] ] 
    #700= 8 
    () M97 P1000 L1 
    ( ** TOOL 2 - ROW 4 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 3 * #601 ] ] 
    #700= 11 
    () M97 P1000 L1 
    ( ** TOOL 2 - ROW 5 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 4 * #601 ] ] 
    #700= 14 
    () M97 P1000 L1 
    ( ** TOOL 2 - ROW 6 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 5 * #601 ] ] 
    #700= 17 
    () M97 P1000 L1 
    
    (----------------------)
    
    ( ** TOOL 3 - ROW 1 ** ) 
    G52 X0 Y [ #602 * -1 ] 
    #700= 3 
    () M97 P1000 L1 
    ( ** TOOL 3 - ROW 2 ** ) 
    G52 Y  [ [ #602 * -1 ] - #601 ] 
    #700= 6 
    () M97 P1000 L1 
    ( ** TOOL 3 - ROW 3 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 2 * #601 ] ] 
    #700= 9 
    () M97 P1000 L1 
    ( ** TOOL 3 - ROW 4 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 3 * #601 ] ] 
    #700= 12 
    () M97 P1000 L1 
    ( ** TOOL 3 - ROW 5 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 4 * #601 ] ] 
    #700= 15 
    () M97 P1000 L1 
    ( ** TOOL 3 - ROW 6 ** ) 
    G52 Y [ [ #602 * -1 ] - [ 5 * #601 ] ] 
    #700= 18 
    () M97 P1000 L1 
    
    
    
    G52 X0 Y0 Z0 
    M09 
    G53 G00 Z0 
    M05 
    G53 G00 Y0 
    M30 
    
    
    N1000 ( ** SINGLE ROW RUN CODE ** ) 
    
    G52 X#602 
    (PART 1) M97 P#700 L1 
    G52 X#603 
    (PART 2) M97 P#700 L1 
    G52 X [ #601 + #603 ] 
    (PART 3) M97 P#700 L1 
    G52 X [ [ #601 * 2 ] + #603 ] 
    (PART 4) M97 P#700 L1 
    G52 X [ [ #601 * 3 ] + #603 ] 
    (PART 5) M97 P#700 L1 
    G52 X [ [ #601 * 4 ] + #603 ] 
    (PART 6) M97 P#700 L1 
    
    M99 
    
    
    
    
    (------------------------------) 
    
    
    (3)
    ( RAMP ROUGH FLAT OUTTER - 0.01 )
    N1 T1 M6
    G0 G90 X.1281 Y0. A0. S6000 M3
    G43 H1 Z1.
    M8
    Z.01
    G1 X.1265 Y-.02 Z.0099 F6.
    X.1218 Y-.0396 Z.0098
    X.1141 Y-.0582 Z.0096
    X.1036 Y-.0753 Z.0095
    X.0906 Y-.0906 Z.0094
    X.0753 Y-.1036 Z.0093
    X.0582 Y-.1141 Z.0092
    X.0396 Y-.1218 Z.009
    
    ........ much more code
    I created a POST that outputs every tool change as a sub program with its own "N" number, but for mach you need "O" numbers. It doesn't add any M9, M5, or full retract at the end of each tool just a "M99" which returns to the master program. This is a very flexible way of programming. Mind you it takes a little "learnin" to get used to but its VERY easy and fast. Many times I type the macro call right on the machine. I can go pull a few more examples directly from the Tormach if anyone is interested.

    Other ways of doing it would be program as incremental (G91) and instead of G52 you could end the code with "X-1.5, M99" then use a main program of "M98 P001 L5" would call the program 5 times, BUT it would also jog 1.5" past the last part.

    There are dozens of other ways to do this, but G52 I use on 75% of the programs I run as they are almost all in need of adjustments on machine to part thickness, or I need to skip some sometimes. If it need to skip I just go to the appropriate "M97/M98" call and type a "/" in front (I leave block delete ON by default"



  4. #4
    Member Steve Seebold's Avatar
    Join Date
    Mar 2009
    Location
    USA and proud of it
    Posts
    1863
    Downloads
    0
    Uploads
    0

    Default Re: How do I repeat a small part many times on a flat sheet.

    Mach has several fixture offsets. You can use the regular G54 though G59 offsets then you can continue with G59PXXXX. I'm not sure how many offsets there in G59PXXXX, but there are a bunch.

    Or you can just copy and paste your part and create a huge program.

    I have done it both ways.

    You can buy GOOD PARTS or you can buy CHEAP PARTS, but you can't buy GOOD CHEAP PARTS.


  5. #5
    Registered
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    106
    Downloads
    0
    Uploads
    0

    Default Re: How do I repeat a small part many times on a flat sheet.

    Just use a sub routine or sub program and use G91 . You can then loop it as many times as you wish to produce one part and then incrementally move to the next part.


    Sent from my iPad using Tapatalk



  6. #6

    Default Re: How do I repeat a small part many times on a flat sheet.

    Thanks guys.
    G52 worked like a charm.
    I had to write 3 macro programs for the spot drill, drill, and endmill, but it wasn't that big of a deal.
    Used G52 X,Y to shift part locations and the G98 Pxxx for the macros.
    OUTSTANDING!!!



  7. #7
    Registered Hirudin's Avatar
    Join Date
    Jun 2008
    Location
    Albuquerque, New Mexico, USA
    Posts
    1082
    Downloads
    0
    Uploads
    0

    Default Re: How do I repeat a small part many times on a flat sheet.

    Quote Originally Posted by WOTDesigns View Post
    I would make the code O001, then call

    M98 P001 L1 (CALLS CODE)
    G52 X1.5. (OFFSET TO NEXT PART)
    M98 P001 L1. (CALLS CODE IN NEW LOCATION)
    G52 X3.0. OFFSET ANYTHING 1.5")
    M98 P001 L1. (CALL CODE NEW LOCATION)

    G52 X0 Y0 Z0 (CLEARS OFFSET BACK TO ORIGINAL LOCATION)

    be sure to change your program start/stop to something that makes since. I'll upload a file I'm running on the HAAS right now in a second. Not on the HAAS I'm using m97, on Mach u use m98. Also on Mach you need % between each program / sub-program

    Brian
    WOT Designs
    Thanks a bunch for this and the example code!



  8. #8
    Member
    Join Date
    Dec 2010
    Location
    USA
    Posts
    1230
    Downloads
    0
    Uploads
    0

    Default Re: How do I repeat a small part many times on a flat sheet.

    Very welcome! I love macros!

    Brian
    WOT Designs



  9. #9
    Registered Hirudin's Avatar
    Join Date
    Jun 2008
    Location
    Albuquerque, New Mexico, USA
    Posts
    1082
    Downloads
    0
    Uploads
    0

    Default Re: How do I repeat a small part many times on a flat sheet.

    I've been playing with this and I wrote a little macro that lets you input the number of rows, the number of columns, the spacing between them, and the starting and ending subroutine sequence-number and it'll repeat a single process on every item in the array. I've tested it a bit with my Brother and it seems to work. One thing, I couldn't figure out how to put a subprogram into the same file that makes the call so I had to put all my subprograms into a separate file (referenced by #101). I commented every line so y'all (and me, in the future) can see what is going on more easily. If your subroutines are in the same file you could probably edit the following line to reference them...
    from
    M98 P#101 H#195 (run current subroutine sequence-number in the subroutine file)
    to
    M98 P#195 (run current subroutine)

    Also note the presence of following two lines that I inserted to make the head retract before each subroutine call. You may want to change or omit them.
    G91 G28 Z0 (**** CAUTION: this command may behave differently on different machines ****)
    G90 (**** CAUTION: this command assumes absolute positioning ****)


    This macro assumes your subroutines can be run in order starting with the lowest number to the greatest number (for instance, the NC file I was using had 12 ops labeled "N1" through "N12"). This is how the HSMWorks post processor I'm using outputs sequence numbers so it's convenient for me. Some editing (of the macro or your code) might be necessary to make it work fer you.

    Anyway, hopefully this'll be helpful and stuff...

    Code:
    (Hirudin's array macro v1.1)
    N9990 (refrence marker)
    (user vars #101          )
    (     #170 #171 #175 #179)
    (     #180 #181 #185 #189)
    (     #190 #191 #195 #199)
    
    ( : rows)
    #170 = 10.  (Y offset - distance between rows)
    #171 = 1    (first row)
    #179 = 2    (last row)
    
    (.. columns)
    #180 = 10.  (X offset - distance between columns)
    #181 = 1    (first column)
    #189 = 2    (last column)
    
    (subroutines)
    #101 = 1001 (subroutine file number)
    #191 = 1    (first subroutine sequence-number)
    #199 = 2    (last subroutine sequence-number)
    (/user vars)
    
    (**** START ****)
    IF[#179 LT #171]GOTO9999 (stop processing if the last row is less than the first)
    IF[#189 LT #181]GOTO9999 (stop processing if the last column is less than the first)
    IF[#199 LT #191]GOTO9999 (stop processing if the last subroutine sequence-number is less than the first)
    #195 = #191 (initial current subroutine sequence-number)
    
    N9991 (start the current subroutine sequence-number)
    #175 = #171 (set current row to first row in user vars)
    #185 = #181 (set current column to first column in user vars)
    
    N9992 (start the current column)
    G52 X[[#185 - 1] * #180] (set local X offset to the current column)
    
    N9993 (process each row in the current column)
    G52 Y[[#175 - 1] * #170] (set local Y offset to the current row)
    G91 G28 Z0 (**** CAUTION: this command may behave differently on different machines ****)
    G90 (**** CAUTION: this command assumes absolute positioning ****)
    M98 P#101 H#195 (run current subroutine sequence-number in the subroutine file)
    IF[#175 EQ #179]GOTO9994 (stop processing rows if the current row is the last row)
    #175 = #175 + 1 (continue to the next row)
    GOTO9993 (restart row processing)
    
    N9994 (change columns or procede to subroutine sequence-number processing)
    #175 = #171 (reset current row to the first row)
    IF[#185 EQ #189]GOTO9995 (stop processing columns if the current column is the last column)
    #185 = #185 + 1 (continue to the next column)
    GOTO9992 (start processing the new column)
    
    N9995 (change subroutine sequence-number or finish)
    IF[#195 EQ #199]GOTO9999 (stop processing everything when last subroutine sequence-number completes)
    #195 = #195 + 1 (move to the next subroutine sequence-number)
    GOTO9991 (restart processing with new subroutine sequence-number)
    
    N9999 (end processing)
    (**** END ****)


    Last edited by Hirudin; 01-22-2015 at 06:08 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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

How do I repeat a small part many times on a flat sheet.

How do I repeat a small part many times on a flat sheet.