Wednesday 16 April 2008

Python & Beans make object

Having got bored of making rectangular blocks for months I decided it was time to hook up my machine to the RepRap host software so that I could make arbitrary 3D objects from STL files. My original plan was to hack the host code to replace the serial comms with Ethernet and cope with the differences of my machine from the RepRap Darwin. Zach Smith added a G code back end so I decided to just add a G code parser into my Python to save me having to modify the host.

In the meantime Enrique Perez published a plug-in script called Skeinforge.bsh for ArtOfIllusion that also converts 3D objects to G code extruder paths. It is written in the Beanshell script language, which is Java like. I decided to try both approaches, as in theory a G code parser would allow me to use either.

Enrique posted some new scripts that process G code and drive the RepRap hardware using a Python SNAP protocol driver written by greenarrow, so I didn't even need to think about writing a G code parser, I just cut and pasted a few lines from Enrique's.

Before letting it drive my machine I thought it would be a good idea to look at the paths on screen. I knocked up a little script which used my HydraRaptor simulator to draw them. The script is just a few lines of Python that use TkInter.

It was soon apparent that Enrique's code had a bug that left off some of the outline, but apart from that it looked very promising because it has the ability to do sparse infill. That speeds up building objects, saves plastic and reduces warping so it is very worth while. Not only that, it had a novel infill pattern. Instead of parallel lines like this: -



He moves the ends together so that the outer wall is stronger: -



This looks like a good idea because it makes the outer wall effectively two layers thick but probably gives a bit less warping than a second continuous layer would give.

In order to communicate the results to the forums I came up with the idea of making an animated GIF showing all the layers in sequence. This turned out to very easy using Google and Python. The Python Image Library (PIL) can make GIF files and I found a script called gifmaker.py which takes a list of images and uses PIL to calculate the deltas and write out an animated GIF.

Enrique fixed the bug very quickly, here is the sliced extruder pump body: -



The red lines are moves without filament flowing (ideally) and the each new section of filament is a different colour.

And here is the same object sliced by the reprap host :-



A side effect of Enrique's algorithm is that the corners get rounded, however I don't think that matters too much because the filament has a minimum bend radius anyway. The main downside is that beanshell script is very slow, so it takes longer to slice than it does to extrude at the moment. A faster PC will probably sort that.

The first object I tried to make was this opto mounting bracket from the RepRap Darwin: -

I choose it because it is small, so does not take too long, but reasonably complex with a horizontal hole. Here is the sliced path from Enrique's script: -



And here is my first attempt at making it: -



This is PCL extruded onto MDF, 0.625mm filament extruded at 10mm/s with the fan on, no interlayer pauses.

A bit hairy due to the extruder not being able to stop the filament flow quickly, but I was quite pleased with it for a first attempt. It is too tall due to a bug in my code and its not the latest version, which has teardrop shaped holes to make the overhangs less than 45°.

Here it is cleaned up a bit: -



It is 50% filled which is probably not appropriate for this size object in PLA but that part is fully functional I think.

Enrique was pleased to see it as he doesn't have a machine to test his code with. A perfect partnership, he writes all the hard bits in beanshell script and I write the easy stuff in Python!

Thursday 10 April 2008

Basket case

I was using two old component spools to hold my feedstock, see all-wound-up, but I don't have any more so now that I have four polymers I decided to give Vik Olliver's design a try. It has the advantage that you don't have to spool all the filament on, you can just drop in an open reel if that is how your filament comes.

This is my take on it: -



The uprights are 15x15mm aluminium angle. The beam across the top is a piece of 20x10mm channel. The bearing is a standard ball bearing and I reduced its internal diameter with a couple of bushes I had lying around. I then used a bolt with holes through the head as an axle. I found it in the road while I was on a walk wondering what to use. That is the third piece of HydraRaptor that I have picked up in the street.



The baskets are £4.21 in B&Q and have a plate in the bottom with a central hole just right for feeding the filament through. As the machine pulls the filament from the centre of the reel, the basket rotates to prevent it becoming twisted.

It works very well and has the advantage I can buy as many baskets as I have plastics and just take them on an off as needed.

It also allows the filament to rotate in the extruder but ironically, since I tweaked my extruder, PLA no longer feels the need to rotate. Presumably it rotates if the friction between the screw and the plastic is higher than between the plastic and the filament guide. I think that gives a clue to which of my tweaks made all the difference in reducing the extruder torque needed. I think it was adding the washers to space the top of the pump apart so that the screw bites in progressively and sharpening the screw thread.

More PLAying

The tweaks I made to my extruder dramatically improved its ability to extrude PLA. I am not sure which one made all the difference or whether they are all needed. I can now extrude at my target 0.5mm filament 16mm/s with about 75% motor PWM duty cycle. That is less than I needed for ABS before the tweaks.

I can also extrude at lower temperatures. I think 180°C is a bit on the hot side as the plastic is very runny at the temperature. It will flow out of the extruder under gravity and has negative die swell. At 140°C it behaves more like the other plastics and swells to 0.6mm, which is very low.

In a previous article I stated that I could not make sparse filled objects because the filament slumped too much. With the reduction in temperature and increase is speed I now can. Here is a 50% filled block: -



It is still very strong. I expected the warping to be less but I have switched from MDF to balsa and I think that increased it. The balsa I have is only 2mm thick and was only stuck down with masking tape. I might try gluing two pieces back to back with the grains at right angles to get it stiffer.



So now with a slightly tweaked extruder I can do PCL, PLA and ABS at 0.5mm @ 16mm/s. I had to slow down for HDPE to prevent thermal damage to the extruder.

To get good definition at high speed I extrude with a fan running. The fan cools the nozzle which causes more heater power so the barrel temperature rises to the point where PTFE goes soft and the JB Weld turns to dust. PCL and PLA are no problem because the temperature is less. ABS does not seem to need the fan.

I plan to make a PTFE cover for the nozzle which will probably insulate it well enough and hopefully stop filament sticking to it and burning.