3D Modeling with ChatGPT

tl;dr: ChatGPT can do a pretty okay job writing SCAD code with a little help.

I’ve got a basement with one single cold air vent in the whole 1800ft area. That sucks.

I decided to run a portable air conditioner to one of the windows, since the windows have window wells and a more efficient window unit wouldn’t work. In order to keep hot air from pooling in the window well and then being sucked back in, I contacted Window Well Experts and had a well cover custom made with a vent hole on it.

However, just because I have a well cover doesn’t mean I want to leave the window itself open for the tube to run up to the well cover. I’d like to use the panel that keeps the window sealed and allows the AC hose to ventilate. The issue is, I want the hose to continue on the other side of the panel, up to the well cover. On top of that, the hose from the AC unit is a 5.9 inch hose, and the vent holes offered by Window Well Experts are standard 4 inch dryer vent holes.

I decided that instead of cutting a custom panel or spending money or time on adapters, I’d try to 3D print something I could just bolt onto the other end of the panel to connect the 4″ hose. I didn’t find any designs to do this, and I wasn’t feeling keen on spending my Saturday night in Catia, so I decided to see if I could get ChatGPT to do it for me with SCAD code.

It worked! After about twenty minutes of back-and-forth, ChatGPT (GPT-4) produced this design:

The Final Result

Here’s the code, for anyone who’s interested in what it generated and how it works:

wall_thickness = 3; protrusion_length = 50; taper_length = 30; screw_hole_radius = 6/2; flange_thickness = 5; flange_size = 15; // flange size in mm module adapter() { difference() { // exterior part union() { hull() { translate([0, 0, flange_thickness]) linear_extrude(height = taper_length) offset(r = 10) square([210 - 10, 75 - 10], center = true); translate([0, 0, taper_length + flange_thickness]) cylinder(h=taper_length, d=101.6, $fn=50); } translate([0, 0, 2*taper_length + flange_thickness]) cylinder(h=protrusion_length, d=101.6, $fn=50); } // interior part translate([0, 0, flange_thickness]) union() { hull() { translate([0, 0, 0]) linear_extrude(height = taper_length) offset(r = 10) square([210 - 10 - 2*wall_thickness, 75 - 10 - 2*wall_thickness], center = true); translate([0, 0, taper_length]) cylinder(h=taper_length, d=101.6 - 2*wall_thickness, $fn=50); } translate([0, 0, 2*taper_length]) cylinder(h=protrusion_length, d=101.6 - 2*wall_thickness, $fn=50); } } } module flange() { difference() { // create the flange linear_extrude(height = flange_thickness) offset(r = 10) square([210 - 20 + 2*flange_size, 75 - 20 + 2*flange_size], center = true); // create holes for the screws for (i = [0:3]) { rotate([0, 0, i*90]) translate([(210 + flange_size+3)/2, 0, -1]) cylinder(h=flange_thickness + 2, d=2*screw_hole_radius, $fn=50); } // cut out the middle part of the flange linear_extrude(height = flange_thickness + 2) offset(r = 10) square([210 - 20, 75 - 20], center = true); } } union() { adapter(); flange(); }
Code language: PHP (php)