![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Hi all, I'm hoping to soon enter the world of CNC ownership, and I'm expecting to end up with a system with servos, controlled by Geckos and Mach 2/3. I have a plan for making some cuts, for which I already know the path (rather than having a CAD model) - i.e. goto (x1, y1, z1) -> (x2, y2, z2) -> (xn, yn, zn). Looking at the basics of G-Code, it would appear fairly easy to write a file with a series of "G1 linear interpolation" lines. However, this of course assumes an infinitely thin cutting bit, whereas something around 1/4" is much more likely. Can you simply add the nc program word "D tool radius compensation" with the right data and expect Mach to correctly process this? Otherwise, does anyone know of any docs that give a good explaination of how to account for cutting radius when given a path, so I can create the correct G-Code moves. My paths aren't hugely complex, and I will always know which side of the 'line' I should be cutting on. Alternatively, is there any software that will do this already (i.e. some form of CAM program that will accept a path in x,y,z format)? Many thanks for any info, Sploo. |
|
#2
| ||||
| ||||
| With Mach3, you can use G41 and G42 for cutter compensation. The only tricky part is that you need to add a lead-in move and lead out move for the compensation to take place. Say you want to cut a 2" square, from 1,1 to 3,3. G0 X0 Y0 Z.125 ( Move into start position) G42 P0.125 (Offset tool to the right with a .25"D tool) G1 X0.75 Y1 Z-.125 (this is where the comp takes place, I like it end just outside my part) G1 X3 Y1 G1 X3 Y3 G1 X1 Y3 G1 X1 Y0.75 (finish the square just outside your part) G40 (turn off comp) G1 X0 Y0 Z.125 (lead-out move)
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#3
| |||
| |||
| Gerry, Many thanks for the post. I've found some useful info at http://linuxcnc.org/handbook/gcode/diacomp.html which describes the radius compensation in a little detail. Their example (of the triangle) sets the compensation, moves straight to the first coordinate, then moves through the rest of the triangle corners. In your example you're performing lead-in and lead-out moves. Is this just required for Mach3, or is it an oversight of the info on linuxcnc? Also, I don't quite follow the "G1 X0.75 Y1 Z-.125" line. The 0.75 is obviously 1-0.25, but why isn't the Y coordinate 0.75? Does the compensation mean that Mach3 realises the true start position should be X0.75, Y0.75? The sames goes for finishing at "G1 X1 Y0.75", rather than X1 Y1. EDIT: Reading that webpage a little more closely, I note there's a conceptual difference between a "Material Edge Contour" and a "Tool Path Contour", and that they do note the need for a lead-in move - though it's a little different to your square example. What would be the result (with your example) of setting compenation for a 0.25" tool, and starting/finishing at 1,1? |
|
#4
| ||||
| ||||
| Mach2's cutter comp was basically the same as EMC's (the site you linked). Imo, some of the info there is quite confusing. Mach'2s manual was basically a copy of that. A few months ago, Art added an enhanced comp mode for Mach3. It's much easier to write code for. It won't gouge inside corners, either, so you won't get errors like in Figure 8 in your link.
G1 X0.0000 Y0.0000 Z0.0000 G42P0.125 G1 X0.2500 Y1.0000 Z-0.1250 G1 X3.0000 Y1.0000 Z-0.1250 G1 X3.0000 Y3.0000 Z-0.1250 G1 X1.0000 Y3.0000 Z-0.1250 G1 X1.0000 Y0.5000 Z-0.1250 G40 G1 X0.7500 Y0.0000 Z0.0000 Notice that I use the leadin to ramp into the cut, and the leadout to ramp out. Much better than plunging.
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#5
| |||
| |||
| Most interesting, thanks Gerry. Thinking about it, there's obviously a lot more going on than just following a line at a fixed (radius) distance, as you need to perform all these turns at corners. What would happen if you programmed a cut with that bit for the inside of the square? Would it perform the compensation, and result in slightly rounded internal corners, or would the compensation just fail? Do you know where the Mach author(s) would had got the info on how to perform radius compensation? As I know the shape path I could probably generate the actual cutter path for a given bit, without the need for leadin/leadout cuts. I can just about work out how I'd program a simple radius compensation algorithm, but if there's a good explanation/example code around then it's always better to use something that's tried and tested. |
| Sponsored Links |
|
#6
| ||||
| ||||
| If you comp it inside, it would work fine, with radius inside corners due to the round tool. Mach's old comp method (and EMC's) would gouge the corners. I think he came up with the method on his own, but if you search do some searching I'd think you could find some info. I don't know why you want to reinvent the wheel when it's so easy to add a lead-in and lead-out move. Just extend your normal start and end points roughly the tool radius beyond the part, and add new start and end points for the lead-in and lead-out. They can be virtually anywhere.
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#7
| |||
| |||
| I've downloaded a very impressive simulator from http://www.cncsimulator.com/ and had a play with the code you listed (and modified it to mill a 2" square hole). I think I'm starting to get an idea of how this works, though still seeing things I don't quite understand with leadin lines. The reason why it'd be a good idea if I could produce the exact paths myself is that I want to cut many concentric circles out of a single sheet. This means I woudn't have much room for leadin/out lines between the outside of one circle and the inside of the next. I'll have a search for info on how it's done, but if anyone has details of how cncsimulator, or Mach, processes radius compensation I'd be most greatful. |
|
#8
| |||
| |||
| OK, well, I've found some code over at http://www.linuxcnc.org/handbook/fileref/emc/files.html and taken a look at the comp algorithms in rs274ngc.cc. Using these routines, I can simulate compensation (just putting coords into a simple app, and seeing what it outputs). However, as Gerry notes "Mach's old comp method (and EMC's) would gouge the corners.". This code too will gouge internal corners, and infact will complain when given pretty much any concave corner. It occurs to me that a not insignificant amount of 'looking ahead' would be required to ensure a path is followed that wouldn't gouge a concave corner on a shape - imagine walking a straight line which suddenly turned a sharp internal corner (which actually consisted of several G1 instructions). So... how do the decent compensation methods work? Any advice greatly appreciated, as I'm a little stumped right now... |
|
#9
| ||||
| ||||
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#10
| |||
| |||
| *LOL* Fair point. The problem is that I don't think I'm going to have the room for the lead in/out cuts as I need to pack the circles quite tightly, or I'm going to spend forever swapping sheets in and out of the machine (and wasting far more material than I'd want). If I can generate compensated paths then I can ensure it's only ever going to cut where it's supposed to - with no 'overspill' from lead cuts. However, the more I think about what's required, the more it looks like I'll be forced to use the automatic compensation, but I'd love to nail this myself. |
| Sponsored Links |
|
#11
| ||||
| ||||
| Lead in and out with an arc that's tangent to the circle, and starts just a little over 1/2 the tool diameter away. You'll have to check to see exactly how much clearance you need, but I think you can make it work without cutting much more than the tool diameter. If you need a picture to clarify this, let me know and I'll post one later.
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#12
| |||
| |||
| Yea, the problem is that the circle may not actually be a circle (I plan to deform the radii around the circle, so you could make things like star shapes, or rippled edges). However, I think I understand vaguely what's going on now, so I can have a play with the cnc simulator to ensure I'd always leave enough room. The other thing which occurred to me is that, surely you could start with your z axis above the workpiece, turn radius comp on, perform an (x/y) lead in move, then plunge in (knowing your x/y is correct), do your cut, then lift out of the workpiece before turning compensation off and moving away? By doing that, I could stack the concentric rings close to one another (within the bit diameter) and know that the inside of one ring wouldn't be fouled when performing the lead moves for cutting the outside of the next smaller ring. I have spoken to Art (author of Mach) who tells me he came up with his own algorithms, and that it's not nice. I've had a think about what's involved, and reckon I could code something that does a sensible look ahead (to produce moves safe for concave corners) but I suppose it's best not to reinvent the wheel, if I can get away with it. Cheers, Sploo. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |