Monday 26 January 2015

Miniature terrain casting and CNC routing

Sometimes you just have to document your failures, as well as successes. Today is one of those times - after getting back from petanque yesterday (we got through to the knockout stages, having finished in the top 16 of nearly 40 teams since you ask, but were quickly eliminated by far more experience teams!) we had a go at casting some sci-fi scenery from one of the moulds we had made over the weekend.


Two-part RTV (room-temperature-vulcanising) silicone rubber is great for picking out detail when making moulds. The only thing is, it may actually be too good at picking out details! Not only does the silicone show up the wood grain on some of our shapes, but it also seems to have managed to seep under the thin veneer we had glued to the mdf. You can see where this has happened especially in the top-left of the photo, where there should be a line of vertical slots in the wall - it is almost like a single, solid blob of rubber!


We made up some dental plaster, but made it a little runnier than usual (to allow it to flow into the tiny details on some of our pieces) and you can see that the mould had even picked up the join between the laminate and the mdf backing piece (the photo also showed that we made a bit of a pig's ear of the plaster too, as it's full of tiny little air bubbles!)


Our door sections also need a bit of a re-think and they are very delicate, at the thinnest part. So all in all, we've a lovely large, useless, pink rubber mould that can be used - at best - to make some pretty crappy looking sci-fi scenery! If we're going to re-do this, it needs a bit of a re-think.

Luckily, Sunday night is a great time for re-thinking ideas. One thing a laptop and an evening of boring period dramas on telly let you do, is explore a few ideas.

In the Nerd Unit we've an A3 CNC router which is woefully under-used (I think it was fired up to draw a PacMan face a number of years ago, and we used it to drill a grid of holes in some copper clad board about twelve months ago) and we've never really spent any time getting used to it.

Inspired by Iain's recent Google+ post, demonstrating some of the amazing self-designed patterns he was routing out on his own CNC machine, we thought it was time to learn how to do something more than draw pacman, or carve specialised PCB shapes with the machine we have in the unit.


It's using Mach3 software to control it - which is akin to learning to fly a space shuttle just to pop to the shops in a car. It's very complicated! Luckily, it can also import pre-built g-code and just drive the CNC machine - so that's how we're going to use it; like a glorified printer driver. All we need to do it learn how to make g-code from our drawings....

Since the drawings are in Inkscape already, it sort of made sense to download gcodetools - an Inkscape plug-in that, well, generates g-code from your drawings. That sounds ideal! There are loads of tutorials on the net explaining how to use them, so we won't go into that here. But, after just a few minutes, we had the extension installed and ready to use.

Here are some of the shapes we laser-cut in our previous attempt.


We took one of the more complex designs and prepared it for CNC routing. Because Inkscrape doesn't compensate for things like routing-bit diameter, we had to do this manually. It basically involved increasing the stroke size of the shape to be cut to 1mm, then adjusting the size of the shape (increasing if we wanted to keep the "island" bit in the middle, decreasing if we we creating a "pocket" and wanted to keep the material around the outside of the shape). Some of the shapes overlapped. That didn't really matter - it just shows that in some places, the cutting head will be moving over areas already cleared by a previous pass.


The gcodetools extension made short work of filling the "pocket" shapes with lines. In some cases, it created a lot of unnecessary lines (the fill function repeated a lot of our outline shapes for example) so a bit of manual tweaking was necessary. But it wasn't difficult to do - just a little time consuming.



Generating the G-code is as easy as selecting the function from a menu in Inkscrape. The actual image gets an additional layer, showing the cutting direction that the generated gcode will take. The extension also creates a separate .ngc file, in a folder of your choosing, on the computer.

With the gcode created, we needed a way of testing it worked. Of course, we could have just left it at that, taken the code down to the unit one evening at tried it out on the router. But that's also a really quick and easy way to use up all your router bits or even damage the cutting head - running untested gcode is always a big risk!

Thankfully, the home-CNC scene has changed quite a bit from previous years, thanks to all kinds of open-source designs, and people generally getting behind the whole open-hardware movement. One result of this is the brilliant CAM simulator, OpenSCAM.

In this case, SCAM doesn't mean it's a scam (the internet is far more subtle than that!). The S in CAM is for "simulated" - so it's software for simulating "computer aided machining". Just what we were looking for! Simply load in your pre-generated gcode and watch the cutting head path (the software can draw the the paths and has a great animation tool, to show you exactly how the shape(s) will be machined from your piece). Depending on your requirements, you may need to adjust the cutting piece Z-offset and the diameter of the cutting bit, to match the settings in your Inkscape file - otherwise your milled shape may be unrecognisable the first time you see it!


The image above shows the final piece after the milling operations have completed. The software does a great job of simulating a cutting head, and the resulting 3d shape allows you to inspect the milled piece from all angles. The gcodetools extension doesn't create optimised cutting paths - it goes with the easiest to calculate, not the best-to-run paths!


The paths shown above demonstrate that the cutting head is doing a lot of unnecessary lifting and moving across the piece, only to lift and move back to the previous place. There may be a way to address this in the extension options in the gcodetools extension. But it's not something we're going to spend too long on: if you want the best, most optimised cutting paths, it'd be better to manually place the cutting lines yourself. Which means you're going to be spending a lot of time tweaking, testing, re-tweaking and hand-carving a lot of gcode.

The way we see it, it's better to let the software do the work, and spend the extra time the CNC needs to complete the cuts (we're only really talking about a few minutes extra anyway) with a nice cup of tea and a biscuit. Let the machine do the work, so you don't have to!

With our simulated gcode looking ok, we're just waiting on some 1mm diameter router bits from ebay - and when we're next at the unit, we can give it a go on the real thing!




No comments:

Post a Comment