MicroCAD Programs CAD

We love and hate OpenSCAD. As programmers, we like describing objects we want to 3D print or otherwise model. As programmers, we hate all the strange things about OpenSCAD that make it not like a normal programming language. Maybe µCAD (or Microcad) is the answer. This new entry in the field lets you build things programmatically and is written in Rust.

In fact, the only way to get it right now is to build it from source using cargo. Assuming you already have Rust, that’s not hard. Simply enter: cargo install microcad. If you don’t already have Rust, well, then that’s a problem. However, we did try to build it, and despite having the native library libmanifold available, Rust couldn’t find it. You might have better luck.

You can get a feel for the language by going through one of the tutorials, like the one for building a LEGO-like shape. Here’s a bit of code from that tutorial:


use std::geo2d::*;
use std::ops::*;

const SPACING = 8mm;

op grid(columns: Integer, rows: Integer) {
@input
.translate(x = [1..columns] * SPACING, y = [1..rows] * SPACING)
.align()
}

sketch Base(
columns: Integer,
rows: Integer,
width: Length,
height: Length
) {
thickness = 1.2mm;
frame = Frame(width, height, thickness);
struts = Ring(outer_d = 6.51mm, inner_d = 4.8mm)
.grid(columns = columns-1, rows = rows-1);
frame | struts;
}

There are proper functions, support for 2D sketches and 3D objects, and even a VSCode extension.

Will you try it? If we can get it to build, we will. Meanwhile, there’s always OpenSCAD. Even TinkerCAD can do some parametric modeling.

40 thoughts on “MicroCAD Programs CAD

    1. Well, some mainstream ai at least does know, but it is difficult to make it follow precisely your direction. It is very helpfull at the intial steps of a compiling system installation, of personal learning, but then, if not a small one and out exercise, if one is fluent, he’d better proceed writing directly.

    2. I detest workbenches as they are an intrusion of physical into the virtual. Unless we can explain a design even a CAD master will fail, “Oh! You meant a mansion for humans? Not one for guinea pigs?” We need both a language and a gestural means of modeling, just as some programming IDEs supported drawing an input screen and adding code or encoding the whole input screen. We must have a way to share and distribute both together as a unit.

      1. Nope, it’s not that simple. You need BREP representation to do “surface dress-up” features such as fillets, chamfers, drafts and face offsets. If it uses a strictly CSG representation then it can only do the aforementioned features (with extra work to convert the surface dressup operators into volumetric subtraction operations in very trivial cases.)
        In more complex cases, such as when you neted tangent propagation across a non-planar wire of edges then you can’t do it by “just coding your own” you’d effectively have to write your own tiny BREP kernel.

    1. Yes! I used SolidPython to drive OpenSCAD but back in 2020 we needed .step output because the CNC people didn’t accept .stl any longer. Then I found CadQuery2.0; it is powerful but sometimes finicky.
      I ended up writing a library and doing CSG :)

  1. It seems to use the same geometry library as OpenSCAD, so it is equally limited in not being able to output true curves to .step. Just a different syntax to make sure you can’t take advantage of the huge amount of already existing OpenSCAD scripts.

    One of the greatest features of OpenSCAD is the quick preview through libopencsg. Does MicroCAD have that?

  2. In their page there’s a blog post saying about a bug stopping builds from working. But from what I could understand, it’s already solved. I’ll try to play with it after work

  3. But cargo’s over-complication and excessive dependencies isn’t a problem because it always just works :)

    I’ve seen a handful of versions of this kind of approach, where the “scripted cad language” is just a regular programming language with a library of useful primitives. I understand the draw of this approach but i’m not interested in it myself. Especially with a moving target like Rust. It makes it too hard to even implicitly standardize the CAD language. The opportunity for whacky and delicate idioms is too large. The demarcation between internal details and user-facing language features is too murky. The ability to fundamentally restructure the rendering pipeline without changing the input language is almost completely eliminated (and has been a huge source of profit lately for OpenSCAD).

    Say what you want about OpenSCAD, but even though i have a few models that rely on relatively new versions of openscad…all my old models still build with the newest version. I like that.

    The longer i use it, the less i chafe against its limits…they’re odd at first but ultimately not that hard for me to work around. I’m demonstrating my attachment to the tool i know over the tool i don’t :)

    1. Nah, all of these “openSCAD but with better syntax” proiects are a waste of time better spent making OCCT actually usable.

      Build123D is the ONLY one that actually justifies its existence because they realized openSCAD doesnt only suffer from a syntax problem, it suffers from a representation problem. B123D lets you have both feature stack modelling AND CSG tree modelling, and, crucially, you can combine both these workflows.

      1. I wouldn’t say it’s a waste of time even if it doesn’t solve that problem. Having crates like these in the rust ecosystem is a huge win. I would probably be terrified to look at the source for openscad, this, I’d at least be able to assess the code.

        Anyway I think this is a great project and I’m looking forward to following it and seeing how it progresses. I wonder if it can do 2d cad and further how hard it would be to export to svg

  4. As a programmer, I quickly ran into limitations with OpenSCAD. It really got bogged down on more complex models. Granted, that was over a decade ago, so I don’t know if that got fixed or not. I switched to using a parametric CAD program (Fusion for a while, but have tried FreeCAD over the years, and start switching over completely since the 1.0 release). If I really wanted to go back to programming my CAD models, I would just use Python inside of FreeCAD to do it.

    1. If you’re complaining about openscad’s execution time, progress has been mixed. Debian still comes with openscad 2021.01, which i would describe as generally dog slow. So i recently installed 2025.01, which is much faster on my more complicated models. But unfortunately it crashes on some. So i keep both around, and i change my makefile to the newer version whenever i am impatient with a specific model. I assume openscad development is on the cusp of solving these problems but i don’t keep on top of it.

  5. I love OpenScad language. It is clean descriptive and functional. I programmed in Python before Openscad and yearned for some imperative language features but “let” in functions and comphensions but now I dont. That you cant re-assign variables took a bit of getting used to but now I think it is probably a good thing. Functions can be recursive.

    What would I like? 1. More introspection. 2, Modules are not functions and geometry is just a “side effect”. I would be great if modules returned geometry but something like this is in the BOSL2 library.

  6. I am both a programmer and a language designer who doesn’t hate OpenSCAD. The very first time I used it, I was able to quickly build a pretty cool, fully parametric model, “rigging” that my son used for his animation project. The model was both dramatically more complicated and more convenient to write than I would have been able to do using parametric CAD software like SolidWorks. What is important to note is that OpenSCAD is a representation language not a programming language. You write “functions” that are more like macros, and these get “macro-expanded” into your 3D model with just enough ability to computate dimensions, solids, and coordinate frames along the way. Sure, I silently griped a bit while I was building my model, but if I had to do it again, I’d use OpenSCAD before I’d ever consider ramping up on a WYSIWYG CAD program again. Too much to learn, too little time.

  7. Been working on an early stage BREP kernel my self. https://github.com/mmiscool/BREP
    I can’t live with modeling that dose not have faces and edges. Using the manifold 3d library in that also. For doing all the boolean operations. Works great. I had to make my own abstractions for the rest of it to have proper faces and edges. Also been working on doing fillets on meshes. Getting surprising good results.

  8. OpenSCAD is not a “programming language”, it is just a definition of closed space in predicate logic. Turning OpenSCAD into programming language is hobby of many, and this iteration is not much different.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.