4 ms·
Cadova: Swift DSL for parametric 3D modeling
- bschwindHN 10mo agoNice! I love code-based CAD. Eventually I want to build a tool which uses a hybrid approach: a GUI for things that are hard/tedious to express in code like complicated 2D sketches, with code as the "persistence" layer so at the end you still just have code to maintain, no binary files or piles of XML. One of the hard parts though will be synchronizing changes between UI and code. I suppose it could start as a unidirectional flow from UI to code... if you were to generate a sketch with something like a loop, it would be hard to recover that code structure from just a bunch of resulting points and line segments. But anyway, I'm happy to see more code-based CAD approaches pop up. I think there's still a lot to explore in this space.
- MattRix 10mo agoYeah I like the idea of combining code and a visual editor of some kind. Many of my current openscad projects are just mixing code with SVG files, which is finicky and feels like it could easily be improved.
- jazzyjackson 10mo agoThere's a VScode extension for that! For viewing renderings from cadquery and build123d. Haven't tried it yet, but maybe it's the weekend for it. https://marketplace.visualstudio.com/items?itemName=bernhard-42.ocp-cad-viewer https://marketplace.visualstudio.com/items?itemName=bernhard...
- ur-whale 10mo ago> I love code-based CAD. So do I. A lot. But wait until you try to pair it with an Agentic AI, it will simply blow you away. Until, that is, you realize LLM's have strictly no sense of how 3D geometry works, but still, it's amazing.
- neomantra 10mo agoI too love seeing code-based CAD and the general aspect of using LLM's using code as an expression-intermediary: SQL to data, Swift to CAD, SVG to images of pelicans. I have not used Constructive Solid Geometry CAD MCPs myself (but I have used some of the AI model creators). Some of the videos I've seen look very cool. But, I wonder how much longer the claim of "LLM's have strictly no sense of how 3D geometry" works will stand. Last week I used Claude extensively to design the upgrade to my homemade pontoon boat. In addition to my textual descriptions, I uploaded pictures of hat channel cross-sections with dimensions and screenshots of my CAD drawings. I was asking questions about strength and stability and relationships between parts and evolved the design. It took some sort of world understanding of boats, relationships of parts, types of physical interconnects, materials properties. There's definitely some understanding going on. --- Actually, show rather than tell. I just took Cadova for a spin, using screenshots of my boat's CAD and the previous conversation. Then I vibe-coded my boat up with Cadova, in an agentic loop with Claude Desktop and VSCode and the Cadova Viewer and screen shots. Pretty wild. Certainly not perfect, and I don't think this is how I would actually go about it, but it was interesting! There's nothing proprietary, so I'll made a quick GitHub project [1] since the Claude links don't show files. [1] https://github.com/ConAcademy/WeaselToonCadova https://github.com/ConAcademy/WeaselToonCadova
- neomantra 10mo agoI've started fresher and am now in an agentic loop in Claude Code, asking it to render the generated 3mf and look at the results and evolve the Swift code to have a model that matches the reference image. Not sure how it will go but it is doing it.... will eventually update the repo.
- amelius 10mo agoFunny that you say that. Just yesterday I was playing with the thought of using SDFs. I asked ChatGPT how, given a SDF, I could implement erosion followed by dilation (by the same amount), and ChatGPT said that the entire operation is the identity. Here the LLM failed to see that the erosion step could delete parts of the design. Anyway, it was interesting to see an area where LLMs clearly have no idea what they're talking about.
- addaon 10mo agoFor my airplane design, I've used Rhino3D (which is 3d modeling, not CAD), and used their Python-based plug-in API to create a very custom, limited scope parametric CAD on it... using a mix of geometric and aerodynamic parameters, and using vortex lattice methods to bridge between them. So the wing chord (MAC) can be set in centimeters, but the wing span set to achieve a specific modeled climb rate. It's all very ad hoc, but also lovely to develop in. Hit run, in three seconds have a freshly-generated OML, use Rhino's UI to make a few changes, confirm I like them, then move those changes to code and re-run. Hit undo/redo a few times to compare the hand-drawn and generated versions, then move on to the next feature.
- sfpotter 10mo agoWhy would you say Rhino 3D "isn't CAD"?
- addaon 10mo agoWell, it's certainly not parametric CAD -- it's a drawing program that happens to be in 3D, with limited (and, I'm very glad to see, growing) ability to use history for some more structured creation. But the biggest limitation is that it's numerics are mediocre, and subtle -- everything is in float space, and it's very easy to get into a space where things just don't make sense, especially far from the origin. In a CAD tool I'd expect to be able to enforce constraints to resolve this ("these two points must match"); I've been able to do that somewhat with my plug-in when the precision is there but the error stack-up has been too high, but there's also cases where the precision just doesn't exist.
- fainpul 10mo agoI think this definition is a bit too strict. CAD just means computer aided design. Architects use Rhino to design buildings. You use it to design airplanes. CAD doesn't even have to be 3D.
- Brian_K_White 10mo ago
- amelius 10mo ago> Nice! I love code-based CAD. I haven't tried it yet, but I would think that coming up with variable names for all the little parts and distances and whatnot must be a nightmare! :) And could someone read the code and understand it?
- bschwindHN 10mo agoDepends on the complexity of the model and how you organize it. If it's broken into functions where one function is one relatively simple part of the model, things work pretty nicely. And names are scoped to the function so you don't have to worry about polluting some global scope. But if you're making something very complicated, code-based CAD sort of falls apart, which is why I'd love to see some sort of hybrid approach.
- jazzyjackson 10mo agoFreeCAD apparently supports OpenSCAD as well as build123d, which looks like a very nice DSL for geometry. Still no 2 way binding tho, unless you count the variable editor in the GUI.
- willtemperley 10mo agoThis project uses some very interesting Swift techniques. Is this the new C++ interop? Looks very clean.
- fainpul 10mo agoI'd like to see the code for this more complex object: https://github.com/tomasf/Cadova/wiki https://github.com/tomasf/Cadova/wiki
- tomasf 10mo agoThis is the base part of my little delta printer. This was an experimental project and not something I planned to publish. The code is unfinished, unorganized and originally written for an older version of Cadova. I’ve patched it to work with the latest release, but otherwise it’s largely unchanged. Posting it as-is for reference: https://github.com/tomasf/m3 https://github.com/tomasf/m3
- fainpul 10mo agoThanks, but that's a 404 for me. Maybe a private repo? I would just like to see something more complex than very simple examples — an actual real project.
- tomasf 10mo agoOops. Yeah, it was private. Should work now. Here's a newer and less messy project: https://github.com/tomasf/advent-candle-bridge https://github.com/tomasf/advent-candle-bridge
- ur-whale 10mo agoRegarding the geometry engine, the README says: Cadova uses Manifold-Swift, Apus and ThreeMF. First I hear of those. Curious to see how those compare to things like OpenCascade.
- samwillis 10mo agoManifold works on solid triangle meshes, OpenCascade is a true BREP kernel that represents solids as edges (straight and curved) and surfaces (not meshed) computed from those edges. There is no triangulation in the root model in OpenCascade.
- ur-whale 10mo agoSo ... meaning Cadova has an underlying Mesh model, like OpenSCAD ... I wonder how they pull off proper filetting and curves.
- le-mark 10mo agoManifold is impressive, lots of info here: https://github.com/elalish/manifold https://github.com/elalish/manifold
- snitty 10mo agoI find this much more readable than KCL[0], but I also understand the ultimate goals of the two are probably a bit different. [0]: https://zoo.dev/docs/kcl-samples/pillow-block-bearing https://zoo.dev/docs/kcl-samples/pillow-block-bearing
- Mars008 10mo agoLooks similar to OpenSCAD: https://en.wikipedia.org/wiki/OpenSCAD https://en.wikipedia.org/wiki/OpenSCAD
- macshome 10mo agoIndeed. The home page of the wiki says as much. “Cadova builds on the ideas of OpenSCAD, but replaces its limited language with the power and elegance of Swift. It’s inspired by SwiftUI and designed for developers who want a better way to build models through code. It's cross-platform and works on macOS, Linux and Windows.”
- Mars008 10mo agoI'm pretty sure FreeCAD can be used the same way, ignoring its UI. Just with Python as a core language.