Hello Guest it is April 19, 2024, 08:10:06 PM

Author Topic: Mach3 and code G41/G42 in subroutines  (Read 15523 times)

0 Members and 1 Guest are viewing this topic.

Offline tomi

*
  •  11 11
    • View Profile
Re: Mach3 and code G41/G42 in subroutines
« Reply #10 on: November 29, 2011, 11:03:47 AM »
Any idea when R4 is coming out?
Re: Mach3 and code G41/G42 in subroutines
« Reply #11 on: February 03, 2012, 09:13:00 AM »
It's some time ago, but I have a new question regarding tool compensation.
I noticed some strange behaviour of Mach3 in a very simple product, so I made a test program. It's just a square of 300*300 mm with rounded corners. When I use a curved entry move (line 3735) to the bottomline of the square, the controlled point makes an overshoot of about 0.1 mm. When I replace the curved entry move by a straight one (line 3735), it works OK. In this test example, with a tool of 4 mm, the controlled point should move at -2.0 to draw the bottom line. This line however is drawn at -1.950, with an overshoot to -1.920. Does anyone have any idea what causes this error ?
Other part programs I made using tool compensation don't show errors (as far as not used in subroutines).
Best regards,

Wilfried

Offline tomi

*
  •  11 11
    • View Profile
Re: Mach3 and code G41/G42 in subroutines
« Reply #12 on: February 03, 2012, 09:25:45 AM »
I did't read your code but, is the curved entry move long enough? Try make longer entry move if it is posible. I add cam software to use 2xradius entry move and it work.

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Mach3 and code G41/G42 in subroutines
« Reply #13 on: February 03, 2012, 11:57:22 AM »
Don't have time to look, but changing from absolute to incremental and back during a comp move can't be a good thing.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Mach3 and code G41/G42 in subroutines
« Reply #14 on: February 03, 2012, 12:43:20 PM »
Hello Tomi,

Yes the curved entry is a 1/4 circle with a radius of 15 mm. The toolbit is only 4 mm diameter (radius 2 mm).
Wilfried
Re: Mach3 and code G41/G42 in subroutines
« Reply #15 on: February 03, 2012, 01:13:11 PM »
I took the G91, G90 ouside the toolcomp part of the program. But still the same results.
Despite I programmed tool T4 to be 4 mm diameter, I once saw the ofset to be 2.9925 mm. I think the program means 3 mm. But it should be 2 mm. Looks like something is not stable here.
Wilfried.

Online Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Mach3 and code G41/G42 in subroutines
« Reply #16 on: February 04, 2012, 06:59:33 AM »
This is the code I would use :-

%
O0001 (300*300 SQUARE)

G21 G40 G80

N1 (FLAT 4MM)
T4 M6
G00 G90 G43 X2.442 Y-9.085
Z1.
G01 Z-1. F200.
G41 X4.5 Y-4.557
G03 X0. Y0. R4.5
G01 X-140.
G02 X-150. Y10. R10.
G01 Y290.
G02 X-140. Y300. R10.
G01 X140.
G02 X150. Y290. R10.
G01 Y10.
G02 X140. Y0. R10.
G01 X0.
G03 X-4.5 Y-4.466 R4.5
G01 G40 X-2.531 Y-8.593
G00 Z25.
M30
%


Without engineers the world stops

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mach3 and code G41/G42 in subroutines
« Reply #17 on: February 04, 2012, 11:11:44 AM »
There are gremlins in the current TC code when used in SUB routines.

Just a thought, (;-) TP
Re: Mach3 and code G41/G42 in subroutines
« Reply #18 on: February 05, 2012, 04:12:38 AM »
Hello Graham,

Obviously you have taken out the relative coding (G91), which is something I absolutely need. (I make big instrument panels on which I have to distribute holes relative to some origin). However, I tried your code, and this did not show that overshoot. The offset stayed at 2mm precisely. So I toke the relative coding (G91 etc.) out of my own part program and see, the overshoot was still present. Now my problem is not so much "how to get a square", but what is wrong in my coding that produces the effect. I like to learn what faults I made in order to avoid them in future parts. Meanwhile I have produced a number of panels, all with relative coding and tool compensation. None had this problem. (Just the problem with tool comp in subroutines). How did you came to those strange numbers in this line: G00 G90 G43 X2.442 Y-9.085
What is their origin ?
Wilfried

Online Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Mach3 and code G41/G42 in subroutines
« Reply #19 on: February 05, 2012, 04:32:09 AM »
A G41/42 must be applied on the feed into the part on a straight line, the line must be long enough to allow for the radius of the cutter to be applied before the tool touches the part, Mach3 prefers the feed in and out lines to be perpendicular to the x or y axis. E.G. no vectored moves.

If you wish to do pattern repeats I would suggest you forget about G91 and look at G52 local shift which is well discussed on the forum.

The two strange looking figures are because I picked a random point in space to place the start of the lead in,  the code would work just as well like this :-

%
O0001 (300*300 SQUARE)

G21 G40 G80

N1 (FLAT 4MM)
T4 M6
G00 G90 G43 X3. Y-10.
Z1.
G01 Z-1. F200.
G41 Y0 (apply comp on a feed line)
X-140.
G02 X-150. Y10. R10.
G01 Y290.
G02 X-140. Y300. R10.
G01 X140.
G02 X150. Y290. R10.
G01 Y10.
G02 X140. Y0. R10.
G01 X-3.
G40 Y-10.
G00 Z25.
M30
%

If you need to do subs then keep the comp code in the main program and just the profile in the sub, with a combination of G52 and this you should be able to do all you need.

Graham
« Last Edit: February 05, 2012, 04:37:38 AM by Graham Waterworth »
Without engineers the world stops