OpenSCAD the Programmers Solid 3D CAD Modeller

(openscad.org)

41 points | by b-man 3 days ago

18 comments

  • erjiang 1 hour ago
    Be 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.)

    • jacquesm 40 minutes ago
      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.
      • jeffbarr 32 minutes ago
        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).
        • jacquesm 28 minutes ago
          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.
    • Palomides 1 hour ago
      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.
      • WillAdams 59 minutes ago
        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.

        • jacquesm 33 minutes ago
          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.

        • RobotToaster 53 minutes ago
          On the bright side it refreshed my knowledge of trigonometry...
      • iririririr 59 minutes ago
        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)

    • YuechenLi 36 minutes ago
      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.
    • the__alchemist 57 minutes ago
      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.
      • MegaDeKay 50 minutes ago
        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

        • happyPersonR 24 minutes ago
          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.

        • the__alchemist 45 minutes ago
          Ty! I will give it a shot. I last did 2 years ago.
  • tylermarques 20 minutes ago
    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

  • YuechenLi 48 minutes 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.

    https://github.com/yuechen-li-dev/helioscad

    • SOLAR_FIELDS 38 minutes ago
      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.
      • YuechenLi 18 minutes ago
        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.

        • rao-v 1 minute ago
          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.

  • jeffbarr 40 minutes ago
    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.

  • jacquesm 1 hour ago
    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.

    • RobotToaster 49 minutes ago
      > 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.

  • bee_rider 26 minutes ago
    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?

  • WillAdams 56 minutes ago
    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:

    https://pythonscad.org/

  • TGower 1 hour ago
    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...

    • exitb 19 minutes ago
      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.
    • kevin_thibedeau 1 hour ago
      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.
      • TGower 1 hour ago
        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.

  • RobotToaster 1 hour ago
    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.
  • looofooo0 1 hour ago
    Yes, also have a look at build123d which has a vscode plugin.
    • kelchm 1 hour ago
      I second this -- I much prefer build123d to OpenSCAD.
  • matthova 1 hour ago
    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

  • dvh 1 hour ago
    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.

  • aeonik 31 minutes ago
    BOSL2 library combined with LLMs really make me fly with my creations.
  • joewalnes 1 hour ago
    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.

  • kennywinker 1 hour ago
    If you want openscad without the abomination that is the openscad language - check out jscad
  • TacticalCoder 1 hour ago
    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.

    • kens 1 hour ago
      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.
  • pdntspa 1 hour ago
    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...
  • asmodeuslucifer 51 minutes ago
    I barely know openscad (used Fusion 360 before autodesk enshitified it) but gemini is very good at creating code I can paste into openscad.