Fagor G-Code Programming
Fagor G-code programming is writing a part program for a Fagor CNC control using ISO-style G-codes and M-codes together with the control's own high-level commands. The control reads each block in order, keeps track of active modes, and moves the axes or runs cycles as the blocks instruct. The program is only as good as your setup data, so tool numbers, offsets and zero points must match the machine before the first cut.
- A Fagor program is a numbered list of blocks; each block holds words such as G-codes, coordinates, feed and spindle speed.
- Modal commands stay active until changed, so a feed rate or work plane set once carries on through later blocks.
- Fagor controls also accept high-level language commands for cycles, parameters and math, which shorten long hand-written programs.
- Program headers and tool changes belong at defined points, and a dry run without the part proves the path first.
- Simulation on the control or in offline software catches syntax and geometry errors before the tool touches material.
What a Fagor program contains
A Fagor G-code program is a text file made of blocks, and each block is one line of instruction for the control. A block can hold a line number, G-codes for motion or modes, axis coordinates, feed rate, spindle speed and a tool call. The control executes the blocks in sequence unless a jump or a loop sends it elsewhere.
The block structure follows the ISO convention that machinists already know, with letter addresses followed by numbers. G words select functions such as rapid positioning, linear interpolation or a canned cycle. M words handle machine functions such as spindle direction and coolant.
Fagor controls add their own high-level language on top of plain ISO code, so a program can use variables, arithmetic and conditional jumps. That mix lets you write compact programs for families of parts instead of repeating the same blocks. Keep the plain ISO part clear, since that is where most reading errors start.
Modal commands and active state
Modal commands in a Fagor program stay in force after their block runs, and the control remembers them until a later block changes them. A feed rate, a work plane or a units setting therefore applies to every following block that does not override it. This behavior keeps programs short but makes the order of blocks matter.
Non-modal commands act only in the block where they appear, and the control forgets them immediately afterward. Mixing the two kinds without care produces motion you did not intend, especially after a tool change or a cycle. Read the program as a sequence of states rather than as separate lines.
At the start of a program, set every mode you rely on instead of assuming the control is in a known state. A short safe block that names units, plane, feed mode and absolute or incremental coordinates removes doubt. Operators who restart mid-program then know which modes are active.
Coordinate systems and zero points
Fagor programming uses several coordinate references, and the program must name which one a position refers to. Machine reference is fixed to the machine, while part zero is set by the operator at the workpiece. Workpiece offsets let one program run on different setups without editing coordinates.
Absolute coordinates give a position measured from the active zero, and incremental coordinates give a distance from the current point. Choosing the wrong mode shifts every following move, which is a frequent cause of a crash. State the mode in the program header and check it after any restart.
G54-style work offsets and tool length offsets both shift the toolpath, and they combine. Verify that the offset you call matches the fixture you loaded and the tool you measured. The control cannot know whether the numbers are correct, so that check belongs to the setup.
Tool calls and length compensation
A tool call in a Fagor program selects a tool from the magazine and applies its stored data. The control needs the tool number and often a tool offset number to know which length and radius values to use. Keep the program tool list and the physical magazine in the same order to avoid surprises.
Tool length compensation shifts the Z reference so the programmed path follows the tool tip. Tool radius compensation offsets the path sideways so the finished profile matches the drawing. Both depend on values measured at the machine, and wrong values cut the part wrong.
Change tools at a safe position clear of the workpiece and the fixture. The program should retract, stop the spindle and move to a defined point before the change. A tool change written without a safe approach is a collision waiting for a tired operator.
Cycles and high-level commands
Fagor G-code programming includes canned cycles for drilling, tapping, pocketing and similar repeated work. A cycle block carries the pattern data, and the control expands it into the needed moves. Cycles shorten the program and keep the cutting strategy consistent across holes and pockets.
The high-level language of the control handles math, parameters and repetition that plain G-code cannot express. You can compute a coordinate from a formula or loop over a series of features. That power helps on parametric parts, but it also hides errors inside expressions that a dry run may not reveal.
Test a cycle or a computed feature on a single position before letting it repeat across the part. Watch the first hole or pocket at reduced feed and confirm depth, retract and clearance. A cycle that is wrong once is wrong at every position.
Writing a program step by step
Writing a Fagor program works from the drawing to the setup data to the blocks, in that order. Decide the operations, the tools and the zero point before typing a coordinate. The program then records decisions you have already made rather than inventing them at the keyboard.
Build the header with units, plane, absolute mode and a safe start position. Add each operation as a group of blocks with its tool call, spindle speed and feed. Close with a retract, spindle stop and program end so the machine leaves the part in a known state.
Keep comments at each operation and label the blocks you may need to jump to. Comments cost nothing at run time and save time at the machine. A program another machinist can read is a program that gets fixed faster.
- Study the drawing and list the operations in cutting order
- Choose tools, speeds and feeds and record them
- Define part zero and the work offset to use
- Write the header block with units, plane and modes
- Program each operation with its tool call and cycle
- Close with retract, spindle stop and program end
- Simulate and dry run before cutting the part
Testing and proving the program
A Fagor program should be proven before it cuts metal, and the control offers simulation and graphics for that purpose. Simulation shows the toolpath and flags syntax errors without moving the machine. Use it on every new program and after every edit.
A dry run with the tool clear of the part checks the sequence, the tool changes and the offsets in real motion. Watch the distance-to-go display and the active modes as the program runs. Stop at the first unexpected move rather than waiting to see what happens next.
Proving a program involves real spindle and real axes, so keep a hand on the feed override and the emergency stop. When a job needs a machine or a fixture you do not know, ask a trained specialist rather than experimenting on the machine. Correct setup data and a proven program are what keep the cut predictable.
Questions About Fagor G-Code Programming
Is Fagor G-code the same as standard ISO G-code?
Fagor G-code follows the ISO convention for the main motion and machine functions, and a machinist who knows ISO code can read most of it. Fagor controls also add their own high-level commands, cycles and parameters that plain ISO does not have. Check the programming manual for the control model in front of you before relying on a code.
Can I write a Fagor program by hand?
Yes, a Fagor program can be written by hand as a text file of blocks and loaded into the control. Hand writing suits short programs, edits and troubleshooting, while CAM software suits complex surfaces. Either way, the program needs simulation and a dry run before it cuts.
What is the difference between modal and non-modal commands?
A modal command stays active after its block runs and affects later blocks until it is changed. A non-modal command acts only in the block where it appears and is then forgotten. Setting every mode you depend on at the start of the program avoids confusion.
How do I test a Fagor program without cutting the part?
Run the program in the control's simulation or graphics mode to check the toolpath and catch syntax errors. Then run a dry run with the tool clear of the workpiece and watch the position display and active modes. Keep the feed override low and the emergency stop within reach during any motion.
Why does my program cut at the wrong depth?
Wrong depth in a Fagor program traces back to tool length data, the work offset or the active coordinate mode. Check that the tool offset called in the program matches the measured tool and that part zero sits where the program expects it. A wrong incremental or absolute setting also shifts Z along with every other axis.