
03-30-2009, 02:24 PM
|
| | | Join Date: Mar 2007 Location: England
Posts: 2
| |
G-code questions about best practice | | Hello Gentlemen,
This is my first post so I hope some experienced G-code programmer out there can help me. with a couple of questions. (the prefix should also say Newbie but can't have both). First some background. I am a retired computer programmer who for a hobby is writing some software to simulate a thing called a rose engine, to enable me to generate patterns and cut them on a simple cnc machine I am building, as I am interested in ornamental turning. (All items have rotational symmetry).
The assumed model for my machine is that the work is placed on a table rotating around the Z axis (C here). The cutter is on the Z axis and positive z values are depths into the work. The X axis runs through the center of the work and its origin is the center of the work. So X increases positively from zero radially towards the edge of the work. The Y axis is not used but is perpendicular to X and Z so cuts are made in the XY plane also predominantly I use Cylindrical coordinates (radius,Angle,depth) to represent points on the cutter path.
Ive done the simulation bit and now am looking at generating the g-code. My software generates a list of paths where each path is a list of points.
I will generate g-code either for my model above or for a standard mill. I can choose to generate simple g-code i.e no variables , no Owords, or , generate g-code using all facilities available to EMC2 (loops subroutines Owords etc) which is what I am using to control my equipment. Each path may have a different depth profile and has a width which may be greater than the diameter of the cutter used.
So first question, Is it better practice to generate g-code to cut each path to its correct final depth before moving on to the next path,or should I machine each path in turn cutting at the same depth then increment the depth and repeat? Is it better to handle the loop locally within the code to cut a path or more globally across all paths? Does it matter from a machining point of view? Paths could (and often do) cross each other.
My second question is how best to cut a width greater than the cutter diameter bearing in mind that in my standard model a point is specified by a radius (translates into an X value) and angle (a C value) and a depth (a Z value).
One choice is to add some variable value to the radius to offset the cutter and again place this in a loop. So similar sort of question to above is this loop better dealt with locally within a single path or globally across all paths (I am assuming here that all paths will have the same width).
I thought that another way of doing this is to possibly use cutter radius compensation in a loop so that my actual cutter was offset with a value which would be half the difference between the path width and the cutter diameter. But that would mean placing a mythical tool in the tool table. Is this possible in EMC2 (or the real world)? Comments on this approach would be appreciated.
Finally whilst typing this I was reconsidering my choice to generate very simple g-code. Should I bother or can I assume that today all CNC systems use variables and Owords etc? I am asking because when I get this application in a beta state I do intend to make it available to others as freeware as well as using it myself.
Sorry this is such a long email I do hope it makes sense in most parts.
Alan |