In this article I would like to talk about the necessary software in the work, but at the same time give a little introduction on the g-code. Again, I ask you to forgive a non-professional, I may miss something, and in some ways be inaccurate. On the other hand, everything described in my articles is an exceptionally personal experience, and it definitely works in close proximity to office-garage-home conditions on simple Chinese CNC milling machines.
Software for work can be divided by the level of abstraction from the bottom up: firmware drivers for engines, "rack PU" or software-hardware complex based on a PC or MC, CAM is software that builds the tool path and converts it into a G-code, and CAD .
Low-level software - flashing of motor drivers, which converts step and direction signals (step / dir) for stepper motors or speed / direction for servomotors to voltage and current values applied to motor windings; we do not choose and modify it, at least in the case under discussion.
The next level - “rack” - a software and hardware complex that converts lines of code into signals for drivers. Here it is more interesting, at least at the stage of choosing a machine (or choosing components for samostroya), we can focus on both industrial entry-level racks (GSK, Washing, first-time Siemens and fanuki), and on a combination of interface cards (from the banal LPT and Opto-uncoupled Chinese Red Card to MESA) with software - LinuxCNC, Mach3, NCStudio and others. I personally have a great positive experience with LinuxCNC and NCStudio; in spite of the simplicity of both, with the processing of ready-made simple ISO G-code ISO-7bit notation, they do it with a bang. Industrial racks have an advantage in the flexibility of setting up drives and the possibility of connecting a large number of peripherals, as well as the ability to work on advanced G-codes (cycles) and macro programs, but with the current availability of KAM systems and piece production, this is not necessary.
')
Level above are the CAM (computer aided manufacture) program - software for creating paths that describe the passage of the tool in the workpiece. And here we begin a complete confusion and vacillation. On the one hand, free or shareware CAM is not enough. Not to say no decent at all. Yes, there is a plug-in for Inkscape, there are some unstable wonders five years ago, there is a trial fusion, there are plug-ins for CADs ... By the way, about the very simple ones, we screwed G-CodeTools for Inkscape for a very simple router, but we could not reach acceptable speeds ligament operator-plugin. As a result, we bought CamBam + for $ 150 funny by the standards of the market and enjoy. And so - all of the cheap or free or under very simple processing, or a glitch on the glitch and a glitch chases. We tried a lot of everything in demos and broken versions, as a result we held talks with the toad and the financial director, and bought PowerMill - according to the reviews and emotions we experienced in the process of busting, perhaps, optimal for a small production tool. Later, great comrades from SprutCAM came to us, gave us a demo, and we were horrified to find that we had overpaid about 20 times - almost all our needs are closed by quite democratic SprutCAM Mach3. We bought them, of course (like stocked up for a gift price), but then we found a couple of flaws, so we use only PM.
I almost forgot: the intermediate stage between g-code and CAM is the postprocessor - once a separate program, and now the built-in module of any decent CAM. This is the very thing that converts the CAM trajectory into a specific machine code. About the postprocessor it is worth knowing only what it is, and that it has a description that is tied to a specific notation of code perceived by the machine. Conventionally, some machines ask for line numbering, some - ";" at the end of each line, some generally accept Russian letters in the letters, and so on. For the machines in question (home milling machines), regardless of whether MACH3, LinuxCNC or NCStudio, the standard postprocessor fanuc0i 3axis will go.
Well, the highest level - CAD, it is already quite far from the machine. Here the choice is almost endless, and even more free than in 3D printers, the benefit of milling goes to the surface, and at the CAM input there may not be a solid model, but a boundary surface. Normal CAMs are almost omnivorous and with the same pleasure they pull in models from anything - from 3DMAX to SolidWorks.
G-code
I started writing about g-code several times, but threw it every time. On the one hand, the full g-code is ambiguous, at least in part of the cycles: even different series of machines from the same manufacturer can interpret g-codes in a different way, but in the basic codes everything is clear. On the other hand, the modern CAM system allows the operator not to know the g-code as a class at all, doing it by tugging at the computer windows. But when one of our operators (by the way, VO, experience and all that) did not cope with the task of “making a test program that will drive the spindle up and down by 30 mm 1000 times,” I realized that at least a common understanding should be. Even if you do not write simple programs, then at least to disassemble and otdebazhit what the postprocessor wrote to us there.
First, it is worth knowing that g-code comes in frames, each line is a frame. Code
G1 x10 y20
will jump to the line connecting the current location and point x10y20, and the code
G1 x10 y20
will give a transition along the broken line - first to the point (current position, x10), and then to the point x10y20.
By the way, in the second example we can see the modality property: we can not write G1 at the beginning of the second line, because G1 is modal and the rack will understand the frame without code as the duplicate code of the previous one. If we tried to go along the arc (G2 / G3) and also the second part would be transferred to the next line - the front would interpret this line as a new frame G1.
So, the first group of codes that you should know - installation. This includes the installation codes of the coordinate system, the system of units, the installation of the length and radius correction tools. For a hobby room CNC, it is enough to know from all this a security string that is put at the beginning of each program:
G17 G21 G40 G54 G80 G90
And decoding: G17 (working in the XY plane) G21 (units - millimeters) G40 (aborting tool length compensation) G49 (abolishing tool radius compensation) G54 (working in the first coordinate system) G80 (canceling previously running constant cycles) G90 (working in absolute coordinate system). After such a horse dose of commands, any machine is cleared of all possible sins left from previous treatments, and is ready to work on your project. Even if your machine does not know anything about the correction, do not hesitate - in the background of the program body these few bytes will not add much size to the program, the machine simply ignores alien codes, but everything will be fine.
In general, perhaps, there is more and know something to work on the discussed machines.
Is that G54 - designation of work in the first coordinate system. The fact is that almost any rack supports the default machine coordinate system (with zero on the end sensors, usually in the corner of the desktop), and up to 6 additional coordinate systems specified by the user. What for? When you work in CAM, you set an arbitrary zero point - in the upper left near corner (as it is correct) or in the center of the workpiece, and the entire trajectory is described from this point. If the machine knew how to work only in the machine SC, one would have to either put the workpiece in an angle of machine zero, or in CAM set a zero at an obscure point, dimmed relative to the actual location of the part. Why as many as 6 coordinate systems? Well, everything is also simple, although it is less often used: if the table allows you to set several blanks, it makes sense to combine the treatments: first, go through all the blanks with one mill, then change the mill and then go through all, well, etc. Different ICs come to the rescue here: instead of splicing models in CAM, you can designate different ICs for blanks and, at the beginning of each processing, prescribe which ICs we work in.
Theoretically, when manually writing a program, the G90 / G91 command can also help: the choice of an absolute or relative coordinate system. Everything here is also more or less simple: the machine goes to G90 by the coordinates specified in the row, and in G91 by the coordinates added to the current coordinates. So the machine, standing at point X10Y10, goes to line G90 G1 x20 at point X20, and at line G91 G1 X20 goes to point X30.
The next group is relocation codes. Everything is simple, at least on the discussed machines:
G0 - idle movements, performed at the maximum speed set in the rack. It should be borne in mind that G0 does not always give a linear movement, in some racks with the G0 X200 Y300 command, when working at point X0Y0, the working tool first goes under 45 degrees to the point X200Y200, and then in a straight line - at Y300. It makes sense to check how it happens on your machine, without knowing this subtlety, you can accidentally crash into fasteners or workpieces.
G1 - linear interpolation. It's even simpler, the machine always moves in a straight line between the current point and the point indicated in the code. The command assumes the syntax G1 X20Y30Z10 F1000, where F is the movement speed in machine units (usually millimeters per minute, but sometimes mm / s or something else exotic). Speed is modal, i.e. if you specify the speed once, it will be valid for all subsequent G1 / G2 / G3 lines, even if they are separated, for example, by G0 or other codes.
G2 / G3 - circular interpolation clockwise or counterclockwise. There are two possible definitions: when the machine is at point X0Y0, G2 format X10Y10R20 will build an arc between the current point and X10Y10 point with a radius of 20, G2 format X35Y25 I20J-5 will build an arc between the current point and X35 Y25 centered at point X (current point) + 20 Y (current point) -5.
Theoretically, in advanced racks, there is a mass of other interpolations - from sine to hyperbole, but this is irrelevant in our machines and in the presence of CAM.
Well, a few more codes that are included in the ISO 7bit system, but are not g-codes. This is M03 (enable spindle) with argument S (rotational speed), M05 means spindle stop, M07 / 09 means coolant supply and shutdown, and M30 is the end of the program.
Fuh. Somehow messy and tightened it turned out, but it really can be useful. I say goodbye to this, in the next series I will write a little on the materials for a home CNC router, and I will describe the process of building a treatment in PowerMill.