Hello Guest it is April 23, 2024, 05:53:16 AM

Author Topic: G code  (Read 14034 times)

0 Members and 1 Guest are viewing this topic.

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: G code
« Reply #10 on: August 15, 2010, 04:20:05 PM »
I must be misunderstanding what you require, can you do a sketch or a photo of what it is you are trying to achieve.

Graham
 
Without engineers the world stops
Re: G code
« Reply #11 on: August 18, 2010, 04:25:26 AM »
Graham,

Basically, I have a cnc controlled quilting machine that I built.  It is simply an X-Y axis machine.  It runs in only four linear directions.  The x-axis is the longitude of the table which is approximately 12 feet long.  The Y-axis is the carriage for the sewing machine and it is perpendicular to the X-axis.  The patterns that I use are simple vector patterns that are mostly continuous line drawings.  What I am trying to do is start a pattern, and at the end of the pattern, have the dro reset to zero without moving the carriage back to the datum, then restart the sewing of the pattern so that the entire operation appears to be one continuous pattern sewn multiple times in a row, X number of times from edge to edge on the quilt.  This is called continuous line pattern quilting.  The problem that I am running into is that when I use the G52 and/or M98 in my files, they only repeat the pattern in the same place for the number of times designated.  Of course, this won't work because all of the stitches pile up in the same place one on top of the other.  I hope this gives you a better idea of the issue that I face.  Put another way, imagine a wave line on an oscilloscope, that is what I want the pattern to look like, connected end to end.

Larry

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: G code
« Reply #12 on: August 18, 2010, 04:50:02 AM »
Larry,

here is some code to try :-

%
O0001 (MAIN PROGRAM)

G21 G40
T1 M6
G52 X0 Y0
G00 X0 Y0
M98 P0002 (ENTER SUB)
G52 X50. (SHIFT DATUM BY 50MM)
M98 P0002 (ENTER SUB)
G52 X100. (SHIFT DATUM BY 100MM)
M98 P0002 (ENTER SUB)
M30

O0002(SUB)
G01 X50. (STITCH 50MM)
G52 X0
M99
%

This should give a line 150mm long made up of 50mm lines all joined up. Ignore what mach3 shows on the screen as it can not show datum shifts as yet.

Regards
Graham
« Last Edit: August 18, 2010, 04:51:45 AM by Graham Waterworth »
Without engineers the world stops
Re: G code
« Reply #13 on: August 19, 2010, 02:30:22 AM »
Graham,

I tried the new code that you provided, and it worked like a charm, now to write a macro that will ask for the datum shift and set up a loop to count the number of repeats.  Graham, you are truly a wizard among men.  Thank you so much!

Larry

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: G code
« Reply #14 on: August 19, 2010, 04:34:45 AM »
This is how I would do it :-

%
O0001 (MAIN PROGRAM)

#1=0      (COUNTER MUST BE ZERO )
#2=50.0 (PITCH OF PATTERN)
#3=3      (NUMBER OF REPEATS)

G21 G40
T1 M6

G52 X0 Y0
G00 G90 X0 Y0
M98 P0002 L[#3] (ENTER L TIMES)
G00 Z25.
M30

O0002(SUB 1)
G52 X[#1*#2]
(stitch code goes below this line)

G01 X50. F100. (STITCH 50MM)

(lines below this one must NOT be removed)
G52 X0
#1=[#1+1]
M99
%

Try this, all you have to do is change the # values and place the stitch code into sub 1

Graham
« Last Edit: August 19, 2010, 04:40:06 AM by Graham Waterworth »
Without engineers the world stops
Re: G code
« Reply #15 on: August 21, 2010, 10:14:00 AM »
Graham,

Yep, this one works even better!  Now I need find a way to display the number of reps on screen.

Larry
Re: G code
« Reply #16 on: August 24, 2010, 02:22:53 PM »
Hey Graham,

This one works so good, I think now I am going to write a short macro to call it up and allow me to make the entries from the screen and not inside the file.  Also, I found a way to display the number of reps left to complete on screen.  That works amazingly well.

Thanks for all you have done, you are truly a god among men.

Larry
Re: G code
« Reply #17 on: September 15, 2010, 03:15:00 PM »
Hi Graham,

I am still playing around with the repeat patterns routine that you so graciously provided, and, I must say, it is working perfectly.  My wife and I have completed 4 quilts using your code with no problems.

Now, to the meat and potatoes, is it possible to input the number of repeats into a dro that can pass the number to the Gcode as a variable?

Say for instance, I have a dro that is blank on the MachMill screen, and when I input a number into it it would pass the number to the #3 variable for execution?


Does that make sense?


Larry

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: G code
« Reply #18 on: September 16, 2010, 05:34:03 PM »
Hi Larry,

yes it can be done:-

1.  on your screen you will need a user DRO  numbered 1001

2. you write a macro with an unused number e.g. M1001.m1s with the following code in it, this needs to be saved in your current profile macro folder.

Setvar(3, getdro(1001))

3. in your g-code program call M1001 to read the value of the dro into #3

Thats all there is to it.. Send only large bags cash  ;D

Graham
Without engineers the world stops
Re: G code
« Reply #19 on: September 23, 2010, 12:31:55 PM »
Graham,

Using your example of the Datum shift macro that your provided, please place the M1001 in the proper place, here is the code for the Datum Shift macro:

%
O0001 (MAIN PROGRAM)

#1=0      (COUNTER MUST BE ZERO )
#2=50.0 (PITCH OF PATTERN)
#3=3      (NUMBER OF REPEATS) ( I tried inserting the M1001 here but no joy)

G21 G40
T1 M6

G52 X0 Y0
G00 G90 X0 Y0
M98 P0002 L[#3] (ENTER L TIMES)
G00 Z25.
M30

O0002(SUB 1)
G52 X[#1*#2]
(stitch code goes below this line)

G01 X50. F100. (STITCH 50MM)

(lines below this one must NOT be removed)
G52 X0
#1=[#1+1]
M99
%

Larry