logoalt Hacker News

Parametric CAD in Rust

109 pointsby ectoyesterday at 8:36 PM73 commentsview on HN

Comments

gwbas1cyesterday at 9:59 PM

What's nice about this is that it allows for programmatic CAD, enabling things like web applications that can download an .stl file based on user input. I hope I can find a weekend or two to play with it.

BTW: I spent a few weekends playing with Microcad (https://microcad.xyz/). It was cool, and had a similar rust feel. I just, for the life of me, couldn't figure out how to do 3d ellipses.

show 1 reply
etskinneryesterday at 9:57 PM

The opening paragraph is very telling; the author doesn't seem to understand typical pro-level parametric CAD programs available on the market:

> I keep designing physical parts for our robots. Motor mounts, sensor brackets, wheel hubs. Every time, the workflow is the same: open a GUI CAD program, click around for an hour, export an STL, realize the bolt pattern is 2mm off, repeat.

This doesn't make sense. When you realize the bolt pattern is 2mm off, you just edit that dimension and let the CAD program recalculate. You don't need to click around for an hour again. That's the beauty of contstraint-based parametric modeling as opposed to, say, modeling in Blender.

The author's program is akin to writing vim to replace Publisher. They're solving entirely different problems. Not to mention, this code-as-model paradigm already exists: OpenSCAD

show 4 replies
MITSardinetoday at 2:14 AM

If anyone is interested, you can try EngineeringSketchPad (https://acdl.mit.edu/ESP/) which is very similar but much more mature. It also supports simple geometric primitives and boolean operations via a scripting language, but also more general rational curves and surfaces (i.e. BREPs). It has other nice features like differentiation, application-specific views (think structural vs CFD), and an attention to water-tightness/correctness.

ge96yesterday at 10:01 PM

SketchUp was my go to for a while but I'm done with parametric personally, trying to fix meshes for 3D printing... time I grow up and use something like Fusion360 seems like or onshape. Still it was good/simple enough for non-round shapes in SketchUp except they have some kind of memory leak/bug at least for the 2017 version. But I guess quit being cheap and buy a modern copy on my part.

Edit: oh I guess sketchup is a surface modeler weird thought it was parametric this whole time, lol someone else said it's a polygon modeler

Yeah I don't know what parametric modeling is apparently, I use a mouse/calipers to model stuff not parameters

There is a solid validator plugin you use before you export an STL to make sure the mesh is closed/a manifold

show 2 replies
davidmedinyesterday at 9:45 PM

This sounds a lot like Fidget (https://github.com/mkeeter/fidget) and libfive (https://github.com/libfive/libfive) by the amazing Matt Keeter!

show 2 replies
kibwenyesterday at 9:44 PM

Note that there's an existing CAD-in-Rust project, Fornjot, which has been quietly developing since 2020: https://www.fornjot.app/

show 2 replies
nynxyesterday at 9:15 PM

Unfortunately, using a geometry kernel [1] that operates on triangle meshes means this is a no-go for serious CAD usage.

[1]: https://github.com/elalish/manifold

show 2 replies
hambesyesterday at 9:31 PM

I've been doing a similar thing using GhostSCAD[1], which is a relatively thin wrapper around OpenSCAD in Go. Not as typesafe, but my language of choice.

[1]: https://github.com/ljanyst/ghostscad

jas8425yesterday at 10:12 PM

Is anyone else put off by the AI-sounding text? Two things that give it away for me are the excessive use of punctuation-emphasized sentence fragments ex:

> No clicking. No undo. Just recompile.

> That's our mascot. Entirely CSG.

> No garbage collection pauses. No floating point surprises from a scripting layer.

And worst of all, the dreaded "and/but honestly":

> But honestly, the main reason is the toolchain.

Am I misreading things?

show 1 reply
kivaradayesterday at 9:55 PM

Great work! Please consider adding a RSS/Atom Feed to your site. I would like to include it in my Tech Content Platform: https://insidestack.it

show 1 reply
maartenhyesterday at 9:24 PM

Curious to how well LLM's work in this context! (mentioned as one of the reasons to embed CAD in Rust)

I only know of another text -> STL AI model, I'm quite a bit more excited about this idea.

Does someone have experience with this?

show 1 reply
oussama-gmdyesterday at 9:34 PM

Amazing work! This is what I was looking for, I thought of this few months ago and didn't have the time to create it myself. Thanks will explore it and give my feedback!

ameliusyesterday at 10:46 PM

Based on a geometry engine written in C++ ...

https://github.com/elalish/manifold

kingstnaptoday at 1:23 AM

I had Google Gemini 3 write me a part using human language about 3 weeks ago for a 3D printing project.

I specifcally had it spit out a FreeCAD macro, which is basically Python that looks like what you've made.

librasteveyesterday at 10:39 PM

I get the sense that this author is looking for a DSL (domain specific language) and landed quite close.

hahahahhaahyesterday at 10:10 PM

Why not use OpenSCAD?

show 1 reply
d_silinyesterday at 9:24 PM

Interesting, because I am trying to learn OpenSCAD for some simple modeling.

show 3 replies
FpUseryesterday at 9:47 PM

I am constantly designing parts myself. I just wish that instead of having many unfinished, unpolished products we had something with the level of Solidworks / Onshape / whatever.

FreeCad is getting somewhere but it is still way behind. The last thing I care about is what language was it implemented with.

asdfaslkj353yesterday at 9:59 PM

Absolutely atrocious and piss-poor contrast. Can barely read a thing.

show 1 reply
jlaroccotoday at 12:50 AM

Not to crap on this project too much, but this, and most of the other small CAD projects that get posted here, always have a condescending, "Look how easy I've made this" vibe to them, and then they're always light years behind modern CAD software.

If you're doing serious CAD work, like designing a whole machine, or working with multiple vendors to get parts manufactured, then it really is worth paying for a commercial CAD system and learning how to use it. All of the commercial CAD systems today support parametric modelling where later operations are updated automatically when the earlier operations are changed by the user.

If you insist on writing code, then even entry level systems like SolidWorks have APIs to do everything from creating the part geometry, defining geometric tolerances and PMI, running simulations, doing different types of analysis, creating machine/tooling instructions (G-code, etc.), exporting to various formats, and a million other things.

And they have workbenches for manufacturing techniques other than 3D printing, like sheet metal, CNC machining, cable routing, injection molding, welding, etc. And most of them have libaries of standard and off the shelf parts, like screws, bolts, nuts, washers, cables and housings, etc. in various standardized sizes so you don't have to model those at all.

For testing, on the higher end, the CAD systems integrate with metrology hardware and they're able to actually measure the manufactured parts and compare against the model to validate that they have the correct shape and meet all of the tolerances. Not as a virtual unit test running in CI, but by actually measuring the physical part.

vhantzyesterday at 10:39 PM

Yet another rewrite-it-in-rust-just-because project. I'll stick with OpenSCAD

20livesyesterday at 9:32 PM

[dead]