Blogs

Web Form for Slab Flattener

GCode Generator for Slab Flattening

Written by: | Posted on: | Category:

Simplify Slab Flattening with this CNC GCode Generator

As CNC woodworkers, we all know flattening wood slabs is the foundation of a great project--whether it's a live-edge table, a cutting board or a simple carved sign. Setting up the gcode for this with a program like Vectric VCarve Pro or CarveCo Maker is simple enough, but it's more steps and overhead to create a file, set the X, Y and Z sizes, create the cutting pattern, set the cutting depth, export the code, etc. I'm a software engineer and woodworker, and I've built a web form with an underlying program that generates slab-flattening gcode instantly, tailored for intermediate CNC users who are comfortable with terms like "toolpath" and "gcode." Let's walk through how it works with a real example, and I'll show you how it can streamline your workflow.

If you want to take a look now, drop by CNC Slab Flattener, which is the same form you see in the image above. Otherwise, read on.

The Problem and Solution

Flattening a slab means tackling uneven surfaces by creating simple, but tedious toolpath files. My program changes the tedious creation of the files to a quick website form. You enter the details into the form, and it spits out a ready-to-use gcode file, emailed straight to you with a link to a simulator for a quick double-check. It's fast, practical, and built for folks who want to focus on the creative side of CNC woodworking.

How It Works

Imagine you have a CNC with a 48" wide (X), 32" long (Y), and 6" high (Z) work area--which are the dimensions of my Onefinity Journeyman, a higher-end hobby machine. Your slab is a beautiful piece of white oak, 36" long, 16" wide, and 3" thick, laid sideways to fit the bed. You're running a 1.25" diameter bit at 16,000 RPM with a cut depth of 0.03" per pass, a total cut depth of 0.25", and a feed rate of 240 inches per minute. The program collects these specs through a simple web form--take a look at the "Web form with sample inputs" image below to see it in action.

Web form with sample inputs

It's straightforward: CNC dimensions first, then slab size, and finally bit and spindle details. The web form collects everything, emails you the data you submitted to the web form, drops the information into a database table, then calls a Perl program. The Perl program writes out the gcode and emails the file to your email address. Every bit of that takes place in a couple hundredths of a second. You end up with a pair of emails, one to confirm your inputs and another with your output file, and a few more details, along with any warnings (slab size very close to CNC limits) or errors (slab size exceeding CNC limits).

Key Settings Explained

For this example, the program removes 1/4" of height from the slab, taking 0.03" per pass with a 40% stepover along the X-axis (following the grain). Why these numbers? The 0.03" pass depth pairs with the beefy 1.25" bit to keep the spindle moving fast enough to avoid burning the wood, while keeping the load low enough to prevent overheating your spindle--crucial for cuts that might take hours on a larger slab. The 40% stepover, 16000 RPM, and 240 IPM combo balances cutting speed with a decent surface finish.

But slab flattening is just the start. The CNC's linear toolpath leaves visible tool marks as it flattens wood fibers one way, then back the other--see "Tool marks left by spindle bit" below for a visual explanation. You'll need a drum or random orbital sander to smooth things out afterward. Pro tip: A final pass with a smaller DOC, stepover and faster feed rate can cut sanding time, though some is still inevitable. The image below shows the tool marks from an oak board that was not sanded afterward. Ignore the diagonal cut, and look at the horizontal lines, which are a result of the bit passing left to right, then stepping over the specified percentage and traversing back in the opposite direction.

Tool marks left by spindle bit

Want to see the geekery behind the curtain? The "Input Perl program" image shows how these settings get turned into GCode. There's more to it, of course, but that gives a quick taste.

Input Perl program

Output and Verification

Hit submit, and bam--GCode file in about 0.01 seconds. It lands in your inbox with a link to https://ncviewer.com, check out "Email with input parameters" to see what arrives. Download the file to your computer, then upload it to the simulator for a visual once-over.

Email with input parameters

The program has sanity checks to catch slabs bigger than your CNC, but it won't spot typos like 3" instead of 0.3" or a 4% stepover instead of 40%. That's where the simulator shines: a 4% stepover shows a dense mess of lines, while 40% gives you nicely spaced passes. The "Output GCode file" image below is what you'll work with. Also, you'll see a couple lines in the email indicating the Estimated Runtime and Estimated Fee. The Estimated Runtime is calculated based on the feed rates provided to the program, but it does not take into account the acceleration and deceleration of your machine as it traverses the slab, so it will get you in the ballpark, give or take a minute. There is a field in the form (not shown in these screenshots) for an Hourly Rate which will provide the Estimated Fee value.

Output GCode file

Sample Run Breakdown

Let's tie it together. For our 36" x 16" x 3" white oak slab, the program crafts a toolpath to remove 1/4" at 0.03" per pass, stepping over 40% along the grain. The sideways orientation fits within the 48" x 32" bed dimensions, and the GCode sets your CNC up to flatten efficiently. You're left with a surface ready for sanding to erase those tool marks--a solid starting point for any project.

This blog was inspired by a video I made in Sept., 2023, flattening a white oak slab for a pair of marriage boxes a mother requested for her two children, who were married several years apart. The video is only a couple minutes long and the white oak slab is pretty much the same size as discussed in this blog.

Try It Yourself

Ready to flatten your own slabs? Visit CNC Slab Flattener and plug in your numbers. To get a feel for it, here's the GCode from this sample case--https://windridgewoodcrafts.com/resources/Blogs/Flat_36p0_16p0_3p00_0p25_Mat.ngc. Download it, then head to https://ncviewer.com, upload the file, and watch the toolpath unfold. It's quick, it's easy, and it gives you confidence before your spindle is powered on. You'll see an image similar to the one below.

NC Viewer Simulator

And take some time to play with the simulator, it has loads of great features to examine your GCode files.

Send a comment with your thoughts or results--I'd love to hear how it works for you!

© 2017 - 2017 Wind Ridge Wood Crafts, LLC      Privacy Policy      Terms of Service      Site Designed and Hosted by Custom Visuals, LLC