How the STL to G-Code Carving Tool Works
A relief carving is a 3D surface cut from the top of a board, like a sign, a plaque or a coin. The tool reads your STL, lays it into the stock with its top at Z0, works out where the cutter can sit at each point without cutting into the model, and joins those points into toolpaths. Then it runs every move through a simulated block of stock and compares the carved result with the model.
The work runs in a Web Worker using a WebAssembly module written in Rust, so the page stays responsive and nothing is uploaded. Seen from above, every point of the model has one height, so this is 3-axis carving only: undercuts and overhangs can't be reached, and the surface under them is cut straight down.
The Method
Worked Examples
- Load sample (120 × 80 × 11 mm), stock 150 × 100 × 19 mm, fit with a 5 mm margin, relief depth 8 mm
- Fit: the space is 140 × 90 mm, so the scale is min(140 ÷ 120, 90 ÷ 80) = ×1.125 across and about 8 ÷ 11 = ×0.7274 in Z (the dome peaks at 10.998 mm)
- Roughing: 6 mm flat end mill, 3 mm stepdown, 0.5 mm leave-stock: 3 levels (Z−3, Z−6 and Z−7.5, the floor plus the leave-stock)
- Finishing: 3.175 mm (1/8 in) ball nose, 0.3 mm stepover: cusp = 1.5875 − √(1.5875² − 0.15²) = 0.0071 mm
- Run time at 1500 / 2000 mm/min and 5000 mm/min rapids: roughing 14 min 46 s + finishing 26 min 07 s = 40 min 53 s
- Simulation: no gouges, 94.8 % of the surface within 0.1 mm of the model, 96.3 cm³ removed, 48,811 lines of GRBL code
- Sample, stock 4 × 3 × 1/2 in, 0.4 in margin, 0.15 in deep, origin at the stock centre, Fanuc-style, inch output
- Scale = min(3.2 ÷ 4.724, 2.2 ÷ 3.150) = ×0.6773 (the sample is 4.724 × 3.150 in)
- Roughing: 1/4 in flat end mill, 0.1 in stepdown, 0.01 in leave: 2 levels, 5 min 34 s at 50 in/min
- Finishing: 1/4 in 60° V bit, 0.02 in stepover, X then Y, climb only: cusp = 0.01 ÷ tan 30° = 0.0173 in, 30 min 46 s at 60 in/min
- Cut-out: 0.15 in outside the model, through 0.51 in, two 1/4 in tabs a side, 0.12 in tall: 1 min 41 s
- Total 38 min 02 s, no gouges, but only 31.2 % of the surface is within 0.1 mm: the V bit's cusps are 0.44 mm tall, so it leaves a textured finish
Tips for Using the Results
- Pick the stepover from the cusp height. For a smooth finish on wood, aim for a cusp under about 0.01 mm (0.0005 in); that usually means 8 to 10 % of a ball nose's diameter. Halving the stepover doubles the finishing time.
- Check the gouge check and the comparison view. Compare with model colours the simulated surface: green within 0.1 mm, blue where material is left (narrow gaps the cutter can't reach), red for a gouge. Blue in tight corners is normal; use a smaller or tapered ball to get in.
- Set Z0 on the stock top. The program assumes Z0 is the top of the board and X0 Y0 is the front left corner (or the centre, if you choose that). The pause between tools is the time to fit the next cutter and set Z0 again.
- Prove it in the viewer. Open in G-code viewer loads the program into the G-Code Viewer with the stock and tools filled in, where the cut simulation plays back with the timeline and checks for rapids that cut.
- Feeds and speeds. The defaults are moderate for a hobby router in hardwood. Work out your own chip load with the CNC Router Feeds & Speeds calculator.
- Big jobs. Very fine stepovers on large stock make millions of points. The page refuses jobs over 8 million finishing points; press Cancel at any time to stop a long job.
Frequently Asked Questions
Limits. 3-axis only, with no undercuts or 4th axis. The raster runs along X and/or Y only, with no waterline or pencil passes. Roughing is a Z-level raster, not an adaptive clearing path. The cut-out is a rectangle around the model. Shank and holder collisions are not checked, so make sure your cutter's flute length covers the relief depth. Always air-cut or dry-run a new program first.
Open-source credits. The engine is written in Rust and uses wasm-bindgen and js-sys (MIT or Apache-2.0) and serde and serde_json (MIT or Apache-2.0). The 3D view uses three.js (MIT) and the page uses Bootstrap (MIT).