How to CNC a ‘ball bearing maze’!

With Christmas around the corner, it’s time to start thinking about some last minute custom made presents. A ball bearing maze can make a great little stocking filler. It can be as simple or complex as you like making it a fun one for kids or adults.

In this post I’m going to be focusing on using online tools to generate mazes and setting up the parameters. Then we’ll take a look at how to convert them into something you can use in Fusion 360. Once you are in Fusion, you can customise your design however you like and generate your Gcode for your CNC. So let’s get started!

Finding your way to a maze

Creating a maze from scratch is one way to go. But lets be honest, we’ve all got better things to do with our lives. So here comes ‘maze generators’. As it turns out, there is some very interesting maths that go into these algorithms. Make sure to have a check out of Wiki’s article on this.

But anyway, there are a lot of maze generators out there. Some paid, some free. But the one I found particularly useful is Keediemeijer’s maze generator on Github. The reason I like this one is that it has a nice level of detail, not too much, not too little. The other reason is that is has clear colour controls for both the walls and the background colour – this will become more important later.

Don’t worry about it if you are using a different maze generator. The rest of this post will basically still apply.

Calculate maze size in cells

Note that a “cell” is the rectangular grid that makes up the maze. The maze then has walls between the cells. Since the maze generator I used above has equal size cells and walls, we can calculate the “size” of the maze in units by:



Where L is the length of your maze, D is the width of your maze channel (or nominal cutter diameter) and N is the number of columns or rows.

So, lets assume you want a square maze which is 125mm wide and what to use a 5mm cutter:



So we use 12 as our number of columns and rows. This will give us a square maze of 125mm using 5mm as a channel width.

File conversion using Inkscape

Keesiemeijer’s maze generator has a few other options to play with. For example, you can set the entry and exit points of the maze. Another useful option is the ‘Bias’ value. This sets the maze so it is mostly vertical or horizontal. This reason this is useful is if you are cutting your maze from timber – you’ll know from experience that cutting with the grain yields a much cleaner cut. Cutting against the grain usually needs cleaning up.

Ideally, we need the maze as a vector file (.svg) or drawing file (.dfx) so we can import into our CAD package, Fusion 360. Since the only output option is .png, we need to convert the file.

One fantastic piece of software for vector creation is Inkscape. It’s a very powerful piece of opensource software with lots of custom plug-ins. Among other things, its possible to ‘trace’ a contrasting image and then convert it into a vector file.

Remember I mentioned the ability to change colours was really useful on Keesiemeijer’s maze generator? Well this is why. Set your maze colour and background colour contrasting colours like black and white. If you set the background colour to black and the maze colour to white (opposite to the default colours) this will ensure we only have 1 vector to worry about later.

Once you have Inkscape downloaded, open a new document and click ‘File’ > ‘Import’ and find the maze you have generated and downloaded. Using the default import options works just fine.

Now with the maze selected, click on ‘path’ > ‘Trace Bitmap’. Using the default settings, select ‘Update’ and check the image preview. Assuming everything looks good, hit ‘ok’. This will now have “traced” your png image and has created a vector image over the top. You can check by dragging the new image to a new location and you should see the old image behind it. The old png image can be deleted if you wish. Don’t worry about the image size for now. Save the file as a .svg.

Importing SVGs into Fusion 360

So with a fresh file in Fusion 360, start a new sketch. Then click on ‘Insert’ > ‘Insert SVG File’. There is a known issue when importing .svg files from inkscape to Fusion 360 which means the size will be wrong. Don’t worry about this for now.

Position your SVG file roughly into position using the grab handles or the arrows.

By default, Fusion 360 fixes the SVG file. You can tell this by grabbing one of the nodes and trying to move it. Nothing should budge. To stop this, we need to highlight all the lines and nodes in the SVG. Then whilst hovering one of the lines, right click and select ‘fix/unfix’. You should see the line colours change from green to blue. As a test, you should also be able to grab one of the elements and move it. Now, exit the sketch.

Getting the size right & position

The size is a really simple to fix one to fix. Grab the inspection tool and measure the width dimension of the imported .svg file. Mine measures 33.073mm, but I wanted 125mm. So we need to scale the maze by 125/33.073.

So click on ‘Solid’ > ‘Modify’ > ‘Scale’ and then select your sketch from the feature tree. Handy tip: don’t worry about calculating your scale factor, just type it in directly as an equation into Fusion so you avoid rounding errors:

Scaling in Fusion 360

Moving the sketch into a fixed position is equally simple. Remember that we unfixed our SVG? Well this is why. Now we can head over to ‘Solid’ > ‘Modify’ > ‘Move/Copy’. Change the dropdown to Sketch Elements and draw a box around all of your SVG image. Then you can move the entire sketch manually, translate it, rotate it, move using a point or move a particular point to a position.

Time to get creative

Now you have your maze design in Fusion in the correct size, it’s time to get creative. For a basic design like this square one, you can simply extrude cut the maze into a solid block. Maybe add a recess for some clear acrylic. Round off the corners, and jobs a good’un – basic maze complete.

But why stop there?

Don’t let square 2D mazes’ stop your creativity. For example, you could download multiple mazes and link them together in a custom shape. Wrap the mazes around an object. Take the maze cube example below.

A few notes on CAM

I am not an expert in CAM so I won’t spend to long on this. I had great success using the 2D pocket strategy in Fusion. However, a small note on cutter diameter: I intended on using a 5mm end mill so set 5mm as our channel size. However, using a ‘size for size’ endmill upset Fusion and it failed to generate the toolpaths in some places. So as an easy fix, I adjusted the tool diameter in fusion to be just under the nominal – say 4.99mm. This will allow fusion to generate the required tool paths.

Another tip here is that if you want to reduce the thickness of the walls, you can use the ‘Axial Offset’ and set this to a negative value. This will cut along the profile of the maze, but with an offset cutting away more material. Similarly, if you wanted to thicken the walls, use a positive offset value.

Generating toolpaths in Fusion

Quick run around the maze!

If your still with me, it’s time to head on over to the the CNC. To this point, things have been really quick – maybe 10mins for the basic design? Well now things slow down a bit since I took things really easy on the first run on the CNC. I was using a scrap piece of pine and kept all my speeds and feeds low. However, the result came out pretty good.

Final Thoughts

Given how simple this was, I was really impressed at the results. I suspect that my maze cube will give me a few more issues during when trying to reset-up for the multiple operations – but we’ll see! Something machined in brass or aluminium would also be a really interesting project which I hope I can look into.

Anyway, let me know if you have any comments or ideas on this post either by commenting below or get in touch via the contact page.

Add a Comment

Your email address will not be published. Required fields are marked *