ChatGPT wrote OpenSCAD code? See it, fix it, print it
Ask ChatGPT — or Claude, Gemini, Copilot — for a 3D-printable part and you usually get OpenSCAD code, not a file. Paste that code here. Real OpenSCAD renders it in your browser in about a second, shows any error with its line number so you can paste it straight back into the chat, turns the sizes into sliders and exports an STL for your slicer. No install, no sign-up.
Chat assistants write text, and OpenSCAD describes a 3D model as text, so it is how they usually answer “make me a 3D model”. The code still has to run in OpenSCAD to become a shape, and the assistant never sees that shape — which is why the first version is often a little off. This page is the missing step: see the part, then tell the assistant exactly what to change.
From chat to printed part
01
Ask for OpenSCAD
Say what the part is for and give the key sizes in millimetres. Ask for every size as a variable at the top — the prompt below does that — so you can adjust it without another round trip.
02
Paste it here
Open the viewer and paste the code into the editor, or ask the assistant for a preview link and click it. The model renders half a second after the code changes.
03
Fix what's off
Errors and warnings appear under the editor with their line number, like model.scad:12:5. Copy them into the chat as they are, or say what looks wrong: “the hook is 10 mm too high”.
04
Tune it with sliders
Variables with Customizer comments become sliders and drop-downs. Moving one rewrites that value in the code, so the version you print is the version you can paste back.
05
Export STL
One click saves a binary STL of exactly what is on screen for PrusaSlicer, Cura, OrcaSlicer or Bambu Studio. Need it in CAD software? Export STEP from the same page.
A prompt that gets printable OpenSCAD
Copy it into the chat and fill in the blank. Every line is there for a reason: millimetres, sliders, one solid flat on the bed, and no made-up helpers.
Write OpenSCAD code for ___.
- Units are millimetres.
- Put every size in a variable at the top with a Customizer comment, e.g. width = 60; // [20:1:150]
- One solid that sits flat on the print bed at z = 0; avoid overhangs that need supports.
- Plain OpenSCAD only: no libraries, and no modules you have not defined in the code.
- Optional: give me a Forgent3D preview link, https://app.forgent3d.com/scad#code=<the code, encodeURIComponent-encoded>
An example in that style
A phone stand written that way: sizes at the top, grouped for the Customizer. Open it, drag the sliders, export the STL.
// Phone stand. Every size is a variable at the top with a
// Customizer comment, so it shows up as a slider. Drag them.
/* [Stand] */
// Back-rest angle from the desk (degrees)
angle = 65; // [50:1:80]
// Stand width
width = 70; // [50:5:120]
// Wall thickness
wall = 4; // [3:0.5:8]
/* [Phone] */
// Phone thickness, case included
phone = 12; // [6:0.5:20]
// Height of the front lip
lip = 10; // [4:1:20]
/* [Hidden] */
depth = 80;
rest = 90;
notch = 16;
foot = depth * 0.35;
difference() {
union() {
cube([depth, width, wall]); // base
translate([foot, 0, 0]) rotate([0, 90 - angle, 0]) translate([-wall, 0, 0]) cube([wall, width, rest]); // back rest
translate([foot - phone - wall, 0, 0]) cube([wall, width, wall + lip]); // front lip
}
// charging-cable notch in the lip
translate([foot - phone - wall - 1, (width - notch) / 2, wall]) cube([wall + 2, notch, lip + 1]);
}
AI-written OpenSCAD goes wrong in a handful of familiar ways. Here is what you will see and what to tell the assistant.
“Ignoring unknown module” — or a part is missing
The code calls something plain OpenSCAD doesn't have: rounded_cube(), fillet() and similar helpers are often made up. The warning names the line. Ask the assistant to build that part from cube(), cylinder(), hull() or minkowski() instead.
A library function isn't found
BOSL2 and MCAD are built in, but the code still has to load them: cuboid() needs include <BOSL2/std.scad> at the top. If that line is missing, add it.
Parts float, overlap or point the wrong way
Usually a translate() or rotate() with the wrong sign or axis. Turn the view to find the part, then say where it is and where it should be: “the hook sits 10 mm above the plate and faces backwards”.
“… was assigned on line … but was overwritten”
OpenSCAD keeps the last assignment of a variable in each scope, and loops do not update it the way Python does. Ask for the value to be computed directly, with a function or a list comprehension.
Rendering takes forever
minkowski() and a high $fn multiply the work. Press Stop, lower $fn while you iterate, and raise it again just before you export.
Rather describe the part than debug code?
ChatGPT writes OpenSCAD without ever seeing the result. Forgent3D's AI CAD agent builds the part, measures it and looks at snapshots of it before you see it, then gives you an editable parametric model with STEP and STL export. It writes its own CAD code, not OpenSCAD.
In a normal chat it answers with code. With code execution it can sometimes write an STL through Python, but you still can't see the part before you download it. OpenSCAD code plus this viewer lets you see it, adjust it and export again in seconds.
Does it work with code from Claude, Gemini, Copilot or DeepSeek?
Yes. It runs any OpenSCAD code, whoever wrote it.
Is my code sent anywhere?
No. OpenSCAD runs inside your browser; code in a #code= link stays in the browser too.
Which version of OpenSCAD runs the code?
A 2025 development snapshot of OpenSCAD with the Manifold geometry kernel, compiled to WebAssembly. MCAD, BOSL2 and Write.scad are built in.
Can it change the model for me?
This page shows and exports what the code makes; to change it, edit the code or paste your request back into the chat. Forgent3D's AI CAD agent can build parts from a description, but it writes its own CAD code rather than OpenSCAD.