Program the OMAX 160X
Waterjet Cutter in C
The OMAX 160X is a large industrial waterjet cutting machine. This guide shows you how to write a C program that generates a G-code cutting file — then load it into the machine to cut a perfect square.
- The OMAX 160X is industrial equipment. Never operate it without completing OMAX's certified training program.
- A 60,000 PSI waterjet can cut through 6-inch steel — it will cause serious injury. Always have a trained operator present.
- Never run a new cutting program on the real machine without first previewing it in IntelliMAX software and confirming the toolpath is correct.
- Know the location of the Emergency Stop (E-Stop) before any machine motion begins.
- Wear safety glasses and hearing protection when the machine is running.
What is the OMAX 160X?
The OMAX 160X is a Precision JetMachining Center — a large industrial machine that cuts materials using a thin stream of water mixed with fine garnet sand (called the abrasive), blasted at 60,000 PSI through a nozzle smaller than a pencil tip.
Because it uses water instead of heat, it leaves no heat-affected zones or warping. It can cut metal, stone, glass, carbon fiber, plastics, and composites — making it popular in robotics prototyping, aerospace, and manufacturing.
The OMAX's X and Y axes move the cutting nozzle across the material. Your C program will output coordinate pairs that tell those axes exactly where to go — tracing out the four sides of a square.
The Programming Workflow
There are five steps between writing your C program and cutting a square:
Write the C program on your computer
Your program calculates the X/Y coordinates needed to trace a square and writes them as G-code commands to a .nc file.
Compile and run the C program
Use GCC to compile your code. Running the program creates square.nc — a plain text file full of machine instructions.
Transfer the file to the OMAX controller PC
Copy square.nc to the Windows PC connected to the OMAX (via USB drive or network share).
Preview in IntelliMAX Make
Open the file in OMAX's IntelliMAX Make software. It will display the toolpath on screen. Verify the square looks correct before any machine motion.
Run the program (with a trained operator)
With a certified operator present, set the material on the cutting table, zero the machine, and execute the program.
G-code: The Language of CNC Machines
G-code is the standard language that CNC machines (including waterjet cutters) understand.
Your C program will use fprintf() to write these commands into a text file,
one command per line.
| Command | Meaning | When to use it |
|---|---|---|
| % | Program start / end marker | First and last line of every G-code file |
| G21 | Set units to millimetres | Put near the top — use G20 for inches instead |
| G90 | Absolute positioning mode | Coordinates are measured from machine origin (0,0) |
| G0 X# Y# | Rapid (fast) move — no cutting | Moving to start position before turning water on |
| G1 X# Y# F# | Linear cutting move at feedrate F | This is the command that actually cuts the material |
| M7 | Coolant / waterjet ON | Opens the waterjet nozzle — starts cutting |
| M9 | Coolant / waterjet OFF | Closes the nozzle — stops cutting |
| M30 | End of program | Tells the controller the program is finished |
C Code: Writing the Square Cutting Program
Create a new file called square_cut.c. The program below defines
the square's size and position as constants at the top, then writes a G-code file
that cuts the four sides.
#include <stdio.h> #include <stdlib.h> /* ── Square parameters — change these to resize or reposition ── */ #define SIDE_MM 100.0 /* side length in millimetres */ #define FEEDRATE 150 /* cutting speed in mm/min */ #define START_X 50.0 /* bottom-left corner X position (mm) */ #define START_Y 50.0 /* bottom-left corner Y position (mm) */ #define OUTPUT_FILE "square.nc" /* Write the G-code header — units and positioning mode */ void write_header(FILE *fp) { fprintf(fp, "%%\n"); fprintf(fp, "G21\n"); /* millimetres */ fprintf(fp, "G90\n"); /* absolute positioning */ } /* Rapid move — fast travel with waterjet OFF */ void rapid_to(FILE *fp, double x, double y) { fprintf(fp, "G0 X%.3f Y%.3f\n", x, y); } /* Cutting move — slow travel with waterjet ON */ void cut_to(FILE *fp, double x, double y, int feedrate) { fprintf(fp, "G1 X%.3f Y%.3f F%d\n", x, y, feedrate); } int main(void) { FILE *fp = fopen(OUTPUT_FILE, "w"); if (!fp) { fprintf(stderr, "Error: cannot create %s\n", OUTPUT_FILE); return 1; } /* Calculate the four corner coordinates */ double x0 = START_X; double y0 = START_Y; double x1 = START_X + SIDE_MM; double y1 = START_Y + SIDE_MM; write_header(fp); /* Rapid to start corner — waterjet is still OFF */ rapid_to(fp, x0, y0); fprintf(fp, "M7\n"); /* waterjet ON — starts cutting */ /* Trace the four sides of the square */ cut_to(fp, x1, y0, FEEDRATE); /* → right side */ cut_to(fp, x1, y1, FEEDRATE); /* ↑ top side */ cut_to(fp, x0, y1, FEEDRATE); /* ← left side */ cut_to(fp, x0, y0, FEEDRATE); /* ↓ close square */ fprintf(fp, "M9\n"); /* waterjet OFF */ rapid_to(fp, 0.0, 0.0); /* return head to home position */ fprintf(fp, "M30\n"); /* end of program */ fprintf(fp, "%%\n"); fclose(fp); printf("Written: %s\n", OUTPUT_FILE); printf("Square: %.0f x %.0f mm start (%.0f, %.0f) feedrate %d mm/min\n", SIDE_MM, SIDE_MM, START_X, START_Y, FEEDRATE); return 0; }
The square starts at (50, 50) mm from the machine origin.
x1 = 50 + 100 = 150, so the four corners are
(50,50) → (150,50) → (150,150) → (50,150) → (50,50).
Changing SIDE_MM resizes the square; changing START_X / START_Y
moves it to a different position on the material.
The G-code file this program generates looks like this:
% G21 ; millimetres G90 ; absolute positioning G0 X50.000 Y50.000 ; rapid to start corner M7 ; waterjet ON G1 X150.000 Y50.000 F150 ; → cut right side G1 X150.000 Y150.000 F150 ; ↑ cut top side G1 X50.000 Y150.000 F150 ; ← cut left side G1 X50.000 Y50.000 F150 ; ↓ close square M9 ; waterjet OFF G0 X0.000 Y0.000 ; return to home M30 ; end of program %
Compile and Run Your Program
Open a terminal in the same folder as square_cut.c and run:
# Compile gcc square_cut.c -o square_cut -lm # Run it ./square_cut
You should see this printed to the screen:
Written: square.nc Square: 100 x 100 mm start (50, 50) feedrate 150 mm/min
A file called square.nc now exists in the same folder.
You can open it in any text editor to inspect the G-code before loading it
onto the machine.
square.nc into a free online G-code simulator
such as ncviewer.com — it will draw the toolpath on screen so you can
visually confirm the square looks right before touching any real machine.
Loading the Program onto the OMAX
The OMAX 160X is controlled by a dedicated Windows PC running IntelliMAX Make software. Here is how to load and run your file:
- Copy
square.ncto the OMAX controller PC (USB drive or network share). - Open IntelliMAX Make.
- Go to File → Open and select your
square.ncfile. - The software will display a preview of the cutting path. Confirm that the square shape and its position on screen match your expectations and fits within the material you have loaded.
- Set the material origin (X0, Y0) on the machine — this is where the (0,0) corner of your G-code will be. Your square starts at (50,50), so make sure there is at least 150mm of material from that point in both X and Y.
- With a trained operator present, press Run. The machine will execute the program.
What to Try Next
Now that you can cut a square, here are natural next steps using the C skills from the main tutorial:
- Cut a different size — change the
SIDE_MMconstant and recompile. - Cut a rectangle — add separate
WIDTH_MMandHEIGHT_MMconstants. - Cut multiple squares — use a
forloop to call yourcut_to()function in a pattern. - Cut a circle — use
<math.h>withcos()andsin()to generate dozens of small G1 line segments that approximate a circle. - Accept input — use
scanf()or command-line arguments (argc,argv) so the user can specify the size without editing the source code. - Cut a robot frame bracket — combine rectangles, holes, and mounting slots into one program.
#define constants, FILE pointers and fopen/fprintf/fclose,
functions with parameters, and arithmetic on double variables.
All of these are covered in detail in the main C tutorial.