I spent yesterday evening carefully adding to my raygun model in OpenSCAD. The image to the left is a screen capture.
This morning I told my Mendel Prusa to print the model in clear PLA plastic. This is my first large print, and it took three and a half hours. Which is fine, as I can use my computer for other things while the raygun is printing. This post will outline the workflow from idea to physical object.
First up, I model the object in OpenSCAD, as shown in the first screen capture.
After saving the raygun from OpenSCAD as an STL format file, I load the STL into Netfabb. Netfabb is a very useful free program for viewing, fixing and scaling 3D models (amongst other things).
Here I used Netfabb to scale the model to half the dimensions used in the OpenSCAD file. This resulted in it being 125mm left to right, by 100mm front to back, which fitted easily on my printbed.
I also use Netfabb to ‘mirror’ the model – to create an STL of the other side of the model – if the model is symmetrical like this one. I could also have done that in OpenSCAD, but it is easier to do it here. Especially as I have never had Netfabb crash on me 🙂
If you are downloading STL models from somewhere like Thingiverse.com you’ll often find that your slicing program (Slic3r, SFACT, or Skeinforge for example) will complain about the STL file. Netfabb can often fix these problems and save the ‘fixed’ STL files.
Next I take the STL file massaged and scaled by Netfabb and load it into Slic3r.
Slic3r looks at the STL file – which represents the model as triangles in three dimensions – and turns it into G-codes, which are instructions for moving a printing nozzle.
To get this right, Slic3r has to know details about my particular printer (nozzle size, thickness of filament, the temperature I like to use with a certain filament, how many ‘perimeters’ I want round the outside – lots of stuff).
Getting these numbers right, and changing them appropriately when I change filament, for example, is an important part of successful desktop 3D printing. I’ve included screen captures of Slic3r’s two main settings screens in case that is useful to anyone with the same printer components as me.
Next I load the G-code file generated by Slic3R into Pronterface. Pronterface is the program that talks directly to the Arduino microcontroller built into the printer.
Pronterface takes the lines of G-code from the file and transmits them to the printer, where the printer’s firmware – Marlin, in this case – interprets the codes and tells the motors what to do.
Marlin controls the stepper motors, making the print bed zing backwards and forwards, and the nozzle zip from side to side, and up by a quarter of a millimetre (in my case) each level. Marlin also controls how fast the extruder motor pushes the filament into the heated nozzle, and monitors and controls the heat of the nozzle and heatbed.
The physical object
And the end result is another iteration in my raygun design. It printed beautifully, and without warping. I did use fan cooling after the first 10mm or so of vertical height, because the overhangs in the hollow bore were getting floppy.
I’ve included the previous iteration of the raygun in the photo so you can see the increase in decoration, and the difference in scaling that I did in netfabb. Both rayguns are modelled with exactly the same dimensions in OpenSCAD, but I had reduced the earlier print to a quarter of full size, while I only reduced the new print to half full size.
Modular Vs Parametric
The raygun is not in any way modular yet – I can’t choose which of two barrel decorations to apply, or what grip design to use.
But it is ‘parametric’, which means that many of the design measurements are calculated automatically. If I choose to make the barrel dimension smaller, or longer, everything else recalculates to keep the same basic relationships. If I want an extra ring around the barrel, I copy and paste one line of code and change one number. And if I don’t want any finger cutouts in the grip, I can do it by adding a single character to the file
Ultimately my goal is to have a single OpenSCAD file containing multiple optional and scalable components, and simple compile-time options to choose between them.