OpenSCAD the Programmers Solid 3D CAD Modeller
openscad.orgBe aware that the way OpenSCAD works (CSG) makes a lot of things difficult compared to "normal" CAD programs. A lot of common operations, such as arbitrary fillets on various edges, are simply hard to express or do.
The more powerful option is something built on the open-source Open Cascade geometry kernel: FreeCAD, cadquery, or build123d. This also gives you interop with the broader CAD ecosystem by enabling you to import and export STEP files. (Your favorite LLM can advise you on or drive these options as well.)
That's because you are thinking in the way you would with conventional cad systems, you are doing your operations sequentially a bit like a sculptor would: take a blank and then remove bits piece by piece. The trick to working effectively with OpenSCAD is to generate what you want, not to iteratively chip away at something.
I have found that a combination of the two approaches works best for me. In some cases it is easiest and most practical to combine (union) shapes to get to what you want, and in others it easiest to subtract (difference or intersect).
But then you won't be able to bevel complex shapes at all, which means that you won't be able to describe the object that you will end up with. "Good" CAD means that the representation in the computer is as close to the object you want to produce as you can make it. This makes it possible for downstream systems to accurately select nozzles and toolheads to get you what you want. If you produce an impossible object then your slicer or path computer will give you an approximation. That can be fine in some cases but usually your objects need to mate and if you mate two approximations you'll find quickly that that does not really work.
to be a bit tautological, openscad is nice but only for the things openscad is nice for. I prefer freecad for almost everything except highly parametric shapes. Plus you can do openscad inside of freecad.
The great thing about OpenSCAD is that it makes modeling using cubes, spheres, cylinders, and placing or stretching them mathematically easy.
The awful thing about OpenSCAD is that one's capabilities in it are bounded by one's fluency in using math to place or stretch cubes, spheres, and cylinders.
I suck at math but I can do pretty neat stuff with OpenSCAD that would take me 10x longer with 'the usual suspects' in CADland. It took me a while to get the hang of it though, I think the bigger issue with using OpenSCAD is a shift of perspective. From the outside it looks like solid modeling with primitives, but once you 'get it' the method changes completely, it is probably easier to explain with an example:
If you want to make a complex gear that has to mate with another gear you can do this in two ways: you can start with two discs intersecting at the right angle and then to chop out the teeth so the resulting object will be a gear and then you could subtract via a similar operation from the other disc to end up with two mating gears.
The - in my view much more effecient - alternative is to start off with just the supports as the discs and then to parametrically add the gear teeth onto the supports taking into account all of the clearances and the contact faces. This will get you much better gears because you are parametrically describing the surfaces that really matter and it will allow you to do nice things such as small fillets on everything to make the object far closer to what eventually will roll out of your manufacturing process (machining, 3D printing). It is a bit more work to define all of the parameters but the end result is much better and far less likely to have imperfections because you are generating what you want, not removing what you don't want. OpenSCAD can be used for sculpting, but that's not the best way of using it.
On the bright side it refreshed my knowledge of trigonometry...
i did ton of projects in open scad in the past (8+yrs ago), even having access to freecad and solidworks. I was even sending patches to some 2d features on freecad.
but what made me use scad was reliability. i knew the time i put writting in vim would translate (heh) into a viable stl file i could send to manufacturing. while with both other options half the time was dealing with bugs and crashes and bad exports.
but how did i miss some convenience tools indeed. most could be solved with opensource methods (e.g. bevel, joiners with easing, threads)
To be fair, arbitrary fillets/blends on edges is a hard problem in general for Parasolid/ACIS because you are trying to mutate arbitrary topology, essentially guessing vertices/edges/faces and trying to stitch the back together.
This is true, but in things like OnShape I can do it with two clicks whereas in OpenSCAD it's always at least 20 minutes of thinking and trying out.
OpenSCAD is super cool and my go-to for simple things, but for anything more involved than a cube or cylinder with some cutouts I tend to revert to "normal" CAD programs.
Concur. It's worth explaining this, as someone new to CAD would get the impression the various tools in CAD are on even ground, and may assume "I know programming, so OpenSCAD sounds like the right choice". I would love some day for programmatic and/or free/cheap CAD to be competitive, but we're not there. Solidworks, Fusion, Inventor etc still outclass FreeCAD, which outclasses OpenSCAD.
I agree with your ordering of the various programs out there but FreeCAD 26.3 is now available as a release candidate with a wonderful collection of improvements. I'd think for many people, FreeCAD is now "good enough" for a lot of things. I'm building a virtual pinball cabinet and the whole thing is modeled in FreeCAD.
Mango Jelly's overview of some of the biggest new features: https://www.youtube.com/watch?v=WdTyFHY-5r4
The mcp integration may be seen as both a blessing and a curse but tbh, it’s very interesting :) and hopefully as folks post and comment on more models that are generated with it, we can get a better training set.
I actually still use the freecad gui because it’s cheaper but I can totally see how someone new might just wanna use the MCP.
Ty! I will give it a shot. I last did 2 years ago.
Oh, since this came up, for people who like code CAD and want to try something more powerful than OpenSCAD:
https://github.com/yuechen-li-dev/Aetheris/
Not an OpenCascade wrapper, it's based off my own experimental BREP geometry kernel. So, fillets/chamfers work, booleans works fairly robustly, surfacing, sheet metal, etc all works decently, it exports STEP AP242 by default.
Haven't had time to get the AIs to write a more up to date documentation and polish the language server. Not the easiest thing to use right now, so, using it through Codex/Claude Code or CLI is probably the easiest way to get started.
Still working on the webUI currently, in case someone want to DIY the UI. Note that the WASM compilation path is still unoptimized and way slower than the RyuJIT C# compilation though.
Not even two years ago writing your own BREP kernel was considered to be out of reach for even the most determined dedicated hardcore engineering teams that weren't extremely well funded. Now, it seems tractable and may finally get us out of the dependence on proprietary kernels that has plagued this industry for decades.
Yeah, I know. I started this project earlier this year because of my own frustration with the software ecosystem and that the major CAD vendors is charging thousands of dollar to add STEP 242 support and because of proprietary lock-in and locking everything behind cloud, and was trying to see if I can accomplish this with AI.
I'm not going to pretend this is easy: I actually quit multiple times for this project because I ran into the same walls that everyone else ran to: arbitrary 3D boolean operations is HARD,(Surprisingly, I actually didn't have that much trouble with fillets/chamfers because I kept them pretty bounded) and the approach I've finally taken to solve it is pretty insane. Essentially, the final architecture is more like "LLVM for 3D objects" compiler stack than it is traditional BREP kernel. Would love to talk about the technical deep dives if people want to hear it.
Also, feel free to write UI wrappers around it, because I'm pretty bad at UI design myself.
Given modern capabilities how hard would it be to make a really high quality stl to STEP converter that works well on CAD models that have been converted to STL?
It doesn’t need to be perfect on edge cases just translate back “reasonable” models.
Should be something that is fairly easy to eval etc.
Near impossible to do it robustly without AI, since a mesh is a blob of triangles and vertices, it doesn't really know if something is a "face" or an "edge", and mesh STL -> BREP STEP is akin to decompilation from binary than it is a simple translation. So, the most robust approach is to get a human/LLM to reconstruct the STEP file from the STL/OBJ/glTF file with a BREP kernel.
I wish there was an easier way, but I've spent weeks during the course of the project working on and failing to solve a similar problem (SDF to BREP) and concluded finally that there just isn't an easier way to do this fully automated without AI.
You can ask your LLM to try it with one of the OCCT wrappers or with my thing, I think Aetheris is slightly better because we added more STEP diagnostic tools like ray query depth detection and SVG sectional view during the course of development.
The one you want is the experimental build, it is way faster to the point that 'preview mode' should be disabled. I use OpenSCAD a lot, it ties right into my workflow and plays nice with versioning and re-using modules from one project to another. Over time I've built up a nice library of parts that I can quickly customize for whatever it is that I'm building. Latest project: pick-and-place machine modification for Prusa MK3 3D printers (an interesting challenge, to put it mildly), now working on some robotics stuff.
The most important thing about OpenSCAD for programmers to remember is that it looks as if you are programming but really you are describing geometry and objects so things like variables and such do not quite work in the way you would expect from a programmers point of view.
> things like variables and such do not quite work in the way you would expect from a programmers point of view.
I'm a novice at OpenSCAD still despite doing a bunch of small projects with it recently. Can you give an example of this happening? Most of the confusing stuff so far has been geometry breaking my brain and not some kind of scope issue.
> The most important thing about OpenSCAD for programmers to remember is that it looks as if you are programming but really you are describing geometry and objects so things like variables and such do not quite work in the way you would expect from a programmers point of view.
To put it another way, it's a purely functional language in a very strict way that takes some getting used to.
Look into OpenPNP. Most of the PnP work is already done (vision, motion, feeders, etc). Just a matter of making the Prusa frame react to the commands.
That's what I'm running.
Nice. I have been following the project since the beginning (I work with the Smoothieware project which was used primarily in the beginning).
Some of the things developed in the project I used to modify my commercial PnP to use the Siemens feeders (Bilsef's controller board). [1]
So a project that came from our project is being used to mod my machine to make more boards for the original project :) Circle of opensource.
If you have any posts related to your mods that you can share I would like to read them to see more about what people are doing.
[1] https://www.robosprout.com/a-story-of-right-to-repair-hackin...
I made the machine to help me assemble a bunch of boards for my electronics minded child, essentially a gridfinity based set of building blocks for electronics circuits. It works very well and he's totally happy with it. It also got him into building stuff with the Micro-Bit. My eyesight sucks and working with SMD parts is really tricky for me so I figure better to let one of my many Prusa's be the sacrificial lamb. Worked like a charm but it is not a build that I would recommend to others, there are just too many places where the 3D printer setup is fighting what would be good for pick-and-place. The best - and probably most reusable - bit to come out of it was a 3D printed nozzle that will pick up anything from 0402 to very large parts without a nozzle change.
For these eternal Fillet-Whiners: Antigravity made simple Blender-tool that rounds all edges in STL-file. Sharp edges never look good in print and avoiding them feels often like too much extra work.
I have been using OpenSCAD to create cool geometric designs for 3D printing on fabric, with great results. The functional model is likely unfamiliar to most developers, but I have found that I can be efficient and productive with it.
Check out my repos of OpenSCAD objects at https://github.com/jeffbarr/OpenSCADObjects and Truchet Tilings at https://github.com/jeffbarr/TruchetTilings .
My code kind of looks like the C that I wrote in the 1980s, with lots of braces and careful indenting -- not sure if that is a bug or a feature.
As another commenter noted, use the latest nightly build for best results.
I tried OpenSCAD but it ends up being too abstract and hard to maintain for me and like others it does not solve fillets/procedural selection well.
So here is my shameless plug "sograph": https://imgur.com/a/u1n2Grg
I should consider a Show HN instead, but it is too early to release yet.
Shamelss plug:
I have built FluidCAD[1] to overcome the issues of CAD by code, less mental effort to design by providing visual guidance. Slowly it became more of a hybrid CAD experience (mouse or code driven), almost all features now can be done by mouse and the code is generated for you. It'll pick the right selection filters for you.
One of my favourite tools.
As noted, use the Nightly builds from: https://openscad.org/downloads.html#snapshots
When working with kids, it's well worth keeping: https://www.blockscad3d.com/editor/ in mind, or for folks who like to draw connections: https://github.com/derkork/openscad-graph-editor
Eventually, someone will note that its programming model limits variables and so forth --- for folks who want a more traditional language choice there are a number of options, notably for Python:
I've been using Opus 5.5 to write openscad models for me for the past week, with great success. I wanted to expand the project Open Source Watch Winder [0] to have 8 watches, with gears instead of pulleys, and in little back and forth I have a version I've started printing. [1]
[0] https://github.com/mwood77/osww [1] https://imgur.com/a/bWent0K
It would be interesting to see a head to head comparison of frontier LLMs building models with OpenSCAD, Blender scripting, and Fusion MCP. My intuition would be that blender winds up the best for the immediate result due to training data prevalence and RL tuning, but the concise nature of OpenSCAD could help.
I'll have to add this to my backlog of experiments to try when I have unused tokens near a reset...
Blender gives you a mesh that isn't parameterized. Not particularly useful for making dimensional changes outside of eyeballing everything. An LLM isn't going to reliably hit your dimension targets so tweaks will be necessary.
Yeah, that's what I meant by "immediate result", if you need to edit the generated model by hand it will be hard to beat having the model and timeline available in Fusion after using Fusion MCP.
If you just need to tweak the dimensions in the script, or are satisfied with describing the changes to the LLM and having it modify the script, there isn't much difference in practice between a generated OpenSCAD script and a Blender python script.
I created an (unpublished) MCP for a CAD that didn’t have one before and LLMs are just fine at it. It looks like they can apply their higher level training across interfaces.
I use openscad for all my kicad 3d models via scad->off->obj->(manually edit in mm3d to add colors)->wrl->kicad
It's not as bad as it looks, it's all automatic except adding colors which takes about 2 minutes.
Yes, also have a look at build123d which has a vscode plugin.
I second this -- I much prefer build123d to OpenSCAD.
Note that the current release version is very old, I strongly recommend downloading the nightly version and turning on the manifold geometry solver in settings as it's much faster.
How does OpenSCAD type stuff play with simulation, in general. (If at all?)
I’m thinking of something like finite element analysis… but, I guess since the shapes in OpenSCAD are defined through this constructive geometry system, can things be better/more mathematically defined general purpose “discretize the PDEs over my mesh” type solutions?
Normal finite elemts does not care. The mesh ist just put on your 3d body that can be an stl or a step or whatever. The FEM only knows the nodes and nothing else. The mesh geometry is completely separate from the CAD file.
Now there is a method called Isogeometric Analysis (IGA) that was meant to improve this. It uses NURBS functions (just like CAD) for the shape functions of traditional FEM. The idea was that now, if you have NURBS describing the CAD geometry you can skip meshing and just directly calculate on the real geometry. But it did not catch on. The reason being basically, as far as I remember, was that most CAD geometries of interest are not pure NURBS. But they are operations of NURBS (think cube minus some other cube - trimmed surfaces). And IGA has problems with that.
This is a problem that openSCAD will probably also not be able to overcome. Maybe at times it might be easier to create NURBS geometries without trimmed surfaces. But most probably that cannot be done in most cases of real world significance.
Ah, that makes sense. I think Isogeometric Analysis was the idea I was circling (the though process being “of course you can always export to a mesh, but the OpenSCAD model seems to encode more designer intent so why not use that for simulations directly”). I’ll have to read up on what was tried and why it didn’t catch on. Thanks!
I love OpenSCAD. Have been a power user for years. It's so great asking LLMs to make 3d models in openscad.
I made a rust-implementation of openscad called openrscad (https://openrscad.com). It still has some rough edges, but runs quite fast both on desktop and in the browser
Does it have rust versions of the full stack of libraries like Agnis Johnson's Clipper, etc? How compatible is the kernel with CGAL Rational?
Seconded. OpenSCAD is a bit tedious to use from scratch but claude is pretty decent at generating the code. It can't render the script though so it tends to make silly mistakes
Wrote a tutorial:
https://github.com/joewalnes/toybrick
LLMs are excellent at building OpenSCAD models. The tutorial (written in the before-times) will help understanding of the key concepts of OpenSCAD: primitives, transformations, and constructive solid geometry.
BOSL2 library combined with LLMs really make me fly with my creations.
If you want openscad without the abomination that is the openscad language - check out jscad
OpenSCAD is amazing for those who know nothing about 3D but know about programming.
I bought a 3D printer (which is basically simpler and more reliable than a 2D inkjet printer by now: it's send the file, put the filament, and 3D print and it just works) recently and already fixed shitload of stuff around the house with 3D printed parts.
I even did "print in place" pieces where you add a pause a a certain layer, insert "stuff" (like say a 3D metal angle) into your print, then finish your print. Effectively creating parts that are both plastic and metal.
Now the language itself in OpenSCAD is kinda really bad: you can define variables inside of other functions and then use them everywhere. You can redefine already defined variables and you'll get zero warning. The language itself is really pretty WTF.
But you get modelling for free as a programmer. And LLMs are okay'ish at it for simple stuff.
I'd recommend people to use the BOSL2 library for OpenSCAD:
https://github.com/BelfrySCAD/BOSL2/wiki
It's really not hard.
If you love programming and like to DIY stuff around the house, buying a 3D printer and learning some OpenSCAD is a no-brainer.
OpenSCAD ain't the only option: many people like Fusion (for example). But as I'm a dev, OpenSCAD just feels natural to me.
As a programmer, I second this. Systems like Blender are inscrutable to me, but in OpenSCAD I just write some loops. I get what I want and it's easy to tweak.
The nightly builds for this are so much better. When are they going to merge the nightlies into a new mainline release? The last one showing 2021 isn't the best look...
This problem has made me search for other solutions. I need tools that ship.
I barely know openscad (used Fusion 360 before autodesk enshitified it) but gemini is very good at creating code I can paste into openscad.