Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Gerral on October 20, 2020, 10:17:57 AM
-
I have the following G-Code that I want to run repeatedly to cut out inlay groves for wood drums. I want to change the tool diameter with G41 & G42 to slowly widen the grove to fit the inlays. Inlays aren't necessarily consistent in width.
The code work, except it doesn't seem to be picking up the diameter for tool 1 and 2 (D1 & D2), but it works perfectly on tool 3 (D3).
I'm not seeing anything wrong with the code and am wondering if there's a setting in Mach4 that not set right for this to work on D1 & D2.
Thank you in advance for your help.
g0 g49 g40 g17 g80 g50 g90
g04 p2.
g53 g00 z0
M03
M08
G54 x0 y0.01 a0
z1.
g01 z-.25 f10.
G42 D2
y-.016 f10.
g90
g40
a720. f2000.
g90x0y0
G41 D2
y.016 f10.
g90
g40
a0. f2000.
z1.
G54 x0 y.295 a0
z1.
g01 z-.25f10.
G41 D1
x0 y.279
g90
G40
a720. f2000.
g90x0y0.295
G42 D1
x0 y.311 f10.
g90
G40
a0. f2000.
z1.
G54 x0 y-.295 a0
z1.
g01 z-.25 f10.
G41 D3
x0 y-.311
g90
g40
a720. f2000.
g90x0y-.295
G42 D3
x0 y-.279 f10.
g90
g40
a0. f2000.
g00 z1.
g53 z0.
M09
M05
g53 x1. y-8.
m30
-
What values do you have in offset diameter 1 and 2
-
I'm changing it depending on how much wider I need to go, I use the same value in all three. I go up 0.02 inches at a time till I have it dialed in for the inlay.
-
OK, you need to make sure your lead in has enough travel to apply the offset or it will try to do it in the main move.
-
I'm embarrassed to admit that I'm not sure what you're referring to.
-
If you want to use G41/42 compensation you have to plan for it in the g-code, to use comp correctly you have to feed on to the cutter path with a line and a blending tangential arc where the total movement is greater than the amount in the tool diameter offset, you say you are adjusting the size by 0.020" and your move is only 0.016" see red highlight. Also your code is cancelling the comp with the G40 and no lead out move so you can get gouging if the direction of travel changes.
You need to lookup how to do G41/G42 compensation, there are lots of examples on here.
G54 x0 y0.01 a0
z1.
g01 z-.25 f10.
G42 D2
y-.016 f10.
g90
g40
a720. f2000.
g90x0y0
G41 D2
y.016 f10.
g90
g40
a0. f2000.
-
Oops, I see Graham posted while I typing.
I THINK what Graham is saying is you need to be far enough away from the axis that's in the move where the tool diameter is applied for it to move to the point taking into consideration half the tool diameter.
That said, what you're saying is the EXACT same code works with D3, but NOT with D2 nor D1? If that's indeed true, it almost HAS to be the diameter in the tool table. If the code is different, than all bets are off.
Is that code hand written or generated by some CAM software? Is that A axis rotary or linear? Somehow that code doesn't look right, but not knowing how your A axis works, it's pretty hard to read and tell what's happening!!
It seems the move when the G41/G42 is being applied is very small, .016/.017, at least in the first couple. That means the tool has to be pretty tiny in order to apply the tool radius in that move!!
I'm probably all wet on this because I really can't make heads or tails of your code!!
Tom
-
His D3 moves are greater than the tool offset so it can move.
-
I didn't write the code, the person who made the custom CNC machine did, and I have no information available of how he did it.
I'm helping the guys in the shop, I know the basics of GCode as I'm a programmer and most of it makes sense to me but there are obvious nuances that escape me since I don't actually do this sort of work.
Yes D3 works but D1 and D2 doesn't
Explanation of what this does:
I'm not sure the best way to describe this, but this is a wood musical drum shell and it turns on the A axis. Z is moving the cutting bit forward and back. Y is the axis across the up and down side of the drum where as X is the horizontal and generally stays at 0.0 as that keeps it centered on the turning A axis.
In this code there are 3 groves being cut. It cuts the center one first. When he's hitting Y0.016 that's the center grove then it's followed by two more groves on either side of the center one.
When they're cutting the groves into the shell with this, they change the diameter of the tools in 1,2, and 3 to slowly widen the grooves until it fits the wood inlay strip they're putting in.
Thanks for your input... it's been very helpful.
-
A picture of the set up may be helpful, its possible to do this a different way that avoids the G41/42 issues and still allows you to use tool offsets to widen the grooves.
-
I can't show an actual photo, due to company confidentiality policy, but I'm attaching a drawing that might clear it up some.
Thank you regarding avoiding G41/G42. That was what I was thinking. I can write GCode that could increment a # variable or a lua dialogbox that allow the user to input new values. A this is a single use machine it shouldn't be a problem.
-
Okay, if you can write code then all you need to do is add a #var to your code.
# Numbers for the tool diameter offsets start at 13000 + the offset number so D2 offset would be #13002
Then you remove the G41/42's and you add something like this G01 Y[#13002] F1. or G01 Y-[#13002] F1. in your code.
Your code will look something like this :-
g0 g49 g40 g17 g80 g50 g90
g04 p2.
g53 g00 z0
M03
M08
G54 g00 g90 x0 y0.01 a0
z1.
g01 z-.25 f10.
y-[#13001] (offset Dia1)
a720. f2000.
x0y0
y[#13002] f10. (offset Dia2)
a0. f2000.
Etc......
-
That's great, I didn't realize the Diameters were a #var too!
Thank you!