Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: Tony Spencer on May 12, 2010, 10:41:08 AM
-
Hi All
Very new cnc and G code so need help. I am testing a new home built by machining a small mounting bracket for a stepper moter. The problem I have is with a pocketing operation in the centre of the bracket. The first pass is ok but the second is off centre in the y axis and the third also off,and so on. The cumlative error produces a steped pocket at final depth. I am very new to CNC but is this problem related to g90 ,g90.1??
Any help would be appreciated
Thanks
-
Can you post your code so we can check it?
-
hi Jerry
Here is the code;
The profile cuts ok the problem is with the pocket
[( Made using CamBam - http://www.cambam.co.uk )
( stepperv3 5/12/2010 9:33:52 PM )
( T0 : 6.0 )
G21 G90 G64 G40
G0 Z1.5
( T0 : 6.0 )
T0 M6
( Profile1 )
G17
M3 S0
G0 X-50.0 Y-33.0
G1 F30.0 Z-1.0
G1 F300.0 X50.0
G3 X53.0 Y-30.0 I0.0 J3.0
G1 Y30.0
G3 X50.0 Y33.0 I-3.0 J0.0
G1 X-50.0
G3 X-53.0 Y30.0 I0.0 J-3.0
G1 Y-30.0
G3 X-50.0 Y-33.0 I3.0 J0.0
G1 F30.0 Z-2.0
G1 F300.0 X50.0
G3 X53.0 Y-30.0 I0.0 J3.0
G1 Y30.0
G3 X50.0 Y33.0 I-3.0 J0.0
G1 X-50.0
G3 X-53.0 Y30.0 I0.0 J-3.0
G1 Y-30.0
G3 X-50.0 Y-33.0 I3.0 J0.0
G1 F30.0 Z-3.0
G1 F300.0 X50.0
G3 X53.0 Y-30.0 I0.0 J3.0
G1 Y30.0
G3 X50.0 Y33.0 I-3.0 J0.0
G1 X-50.0
G3 X-53.0 Y30.0 I0.0 J-3.0
G1 Y-30.0
G3 X-50.0 Y-33.0 I3.0 J0.0
G1 F30.0 Z-4.0
G1 F300.0 X50.0
G3 X53.0 Y-30.0 I0.0 J3.0
G1 Y30.0
G3 X50.0 Y33.0 I-3.0 J0.0
G1 X-50.0
G3 X-53.0 Y30.0 I0.0 J-3.0
G1 Y-30.0
G3 X-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X11.2
G2 F300.0 X-5.6 Y-9.6995 I-11.2 J0.0
G2 Y9.6995 I5.6 J9.6995
G2 X11.2 Y0.0 I5.6 J-9.6995
G1 F30.0 X13.6
G2 F300.0 X-6.8 Y-11.7779 I-13.6 J0.0
G2 Y11.7779 I6.8 J11.7779
G2 X13.6 Y0.0 I6.8 J-11.7779
G1 F30.0 X16.0
G2 F300.0 X-8.0 Y-13.8564 I-16.0 J0.0
G2 Y13.8564 I8.0 J13.8564
G2 X16.0 Y0.0 I8.0 J-13.8564
G0 Z1.5
G0 X1.6
G1 F30.0 Z-3.0
G2 F300.0 X-0.8 Y-1.3856 I-1.6 J0.0
G2 Y1.3856 I0.8 J1.3856
G2 X1.6 Y0.0 I0.8 J-1.3856
G1 F30.0 X4.0
G2 F300.0 X-2.0 Y-3.4641 I-4.0 J0.0
G2 Y3.4641 I2.0 J3.4641
G2 X4.0 Y0.0 I2.0 J-3.4641
G1 F30.0 X6.4
G2 F300.0 X-3.2 Y-5.5426 I-6.4 J0.0
G2 Y5.5426 I3.2 J5.5426
G2 X6.4 Y0.0 I3.2 J-5.5426
G1 F30.0 X8.8
G2 F300.0 X-4.4 Y-7.621 I-8.8 J0.0
G2 Y7.621 I4.4 J7.621
G2 X8.8 Y0.0 I4.4 J-7.621
G1 F30.0 X11.2
G2 F300.0 X-5.6 Y-9.6995 I-11.2 J0.0
G2 Y9.6995 I5.6 J9.6995
G2 X11.2 Y0.0 I5.6 J-9.6995
G1 F30.0 X13.6
G2 F300.0 X-6.8 Y-11.7779 I-13.6 J0.0
G2 Y11.7779 I6.8 J11.7779
G2 X13.6 Y0.0 I6.8 J-11.7779
G1 F30.0 X16.0
G2 F300.0 X-8.0 Y-13.8564 I-16.0 J0.0
G2 Y13.8564 I8.0 J13.8564
G2 X16.0 Y0.0 I8.0 J-13.8564
G0 Z1.5
G0 X1.6
G1 F30.0 Z-4.0
G2 F300.0 X-0.8 Y-1.3856 I-1.6 J0.0
G2 Y1.3856 I0.8 J1.3856
G2 X1.6 Y0.0 I0.8 J-1.3856
G1 F30.0 X4.0
G2 F300.0 X-2.0 Y-3.4641 I-4.0 J0.0
G2 Y3.4641 I2.0 J3.4641
G2 X4.0 Y0.0 I2.0 J-3.4641
G1 F30.0 X6.4
G2 F300.0 X-3.2 Y-5.5426 I-6.4 J0.0
G2 Y5.5426 I3.2 J5.5426
G2 X6.4 Y0.0 I3.2 J-5.5426
G1 F30.0 X8.8
G2 F300.0 X-4.4 Y-7.621 I-8.8 J0.0
G2 Y7.621 I4.4 J7.621
G2 X8.8 Y0.0 I4.4 J-7.621
G1 F30.0 X11.2
G2 F300.0 X-5.6 Y-9.6995 I-11.2 J0.0
G2 Y9.6995 I5.6 J9.6995
G2 X11.2 Y0.0 I5.6 J-9.6995
G1 F30.0 X13.6
G2 F300.0 X-6.8 Y-11.7779 I-13.6 J0.0
G2 Y11.7779 I6.8 J11.7779
G2 X13.6 Y0.0 I6.8 J-11.7779
G1 F30.0 X16.0
G2 F300.0 X-8.0 Y-13.8564 I-16.0 J0.0
G2 Y13.8564 I8.0 J13.8564
G2 X16.0 Y0.0 I8.0 J-13.8564
G0 Z1.5
G0 X1.6
G1 F30.0 Z-5.0
G2 F300.0 X-0.8 Y-1.3856 I-1.6 J0.0
G2 Y1.3856 I0.8 J1.3856
G2 X1.6 Y0.0 I0.8 J-1.3856
G1 F30.0 X4.0
G2 F300.0 X-2.0 Y-3.4641 I-4.0 J0.0
G2 Y3.4641 I2.0 J3.4641
G2 X4.0 Y0.0 I2.0 J-3.4641
G1 F30.0 X6.4
G2 F300.0 X-3.2 Y-5.5426 I-6.4 J0.0
G2 Y5.5426 I3.2 J5.5426
G2 X6.4 Y0.0 I3.2 J-5.5426
G1 F30.0 X8.8
G2 F300.0 X-4.4 Y-7.621 I-8.8 J0.0
G2 Y7.621 I4.4 J7.621
G2 X8.8 Y0.0 I4.4 J-7.621
G1 F30.0 X11.2
G2 F300.0 X-5.6 Y-9.6995 I-11.2 J0.0
G2 Y9.6995 I5.6 J9.6995
G2 X11.2 Y0.0 I5.6 J-9.6995
G1 F30.0 X13.6
G2 F300.0 X-6.8 Y-11.7779 I-13.6 J0.0
G2 Y11.7779 I6.8 J11.7779
G2 X13.6 Y0.0 I6.8 J-11.7779
G1 F30.0 X16.0
G2 F300.0 X-8.0 Y-13.8564 I-16.0 J0.0
G2 Y13.8564 I8.0 J13.8564
G2 X16.0 Y0.0 I8.0 J-13.8564
( Drill1 )
S0
G0 Z1.5
G0 X-23.5 Y23.5
G81 Z-10.0 R1.5 F30.0
G81 X-40.0 Y0.0 Z-10.0
G81 X-23.5 Y-23.5 Z-10.0
G81 X0.0 Y0.0 Z-10.0
G81 X23.5 Y23.5 Z-10.0
G81 X40.0 Y0.0 Z-10.0
G81 X23.5 Y-23.5 Z-10.0
G80
M5
M30
/code]
-
I had a quick look at your code and it looks fine, I think you may be loosing steps in the Y axis.
Graham
-
I checked the y axis by running a loop that returned y to o over 50cycles and it was fine! I don't think I am loosing steps. If i cut a rectangular pocket on x ,y its fine no problem but if i slew the pocket by say 10 deg i have the same problem with a stepped pocket as i did with the circle pocket in the original g code.
Thanks for your help.
Tony
-
Graham,
I've built a cnc quilting machine, that uses Mach3 to control it. I need a way to reset the dro's to zero at the end of a pattern, and then restart at the same place, thereby extending/repeating the pattern, connected end to end. Any ideas?
Larry
-
Use a G52 X? Y? to shift the datum the pitch of the pattern at the end of the run put a G52 X0 Y0 in the program
Put the pattern code in a sub program and just call it with a M98 Pnnnn
Graham
-
Graham,
I'll give that a try and see what happens. I'll let you know what happens.
Larry
-
If you need some help with the format of the code just send me a PM.
Graham
-
Graham,
I tried the code that you recommended and unfortunately no joy. The code would work if it were a milling machine, however, since it isn't, the quilter only recycles to the front of the pattern and starts over at the datum. I have been fighting this issue for about 6 months now, and I know that there is a way to do it, I just can't find it.
Larry
-
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
-
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
-
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
-
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
-
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
-
Graham,
Yep, this one works even better! Now I need find a way to display the number of reps on screen.
Larry
-
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
-
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
-
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
-
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
-
Sorry Larry, my fault, the macro code should read :-
Setvar(3, getuserdro(1001))
You had the M code in the right place.
I must have been having a bad day.
Graham
-
Ok thanks Graham, just recall that King Henry had a worse day!
Larry ;D
-
Graham,
Well, I guess I'm the one having a bad day. There must be something that I am doing wrong. I put the M at the #3 place, and I have a DRO on the screen with the 1001 in the OEM Code function window.
Larry
-
Have you got the macro saved in the correct profile?
If you are using the standard mach3mill profile it needs to be stored in C:\Mach3\macros\Mach3Mill as M1001.m1s
Graham
-
Graham,
Dude you nailed it. I had to put it in the subfolder called cnc_quilter, then it started working perfectly, you are truly the man. Go have pint on me!
Larry
-
Send only huge bags of cash ;D ;D ;D
You are welcome
Graham
-
Graham, my friend, I need to draw on your limitless knowledge fount! Is there a way to constantly provide the updated position of an axis so that it can be acted upon by an if then operation?
Larry
-
No, as there is no way to flush the current move from the buffer and do a restart from the current position.
Graham
-
Graham,
I thank you my friend, now back to the grind!
Cheers,
Larry