Hi. Today I learned that using ChatGPT to generate 3D models in OpenSCAD works fine for some simple shapes that could be 3D printed. This could be useful for temporary parts or simpler parts to save design time and also if you don’t know how to draw 3D otherwise. Eg:

« Using BOSL2 and OpenSCAD, make a code for a shape that is half a pyramid, divided diagonally at the base and vertically. The base sides are 10 cm and the walls as 45 degrees relative to vertical. »

```
use <BOSL2/std.scad>;
use <BOSL2/transforms.scad>;
use <BOSL2/shapes.scad>;
// Parameters
base_side = 100; // 10 cm
height = base_side * sqrt(2) / 2; // Height of the pyramid such that the walls are at 45 degrees
// Full Pyramid
module fullPyramid() {
pyramid(base=base_side, height=height);
}
// Half Pyramid, sliced diagonally and vertically
module halfPyramid() {
intersection() {
// Full pyramid
fullPyramid();
// Diagonal plane cut
mirror([1, 0, 0])
linear_extrude(height = height + 10)
polygon(points=[[0, 0], [base_side, 0], [0, base_side]]);
// Vertical plane cut
translate([-1, base_side/2, 0])
cube([2, base_side, height + 10]);
}
}
// Render the half pyramid
halfPyramid();
```

Then

```
WARNING: Ignoring unknown module 'pyramid' in file halfpyramid_chatgpt.scad, line 11
```

“The module pyramid does not exist. Repace it with a cuboid with chamfer equal to the height minus a small number”

Ok, that failed. miserably. But trying an easier shape:

“make a cylindrical candle holder with base radius 5 cm, to radius 3 cm, and a 15 mm deep hole for the candle, diameter 2 cm.”

Ugh, still not what I wanted…

“make the candleHole 15 cm high and remove the redering section at the end”

Doh!

“The candleHolderShape should only be 10 cm high while the candleHole should be aligned to the bottom of the cylinder.”

```
$fn = 100; // Increase for smoother shapes
// Parameters for the candle holder
base_radius = 50; // 5 cm
top_radius = 30; // 3 cm
holder_height = 100; // Height of the candle holder is 10 cm
hole_height = 150; // Height of the candle hole is 15 cm
hole_diameter = 20; // Diameter of the candle hole is 2 cm
// Outer shape of the candle holder (truncated cone)
module candleHolderShape() {
cylinder(h = holder_height, r1 = base_radius, r2 = top_radius);
}
// Hole for the candle
module candleHole() {
translate([0, 0, 0]) // Align the bottom of the hole with the bottom of the holder
cylinder(h = hole_height, r = hole_diameter / 2, center = false);
}
// Assemble the candle holder
difference() {
candleHolderShape();
candleHole();
}
```

Anyways, the designs are pretty close. But if you are saving time or not, who knows.

I was not being ironic here, just turned out the examples I chose were too optimistic.