Thread: Tile / Repeat G-Code?
Hybrid View
-
24-01-2013 #1
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.!Last edited by JAZZCNC; 24-01-2013 at 10:40 AM.
-
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Anyone got some 2.5D G-code please ?
By dudz in forum Programmers CornerReplies: 5Last Post: 22-06-2013, 11:21 PM -
Cambium Code Web Tools – Parametric G-code Generation
By CambiumMachines in forum Manufacturer NewsReplies: 0Last Post: 09-01-2013, 04:56 AM -
Mach3 Using a physical button to repeat current gcode
By RLKS Rob in forum Artsoft Mach (3 & 4)Replies: 2Last Post: 12-08-2012, 01:30 PM -
Use a tile cutter as a hobby table saw?!!!
By HankMcSpank in forum General DiscussionReplies: 10Last Post: 21-07-2009, 06:56 PM -
G Code help
By moose007 in forum Programmers CornerReplies: 4Last Post: 22-05-2009, 11:39 AM
Bookmarks