Thursday 16 May 2013

Prototyping 2 - Day 6


Day 6 came around and there was no more avoiding the inevitable; I to find a way to cut the concave surfaces. There were two problems to tackle. The first problem is the control software. My life would be easy if the CNC control software package that converts DXF drawings into G-code could convert my concave curves. However, it didn't even try. It just failed and told me it couldn't be done. The second problem was the tools available. Even if the software could process the curves I was trying to give it, I would still be subject to the working head room of the cutting tool. The only tool that can cut outwards from the centre is the boring tool, so  the minimum radius of the concave curve I can cut is subject to the dimensions of the face the tool.

This was all established on Day 1. Me and Garry talked about a couple of different solutions, ranging from cutting the faces manually with a fine tunable cutting tool mounted on a pivot, through to changing the control system to Mach3 and writing the code out for the machine manually. In the end, after a bit of thinking and a bit of research after work every night, I ended up obtaining a copy of the Boxfords control software and started to push it to see what it could do. The solution was to use it in administration mode to write and simulate the G codes for the machine.


G&M Codes. What on earth are they?? 9:00am, no idea. 9:30am, no idea. 10am, expert.

G codes and accompanying M codes are very basic instruction sets which tell CNC machines exactly what to do. Most modern CNC machines use some derivative of G&M instruction codes. The instructions are written in scripts, often in a tabular form, and tell the CNC machine everything from whether to use imperial or metric measurements, through to exactly where and at what speed to move the tools. In reality, as scary as it sounds programming a machine (even with my past experience of programming), the code is just so simple that so long as you keep a clear head when writing it really is easy. That said, you do want to make sure you know exactly what you're doing first... After all I don't want to be the one to collide a highspeed steel tool into the chuck spinning at 2000RPM, inevitably mangling a £10k+ machine...


So, without getting to technical, here's how I coded my first program. I want to cut a concave face but the machines software doesn't think it's possible. Job one is to go into Admin mode, giving me the opportunity to over ride what the machine thinks and simulate my own code. With a new script open, the first things to tell the machine are basic set up items. So for example, I work in metric (mm), I want to set my home to some where away from the face of the billet, and I want to start my spindle along with a generic starting spindle and feed speed. Easy!

Okay, so the datum is located at the centre point of the end face of the billet, which the machine knows is at the location I tell it when I run the script. First job is to clean up the face, so at the start of every script I face off along the datum to ensure everything is nice and clean to start off. If, when I run the script, the face isn't perfect, I can hit the stop button and rerun the program with a reduced billet length, therefore changing the datums location. From here on the program all depends on the shape I want to cut. The main instructions are G00 (jog to location), G01 (linear interpolation), G03 ( CC Circular interpolation), M03 04 05 which all dictate spindle start, start CC, and stop.


The challenge isn't really the code, the code is easy. The challenge is thinking like a machine. Remember I said you build a relationship with a machine? You hear how it cuts, know when it's struggling, know how much you can feed it at what speed etc etc? Well this is where the experience comes in handy, because the machine is your buddy and you don't want to damage it by asking it to do something it's going to struggle with. So, basic rules apply. Rule one, this is a real machine, not a drawing on a computer. The profile you want is not your cutting path. If you tell it to just cut along your profile like a laser cutter would, say goodbye to your billet. Everything worked in passes. For these concave faces, it makes sense to me to make a series of cutting passes in small steps into the material until the majority of the profile is hollowed out.


On Solidworks I re-opened my DXF's and linear copied intersecting parallel vertical lines and took dimensional readings from each intersection to build an Excel sheet with distances to cut from centre next to the incremental step. Then I took these numbers and progressively entered them into the script, moving the tool in and out each time to avoid collisions and let the swarf drop etc. There are about 4 lines of code per pass, with each pass being a -0.25mm increment along the Z axis. Once this is done I can then run the tool on a G03 pass giving the rad of the curve and end point co-ordinates so that the machine progressively eats into the steps created by the hollowing, and then ultimately cutting two -0.25mm passes to form the final face. If the surface is ASPH (not a fixed rad) it's a little harder, as I have to cut using G01 linear paths along co-ordinates worked out off Solidworks, with steps going down to -0.125mm near the centre to retain accuracy near almost vertical cuts.


So every night after working I would attempt to stay awake long enough to write some of this code and not get it wrong. I hit a few snags with wrong numbers at times or simulations failing, but overall it was time consuming but not difficult. Once tested a few times in software simulations I would copy the code onto the control computer and run it away from the billet in fresh air, watching it like a hawk for any erroneous movements.


Then comes the moment you've done all your tests and you have to cut some material for real. It may sound stupid, but there was something scary about running it for the first time. Code, that you've written from scratch, running off numbers you've scraped off of 3D CAD files you've made, using data from a lens formula you designed and optimised from first principles through ambitious technical research, running on a £10,000+ highspeed cutting machine... God knows how production managers cope. To be on the safe side, if something goes wrong I at least don't want it to be on my prime material, so to start off with I chose to cut a billet of nylon.


Nylon cuts horribly, but through the swarf you can see the program working. Above you can see the stepping caused by the roughing out process.


Finally a concave face starts to be smoothed out as the steps have their corners trimmed off.


Tada!!!!! The machine said it couldn't be done, I say it can. The surface was cut perfectly. The concave face was smooth, even and constant, as it was designed to be. A tiny blob in the centre and cutting marks forming rings stemming from the centre outwards were by-products of the nylon material and not the code. All good to move onto the real deal and cut the profile from PMMA.





The end result wasn't clean when cutting with the PMMA, as lots of the swarf remelted onto the surface. However, the damage was external to the profile path, so it was nothing a double pass couldn't fix. I simply ran the program again at the same datum, and it just trimmed off the remaining plastic. After a quick polishing the part looked amazing; ultimate proof that what i'm trying to do can be done!! And more to the point, it meant that my entire week wasn't a waste of time.