G41, G42 help please
- AlbertHall
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
18 Oct 2018 12:35 #118991
by AlbertHall
G41, G42 help please was created by AlbertHall
I am trying to get my head round tool diameter compensation. I think the problem is that I don't understand the lead in bit.
The attached file is my attempt at a square with no compensation, G41, and G42.
(It's not supposed to do something useful, just demonstrate tool compensation.)
The uncompensated square is fine.
The ends of the path outside the square don't connect up.
The path inside the square makes cuts outside the square too.
Please tell me how to fix this.
The attached file is my attempt at a square with no compensation, G41, and G42.
(It's not supposed to do something useful, just demonstrate tool compensation.)
The uncompensated square is fine.
The ends of the path outside the square don't connect up.
The path inside the square makes cuts outside the square too.
Please tell me how to fix this.
Please Log in or Create an account to join the conversation.
18 Oct 2018 17:33 #119005
by lars
Replied by lars on topic G41, G42 help please
Hello.
First of: I have never used cutter compensation myself before. But this is how I understand it:
You think you told LinuxCNC that it is supposed to mill a square. But LinuxCNC does not know about the square, it just cares about the last, the current and the next move.
When you finish your outside square with `G1 X10 Y10` it tells LinuxCNC to move so it does not cut into X10 and Y10. And that's what it does and stops before cutting into Y < 10. You need at least one move before and after the outline you want to cut.
Example for the your outside square with moves to ensure correct lead-ins and lead-outs:
The inside square problem is the same, but more difficult to solve. LinuxCNC does not cut into the last, current or next coordinates. But it does not know that you want this to be a square and magically keeps out of the areas you don't want it to cut. You need to enter the inside of the square and then from there the cutter compensation can do it's work. But it cannot know that there is a boundary somewhere further down in the code that it should not cross.
I hope this helps,
Lars
First of: I have never used cutter compensation myself before. But this is how I understand it:
You think you told LinuxCNC that it is supposed to mill a square. But LinuxCNC does not know about the square, it just cares about the last, the current and the next move.
When you finish your outside square with `G1 X10 Y10` it tells LinuxCNC to move so it does not cut into X10 and Y10. And that's what it does and stops before cutting into Y < 10. You need at least one move before and after the outline you want to cut.
Example for the your outside square with moves to ensure correct lead-ins and lead-outs:
G43 H1
G42 D1
G1 Y10 (Go up so we already cut the corner at the left when starting)
G1 Z1
G1 X10 Y10
G1 X20 Y10
G1 X20 Y20
G1 X10 Y20
G1 X10 Y10
G1 Y0 (Finish by going further down to cross Y10. You could also modify the above line to go directly to Y0)
G0 Z15
G0 X0 Y0
G40
The inside square problem is the same, but more difficult to solve. LinuxCNC does not cut into the last, current or next coordinates. But it does not know that you want this to be a square and magically keeps out of the areas you don't want it to cut. You need to enter the inside of the square and then from there the cutter compensation can do it's work. But it cannot know that there is a boundary somewhere further down in the code that it should not cross.
I hope this helps,
Lars
Please Log in or Create an account to join the conversation.
18 Oct 2018 21:32 #119021
by curtisa
Replied by curtisa on topic G41, G42 help please
This appears to be correct behaviour (at least as far as the documentation is concerned):
linuxcnc.org/docs/2.6/html/gcode/tool_co...:cutter-compensation
Cutter compensation only compensates the offset of the tool radius left or right of the intended path. It doesn't include path length compensation on open-ended movements, so you can end up with the situation you describe where the first/last corner of the square doesn't meet up. The missing movements to start and complete the square will be the radius of the tool.
That's also why the documentation stipulates that a lead-in and lead-out move at the start and end of each path must be at least 1x the radius of the tool in length. In the docs above, under section 3.1, it even demonstrates what happens if your lead-in/lead-out moves aren't long enough to include the radius of the tool.
IME I usually consider usage of cutter compensation and lead-in/out moves as something that needs to be managed by the post processor of whatever CAM software I'm using to get it right for me, particularly for complex shapes. For simple shapes I rarely bother with it and just program the toolpath directly including the required tool offset in the intended path. In the case of your square shape, assuming I'm using a 4mm dia endmill, I'd just make the dimensions of the square 2mm larger in all directions:
linuxcnc.org/docs/2.6/html/gcode/tool_co...:cutter-compensation
Cutter compensation only compensates the offset of the tool radius left or right of the intended path. It doesn't include path length compensation on open-ended movements, so you can end up with the situation you describe where the first/last corner of the square doesn't meet up. The missing movements to start and complete the square will be the radius of the tool.
That's also why the documentation stipulates that a lead-in and lead-out move at the start and end of each path must be at least 1x the radius of the tool in length. In the docs above, under section 3.1, it even demonstrates what happens if your lead-in/lead-out moves aren't long enough to include the radius of the tool.
IME I usually consider usage of cutter compensation and lead-in/out moves as something that needs to be managed by the post processor of whatever CAM software I'm using to get it right for me, particularly for complex shapes. For simple shapes I rarely bother with it and just program the toolpath directly including the required tool offset in the intended path. In the case of your square shape, assuming I'm using a 4mm dia endmill, I'd just make the dimensions of the square 2mm larger in all directions:
...
G0 X8 Y8
G1 Z2
G1 X22 Y8
G1 X22 Y22
G1 X8 Y22
G1 X8 Y8
G0 Z15
G0 X0 Y0
Please Log in or Create an account to join the conversation.
- AlbertHall
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
19 Oct 2018 13:11 #119075
by AlbertHall
Replied by AlbertHall on topic G41, G42 help please
Thank you guys, but stupid here still doesn't understand.
I have written a pre-processor for the gcode so I have decided to add this function to that program using the code from 'NotLKH' here:
www.vbforums.com/showthread.php?198436-Buffer-a-Polygon
I have got this code working with my program without difficuty so my problem is solved.
I have written a pre-processor for the gcode so I have decided to add this function to that program using the code from 'NotLKH' here:
www.vbforums.com/showthread.php?198436-Buffer-a-Polygon
I have got this code working with my program without difficuty so my problem is solved.
Please Log in or Create an account to join the conversation.
Time to create page: 0.145 seconds