AI assisted 3D printing

I’d like to share an anecdote which highlights why I find generative AI useful as a way of quickly being able to validate an idea or an approach.  I’ve recently been looking into replacing some small glass lampshades which I may have accidentally broken, and then broken some more whilst trying to glue them back together.  When they are not shattered and clumsily reassembled, this is what they look like:

Pristine lampshade, prior to impact with ground

Employing my usual strategy of scouring Ebay and Etsy for suitable replacements didn’t turn up anything useful.  I was able to determine that these glass lampshades were cut from a long tube of borosilicate glass, and based on this information I was able to find a supplier, who could provide the glass and even cut it to the required length – which would avoid me injuring myself, but would cost £100.

Having recently been exposed to a series of Tiktoks by Scott Hanselman expounding the value of owning a 3D printer, I wondered if it would be possible to 3D print some replacements.  I don’t have a 3D printer (yet), and I don’t know much about 3D printing, other than Scott thinks it is cool, and it does look pretty cool.  I thought it should be possible, but I didn’t really know how well it would turn out, and there were some non-functional requirements around thermal stability (i.e. is it going to melt) that I was interested in bottoming out.

I found a number of companies online who will print STL files in a range of materials, so now all I needed to do was generate the STL file.  A brief search on Reddit  suggested that for this type of model, a parametric design tool would be most appropriate – So I downloaded OpenScad and set to work.  I could have spent the next couple of hours learning the language and writing my scad file, but as I just wanted to see if it could be done as quickly as possible, I asked ChatGPT:

“Please can you help me create an openscad file for the following object: A hollow cylinder, with 20 circular cutouts around the inner edge. The cutouts should run the entire height of the cylinder.”

The response was encouraging:

// Parameters
$fn=100;                   // Setting high facet count for smooth curves
outer_radius = 40;         // Outer radius of the base circle
inner_radius = 35;         // Inner radius of the base circle
height = 100;              // Height of the extrusion
cutout_radius = 2;         // Radius of the circular cutouts
num_cutouts = 20;          // Number of cutouts

module cutout_pattern() {
    difference() {
        // Outer circle
        circle(r = outer_radius);
        // Inner circle to create hollow space
        circle(r = inner_radius);
        // Cutouts placed around the inner circle
        for (i = [0:num_cutouts-1]) {
            rotate([0, 0, i * 360 / num_cutouts]) {
                translate([inner_radius, 0, 0]) {
                    circle(r = cutout_radius);

// Extrude the 2D pattern to create a 3D object
linear_extrude(height = height, center = true) {

Tweaking the parameters so it was the correct size, and rendering it gave me:

Openscad rendering of AI designed lampshade

Not bad! I uploaded this to, and a couple of days later this arrived in the post:

3D printed lampshade in situ – it is the one on the right, I will probably replace them all

It cost about £3 to print, shipping was extra.  It looks pretty good in the lamp, and doesn’t melt with the 1.5W LED bulbs, so that’s my MVP! 

I did a fair amount of experimentation afterwards, trying my own designs, initially with ChatGPT, then increasingly more without it, as I became more confident in the tooling and the benefit of using Generative AI over coding it myself began to diminish.  I learnt why I should use $fa and $fs over globally setting $fn, I watched a series of introductory videos on Autodesk Fusion because I wanted to experiment interactively when modelling – all safe in the knowledge that I was spending my time on something I knew worked end to end. 

Honeycomb inside FTW, because Hexagons are the Bestigons

This is why Generative AI is so useful – I could definitely have written the Openscad file myself but not knowing how to was a barrier.  Being able to get from a textual description of a model, to a visualisation in a matter of minutes, to an actual object in days allowed me to validate the approach really quickly, without having to learn much at all. I think this is similar to product development – Generative AI may or may not be part of the solution, but it can certainly help you get there quicker.