Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: wilfoude on October 26, 2010, 02:46:45 PM
-
I am a newbie to Mach3 and try the master it. I needed to make a number of 80 mm diameter holes in an instrument panel. So I made a subroutine with tool compensation to produce the holes. This worked fine for only the first hole, but the next holes are totally screwed up. It is as if in each consecutive call to the sub, the sub is partly switching back to the first hole. It works OK without the tool compensation. It also works when the code producing the hole is repeated for each and every hole. But that is bad practise, increasing code size. Who can help me to make that sub working ?
Newbie Wilfried
-
THe g41 / 42 is broken in sub use.
(;-0 TP
-
That sounds a bit cryptic What exactly do you mean by that ?
-
exactly what it says.The G41 and G2 are BROKEN as in DO NOT WORK CORRECTLY when used in a SUBROUTINE.
(;-) TP
-
OK, I now understand that toolcompensation does not work in a sub. But is this something that will be corrected, or do we simply have to accept that it simply is not working? I think subs are the best way to deal with repeated structures in a design.
My first product was an aircraft instrument panel with a lot of the same instrument holes. It was very annoying I could not use subs to cut those holes.
Wilfried.
-
HI WIlfried, That will be up to Brian at Artsoft.
(;-) TP
-
This is nice to know, but how do we know whether Art soft is going to fix this problem?
I have noticed that Mach3 is widely used and appreciated, even in professional applications, so I'm very surprised that Mach3 can't cope with this toolcompensation in sub's. I also can hardly imagine I'm the only one who stumbles over this item.
-
You are not the only one(;-). You might want to email Brian at Artsoft and ask him directly.
I don't have the answer , I just know through testing that it is broken as in does not work correctly
(;-) TP
-
Hey,
I am trying to use g41/42 in a subroutine as well, did this get resolved and if so does anyone have sample code?
-
No. No changes will likely be made to comp until the version 4 release of Mach3.
-
Any idea when R4 is coming out?
-
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
-
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.
-
Don't have time to look, but changing from absolute to incremental and back during a comp move can't be a good thing.
-
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
-
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.
-
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
%
-
There are gremlins in the current TC code when used in SUB routines.
Just a thought, (;-) TP
-
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
-
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
-
Graham,
Thank you very much for your contribution. I did a let of small alterrations on the code and think that, with your support, I now solved the problem.
It could be formulated in a rule like: A curved feed-in should always be preceded by a small straight line more or less perpendicular to the line to feed-in on? G41/G42 must be active before the start of that "pre-feed-in".
If I stick to this rule all variations of the part program work correctly. Having the correct offset and no overshoot.
It's not so bad that the program requires this, if only it were specified somewhere.
Many thanks,
Wilfried