Live data from Hacker News

Parametric CAD in Rust

campedersen.com

111–120 of 184 posts

Re: Parametric CAD in Rust

#113
post #42

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 m…

> Am I misreading things?

Probably not.

There's also this at the bottom.

> One thing I care about that most CAD tools don't: vcad is designed to be used by AI coding agents.

Re: Parametric CAD in Rust

#114
This is not parametric CAD. Not useful anyway. You need much more complicated engine.

This approach is explored by OpenSCAD. No need to reinvent the wheel. But parametric CAD is much more than that.

Re: Parametric CAD in Rust

#115

Earlier quoted context omitted.

> Constraints and parametrizing are the trivial parts of CAD, something you can now implement in a weekend with Claude Code You go ahead and try that.

;) Keywords: Jacobian, Newton-Raphson, Levenberg-Marquardt, Powell dog leg, Schur complements, sparse QR/Cholesky, and so on. The LLM can figure the rest out. Try it yourself! I recommend Rust because the methods are old and most of the algorithms are already implemented by crates, you just have to wire them together. Like I said the hard part is the b-rep: you’re not going to find anything equivalent to Parasolid or…

Look, I'm not trying to decimate you here but your list of keywords is wrong and I know it because I explored that list last month for a completely different application.

The Jacobian is the first order derivative for a function that accepts a vector as an input and produces a vector as an output, hence it must be a matrix.

Newton-Raphson is an algorithm for finding the roots(=zeroes) of a function. Since the derivative of the minimum of a function is zero, it can be used for solving convex optimization problems.

Levenberg-Marquardt is another way to solve optimization problems.

The Powell dog leg method is new to me, but it is just an extension of Gauss-Newton which you could think of a special casing of Newton-Raphson where the objective function is quadratic (useful for objectives with vector norms aka distances between positions).

Most of the algorithms require solving a linear system for finding the zero of the derivative. The Schur complement is a way to factor the linear system into a bunch of smaller linear systems and sparse QR/Cholesky are an implementation detail of solving linear systems.

Now that we got the buzzwords out of the way I will tell you the problem with your buzzwords. Constraint solving algorithms are SAT or SMT based and generally not optimization based.

Consider the humble circle constraint: a^2 + b^2 = c^2. If you have two circles with differing centers and radii, they may intersect and if they do, they will intersect at two points and this is readily apparent in the equations since c = sqrt(a^2 + b^2) has two solutions. This means you will need some sort of branching inside your algorithm and the optimization algorithms you listed are terrible at this.

Re: Parametric CAD in Rust

#116

With the ability to change one number and regenerate everything That's exactly how I use Solidworks (and similar parametric CAD software) all the time. It takes some discipline, but the key is for all your geometry and relations to be driven from sketches and equations. Then you just change a value (sketch dimension or global constant), hit rebuild, and everything regenerates fairly reliably. Don't get me wrong, this…

> But I do find the graphical interface very natural for doing creative design work. In fact, sometimes I wish I could literally step into my design in VR and grab and move vertices around in 3 dimensions

Agree, it's really hard to do work where you leverage "feels right" together with code, because even if the iteration loop is really tight ("change a bit of code > look at the results"), it's still loose compared to just clicking and dragging, feels like the mental load is a lot less.

Environment art really changed and became a lot easier with VR, I think maybe it's mostly a perspective thing, adjusting with controllers and dragging a moving is great, but the perspective it gives you really has no comparison and makes it all a lot simpler to get right. I can't wait for the tooling to mature more.

Re: Parametric CAD in Rust

#117

With the ability to change one number and regenerate everything That's exactly how I use Solidworks (and similar parametric CAD software) all the time. It takes some discipline, but the key is for all your geometry and relations to be driven from sketches and equations. Then you just change a value (sketch dimension or global constant), hit rebuild, and everything regenerates fairly reliably. Don't get me wrong, this…

I am trying to do something similar but inside a GUI - https://lilicad.com/ This is still very basic. Also 100% vibe coded and therefore not as robust as I would like it to be.

Re: Parametric CAD in Rust

#118
post #94

I really like the idea of openscad, or this, or the many alternatives. But when I say a shape with these and these dimensions, the next shape should attach to it somewhere. And then I want to say: chamfer all outside edges. But in all these programs, it's me redoing the math in my code, computing where the shape goes. As for chamfers, I just give up ...

BOSL2 is a great library to use with Openscad. It provides a bunch of primitives shapes functions with chamfer/rounding parameters.

Math doesn't go away tho

Re: Parametric CAD in Rust

#120
post #60
post #30

Earlier quoted context omitted.

Read a bit before critisizing: > One thing I care about that most CAD tools don't: vcad is designed to be used by AI coding agents.

AI coding agents are notoriously bad at anything that involves spatial awareness.

I've found they are actually quite good at semantic geometry even if they struggle with visual or pixel-based reasoning. Since this is parametric the agent just needs to understand the API and constraints rather than visualize the final output. It seems like a code-first interface is exactly what you want for this.
Post reply on HN