Page 1 of 3 123 LastLast
  1. #1

    I have made some G-Code and tested it and tuned it all as I want. Now I'd like to produce it numerous times across a large sheet of material. Is there a way to 'tile' the G-Code so I don't have to program it all again many times over?

    I guess there must be a way to copy the G-code with all the co-ordinates off-set by a fixed amount?

    I hope so!

  2. #2
    I would think that that would involve a loop to change an offset. Check out this link it may help

    G-Code Tutorial: Conditions and Looping

    The more I know, I know, I know the less. (John Owen)

  3. #3
    If you use mach 3 I think one of the built-in wizards does what you need.
    Old router build log here. New router build log here. Lathe build log here.
    Electric motorbike project here.

  4. #4
    Thanks Jonathan. Any help on which wizard it is? I've never used any wizards before.

  5. #5
    Check out nesting
    If the nagging gets really bad......Get a bigger shed:naughty:

  6. #6

  7. #7
    Wow, the whole book is online for free?

  8. #8
    D.C.'s Avatar
    Lives in Birmingham, United Kingdom. Last Activity: 05-01-2016 Has been a member for 4-5 years. Has a total post count of 326. Received thanks 31 times, giving thanks to others 24 times.
    Quote Originally Posted by Tenson View Post
    Wow, the whole book is online for free?
    Nope that is just a preview.

  9. #9
    Quote Originally Posted by John S View Post
    Work offsets will still need the G-Code repeating but with the relevant work offset added. Workoff sets are ok if just few parts needed but not ideal if for instance you wanted say the Word "Jazz" cutting 100 times. There are better ways.

    One better way to do it if just a few is to put your main code in a subroutine then call the subroutine using M98 p#. You can then either use incremental moves for the offset and recall the subroutine or like John says use Workoff sets in the main program and then call the subroutine like this. (also see attached file for G91 incremental move way which will draw 8 squares 50mm apart using same code)

    G21 (metric units)
    G54 (Default work offset)
    G0 z10 (move to position)
    (Main program will write whats in subroutine at each Work offset location)
    M98 p1000 (Call subroutine)
    G55 (Work offset 1 )
    M98 p1000 (Call subroutine)
    G56 (Work offset 2 )
    M98 p1000 (Call subroutine)

    M30 ( End and rewind)

    o1000 (Sub routine)
    Pretend this is G-code and writes
    G1 "John S is an Old Twat . .LMAO"
    M99 (End sub)

    Even better way is to put the G-code you want cut in a Macro file and using parameters for the start location which you then feed from the main program. This is getting a bit more involved so won't go into it but just search parameteric G-code amd macro.
    Look here G-Code Tutorial: Parameterized Programming

    Attached Files Attached Files
    Last edited by JAZZCNC; 24-01-2013 at 10:21 AM.

  10. #10
    Here the same G-code for the Squares but using parametric G-code.

    Notice how it's much cleaner code and even thou theres twice has many squares there's less lines of code.
    This is made possible by the fact the subroutine is called 4 times with the (L) parameter and the use of a variable we define has #1 at the top which we then use at the end of the SUB (G91 x#1) to offset the next square on the X axis. We actually didn't need the variable and could just used a G91 150 incremental move but you'll see why we did below.

    Now here's the beauty of Parametric g-code. If you look carefully you'll see that the first row is offset in X direction by 10mm but the proceeding rows are not.?
    This is because at line n50 we moved x10 but when we return from the sub and reposition to start of next row with line n70 it used the value in #2 variable which is 0. So each time we return from the proceeding subs we return to X0 and it repeats.
    We don't want this and if this was normal code it would say X0 on every line it now says X#2 and we'd have to edit every line. Using variables we don't need to and can just edit #2 variable and hey presto every line gets changed. .

    Now going back to the Sub you should see why we used the variable.? . . .Yep by just changing the #1 variable we can instantly change the offset for all squares.
    Also by just repeating 2 lines (m98 p1000 L4) & ( g0 x#2 ) we can add 4 more squares in another row.!
    Attached Files Attached Files
    Last edited by JAZZCNC; 24-01-2013 at 09:40 AM.

  11. The Following 2 Users Say Thank You to JAZZCNC For This Useful Post:

Page 1 of 3 123 LastLast

Similar Threads

  1. Anyone got some 2.5D G-code please ?
    By dudz in forum Programmers Corner
    Replies: 5
    Last Post: 22-06-2013, 10:21 PM
  2. Cambium Code Web Tools Parametric G-code Generation
    By CambiumMachines in forum Manufacturer News
    Replies: 0
    Last Post: 09-01-2013, 03:56 AM
  3. Mach3 Using a physical button to repeat current gcode
    By RLKS Rob in forum Artsoft Mach
    Replies: 2
    Last Post: 12-08-2012, 12:30 PM
  4. Use a tile cutter as a hobby table saw?!!!
    By HankMcSpank in forum General Discussion
    Replies: 10
    Last Post: 21-07-2009, 05:56 PM
  5. G Code help
    By moose007 in forum Programmers Corner
    Replies: 4
    Last Post: 22-05-2009, 10:39 AM


Posting Permissions

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