CAD, From Scratch: MakerCAD

It’s likely that many of you use some form of CAD package, but how many of you have decided you didn’t like the software on offer? [Marcus Wu] did, and instead of griping, he wrote his own CAD software. It’s called MakerCAD, it’s published under an MIT licence, and you can try it yourself.

It’s written in Go, and it’s superficially similar to OpenSCAD in that the interface is through code. The similarity is skin deep though, as it provides the user with constraint solving as described in the video below the break.

As it stands it’s by no means feature complete, but it is now at a point at which it can be evaluated. Simple models can be created and exported as STEP files, so it can be used as a real-world CAD tool.

Whether it will flourish is down to the path it takes and how its community guides it. But we’re pleased to see any new open source projects in this space, which remains overly dominated by proprietary packages. If you try it, write up your experiences, we’d love to see how this develops.

14 thoughts on “CAD, From Scratch: MakerCAD

  1. Nice to see some normal design goals. Still insufficient for me and OpenCASCADE is a road to hell :)
    That’s why I’m working on my own code CAD based on SymPy and Manifold3D.
    Pros:
    – You can have free variables and use expression everywhere, not just in constraints. Constraints are just specific form of equations with prepared helpers/ctors.
    – Manifold3D library is infinitely times more robust than OpenCASCADE.
    – Model parts do not have to constitute DAG and are built at once (if there is exactly one solution) unless you want to reference some part of drawn geometry i.e. of result and use it for more computations/drawings, see below in cons:
    Cons:
    – No geometric primitives in result, no faces, lines, just mesh. But I’ll be giving it an ability to look for such features when you can’t provide their analytical model because it’s hard or because it is imported as mesh in a first place… Think “measuring tool” in modern slicers. This breaks models into multiple individual drawings which need to constitute DAG and each such drawing needs to have exactly one solution for free variables used there. This it the most interesting part of me and it is quite working on simple examples.

    1. As the creator of MakerCAD, I agree and I have plans to keep it expressive while reducing the verbosity. I also intend to build a UI in the future which will provide a traditional interactive CAD producing the code behind the scenes, but without requiring the user to write it.

        1. It’s pretty hard to create a point & click interface that would output in human-readable code unless you perform the pointing and clicking operations exactly right in a proper order.

          There’s a general point in UI/UX design that you should not be able to effect the same thing in two completely different ways (e.g. by GUI and CLI) at the same time, because one messes up the other. In other words, you can write code that performs something impossible for the graphical interface, which breaks the latter because attempting to touch the same feature with your mouse cursor can then break your code.

          1. That’s exactly correct. The UI will generate code, but modify that code and the UI will not reflect those changes. I plan on using some annotations to allow the UI to be able to edit things it had generated in a previous session, but stray from that and you will have to continue editing code directly.

  2. I agree with you about OpenCascade. It’s an API maze, a documenration desert, a performance hog, a legacy painful debt, and a compilation circus.
    That said it has LOTS of features, can handle complex geometric operations, and, most important: it evolves and improves !

    1. All of those things about OpenCascade. It is one of the most evolved open source brep CAD kernels right now, though. I have a roadmap for MakerCAD that will take me quite some time to complete. If no other CAD kernel exists in Go before I reach a point MakerCAD’s roadmap requires it, I may consider writing one to replace OpenCascade in MakerCAD.

      That’s exactly how dlineate came to be (the 2D constraint solver that MakerCAD uses). I used a different constraint solver until the project outgrew it and then wrote my own.

  3. neat! i love openscad because it’s a scripting language but i have complaints about its language and its implementation so i am always looking for alternatives. otoh, by this point i’ve gotten good enough at openscad that familiarity is its own cage :)

    using planes for orientation instead of prefixing each object with a nested sequence of translate/rotate/multmatrix is definitely thought-inspiring. i’m not sure if it’s six of one vs half a dozen of another or if it really allows more expression? i’m not clear how it interacts with everything else… the openscad orientation operators seem like a single mechanism while it seems like to replicate their functionality, planes will soak up some of that but some of it will still need a separate mechanism?

    i don’t know Go, but the examples give the impression that this isn’t so much a scripting language as a library that lets you define shapes in Go…the syntax itself is Go, right? pluses and minuses to that. it really constrains your possibilities for changing the implementation in the future, though. like if you want to parallelize it (as openscad has), then you will be struggling with that…though for all i know that particular struggle is solved for you by Go?

    constraints are definitely neat to think about! if i understand correctly, they might obviate a problem i solve fairly often in openscad — for example having the wall of a cube meet a cylinder tangent to its sides. of course, that one is trivial…having a cone meet a sphere is a little more difficult. i’m not sure if constraints would truly make this easy for me or if it would just replace one challenge (a bit of trig and algebra) with another (imaginative use of constraints).

    kind of neat that shapes are returned values instead of side-effects. and i bet it doesn’t have openscad’s awkward variables vs constants distinction, because it’s a real language. i’m not sure if it matters but if i was starting from 0 i’d probably go in makercad’s direction on this one!

    i’m kind of disappointed that it isn’t really “from scratch” — it’s “just” a wrapper for OpenCASCADE. i don’t have any attachment to the purity of “from scratch”, it’s just that if you look at openscad i think a lot of its downsides are inherited from OpenCSG. especially its abysmal performance. there was another CAD within a scripting language project a while back that interested me a lot more because it really was from scratch, so it used a novel representation of geometry that made it very different from what came before (and it solved the problem i’ll describe in the next paragraph) (but it was incomplete from my perspective so i didn’t use it either).

    the biggest thing that made me imagine abandoning openscad a few years ago is that there’s some shapes it just can’t really represent. what i really want is an operator like multmatrix, but that isn’t linear (isn’t a matrix of coefficients). i want to be able to specify arbitrary algebra to apply to the points of one of the primitives. in fact, i’d like to apply algebra to each point along a line, not just to its endpoints. i’m not convinced MakerCAD improves at all for this struggle?

    but since then, i’ve become a lot better at openscad and i don’t mind making a shape that openscad doesn’t know natively by breaking it into a bunch of smaller pieces that are each one of openscad’s primitives. like specifying a compound curve using a for loop iterating over rectangular prisms. so that pretty much removed my incentive to learn something new :)

    anyways, best of luck to you!

  4. Nice to see the program come to life. I was also quite surprised to see it was for a Miwa lock, and guessed you wanted it to aid lockpicking. It didn’t take much to find the details, as we move in similar circles. It’s a curious tool, but to use it you first need to learn CAD, and understand what features do before you apply them. It’d be nicer to have the features in OpenSCAD, though. Or as the Close caption says, ‘open S cat’.

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.