ZH version is available. Content is displayed in original English for accuracy.
This is a CAD by code project I have been working on on my free time for more than year now.
I built it with 3 goals in mind:
- It should be familiar to CAD designers who have used other programs. Same workflow, same terminology.
- Reduce the mental effort required to create models as much as possible. This is achieved by:
- Provide live rendering and visual guidance as you type.
- Allow the user to reference existing edges/faces on the scene instead of having to calculate everything.
- Provide interactive mouse helpers for features that are hard to write by code: Only 3 interactive modes for now: Edge trimming, Sketch region extrude, Bezier curve drawing.
- Implicit coding whenever possible: e.g: There are sensible defaults for most parameters. The program will automatically fuse intersecting objects together so you do not have to worry about what object needs to be fused with what.
- It should be reasonably fast: The scene objects are cached and only the updated objects are re-computed.I think I have achieved these goals to a good extent. The program is still in early stages and there are many features I want to add, rewrite but I think it is already usable for simple models.
Update to add more details: This is based on Opencascade.js WASM binding. So you get all the good things that come with any brep kernel. Fillets, chamfers, step import and export...
The scene is webview but the editing is in your local file. You use your own editor and the environment you are familiar with.
One important feature that I think make this stand out among other code based cad software is the ability to transform features not just shapes. More here: https://fluidcad.io/docs/guides/patterns You can see it in action in the lantern example: https://fluidcad.io/docs/tutorials/lantern

Discussion (36 Comments)Read Original on HackerNews
https://github.com/openscad/openscad/pull/4478#issuecomment-...
My pet use case is: "My naive approach as a programmer would be: `pen := new Pen(q,r,s,t); box := new Box( pen.L, pen.W, pen.H )`" along with being able to sometimes work with the whole pen, and sometimes touch the pen vs. the cap separately.
Since it's all javascript, it seems like there's a chance that this use case would work (ie: `p = Pen(...).render().getWidth()`)? Additionally, your intermediate step screenshots really makes it seem like a SketchUp-ish GUI would be perfect! Obviously a ton of work, but SketchUp's "grab face + extrude / push", but if it were "sticky" to the underlying parametric components seems like it'd be an awesome combo... something like group/components, but backed by code instead of GUI-only (or GUI-centric) editing.
The interactive region extrude is there for when you want fast modeling/prototyping.
I am trying to think of an example, declarative constraints are usually the domain of a graphical cad system(like solvespace). but I suspect it would look like a set of relationships you can enter in any order and it solves for the missing one. so... prolog? has there ever been a cad system in prolog?
Then I decided against this idea because it results in too much typing + the constraint solver implementation is not trivial and there is not much web based open source solvers. I went with a mixed approach instead between declarative and imperative. https://fluidcad.io/docs/guides/sketching/constrained-geomet...
I've been revisiting OpenSCAD recently but find it very frustrating. I just got started with build123d which is great but I'll definitely be trying this. The workflow is exactly what I'm looking for.
I'll drop an issue if I have feedback. Are you open to PRs?
E.g. when splitting a face in OnShape, I might have to redo a whole bunch of operations later because the identifiers change, but I'm often surprised how good it is at matching up faces after a single operation. Like modifying a sketch, then having to add the new face to an extrusion, but then it magically does the right thing for chamfers and drafts.
Regarding the picking; that's exactly the region picking feature in this screenshot: https://fluidcad.io/img/region-extrude.gif
When the user click on a region we insert a 2D point, then the extrude feature will find the nearest face. I have experimented with adding this picking logic to selections too select().pick() which will probably be merged in future releases.
This looks like it could do the same thing for constraint modeling. That's awesome!
Irrespective - This project is pretty cool to see!
[1] https://en.wikipedia.org/wiki/AutoLISP
https://www.microsoft.com/en-us/garage/profiles/maker-js/
Also looking at your API, I used a vector type a lot for defining things like planes, so where you have sketch("xz",func) mines a little more like plane(vec).sketch(). How are you handling sketching directly on arbitrary planes or faces etc?
The user can create planes with plane() command e.g plane("xy") or plane("xy", { offset: 10 }); but I have added some shortcuts for common planes (https://fluidcad.io/docs/guides/sketching/introduction#sketc...)
you can also sketch on faces sketch(extrusion.endFace(), ...) which will extract the plane from face and put the starting point on the center for convinience.
const in1 = draw.rectangle(size1, size1).fillet(2)
const in2 = draw.origin([0,0,height1]).rectangle(size2, size2).fillet(2)
const result = make.loft([in1, in2])
Assemblies will come but not anytime soon. I did some research and tests and it is going to be a challenge. You can still add multiple parts in one scene but no actual joints implementation.
Which operations are supported? (Booleans? ...)
Where's the API link?
...finally, was this vibe-coded?
Inquiring minds want to know!
Reminds me the days when I created a Windows app for accounting and someone asked did you code it in C++ Builder? As if writing form scaffolding by hand was sign of a skilled developer.
What I am trying to say - who cares? Most software create by one person is vibe coded, just with the AI, you don't have to spend ages typing actual code that you would have eventually typed anyway.
> Features in the docs
The Docs section of the website has "Installation", "Editor setup", and "Your First Model".
Not a list of operations/features.
The front page lists some (extrusion, fillets), but not all.
Is the entirety of OpenCASCADE exposed to the user via the JS API, or are you only supporting a curated subset?
There is a guide section and one tutorial: https://fluidcad.io/docs/guides/
This week will be all for documentation.
It is only a subset of features focused on solid modeling. Surface modeling will come in future versions