Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Curated Code CAD (2020) (cadhub.xyz)
96 points by zimpenfish on June 29, 2021 | hide | past | favorite | 40 comments


There is an OpenCascade version compiled down to wasm [1] that we're currently using embedded in our own app. Rendering to WebGL is relatively straight-forward and the system as a whole works well. Gives me a lot of power when designing mechanical systems and running simulations on the resulting models. Perf of the CAD kernel on the web is not great, but 'just good enough'.

Troubleshooting issues is tricky though. If something doesn't work debugging is nearly impossible and the (C++) docs are very challenging.

OpenCascade is very powerful, but the ergonomics of the API aren't great. Writing a simple FP-style immutable wrapper around it has proven very fruitful and we can now describe relatively complicated models with a bare minimum of TypeScript code. Lot's of fun!

[1] https://github.com/gabrielcuvillier/opencascade-emscripten-p...


What do you use for running simulations of your mechanical models?


We’re running some custom code to test basic robotic locomotion, we’re not doing anything fancy with material properties or stress testing.

Very basic stuff, but still useful to quickly change your model in code and have your domain specific sims pick up on it automatically.

Additional advantage is the ease of building custom UIs to configure your model and scenes.


When I last used OpenSCAD, I found it rather lacking.

Basic things like 'hollow this object out, leaving a 3mm shell' are nearly impossible.

Anything non-trivial takes minutes or hours to compile, making debugging really hard.

Are these newer tools better?


I can only speak from a 3d printing perspective, and I've only tried OpenSCAD and FreeCAD.

As rough as OpenSCAD is, I find myself coming back to it, because CAD-as-code is just so useful (including leaving comments). For bashing out quick, fairly simple models I still like it. The various OpenSCAD DSLs can help, but also not when they get superseded or get in your way. I think the review on the posts blog summarizes it well [0].

FreeCAD is apparently capable, but the UI defeats me. IMO, it tries to do too many things and doing none well.

The post doesn't really do a good job of comparing how mature the others are, so I'm not sure. But if CadQuery works as well as OpenSCAD or better, I may just be sold.

[0] https://learn.cadhub.xyz/blog/openscad-review/


AFAIK FreeCAD has Python API.

Though dunno about UX using it, probably not as streamlined as OpenSCAD, though maybe more powerful?

https://wiki.freecadweb.org/FreeCAD_API


I kinda think the many of workbenches in FreeCAD might have been a mistake, it's confusing to know where to start.


I'm inclined to agree, although I'm not trying to bash FreeCAD. The benefit of hindsight is unfair, and FreeCAD set out to be a "full" CAD package, which are naturally complex. Widespread 3d printing came after FreeCAD's inception. No doubt the 3d printing "sphere" could benefit from an open Fusion 360 replacement though...


Yeah, I've tried to digest the Freecad UI / worflow many times, it's just horrible.


There's definitely room for a UI remix that just embeds a couple of critical workbenches for specific workflows. I use it for designing things for 3d printing, and I spend all of my time in 3 workbenches, maybe 4 if I'm doing something unusual. There's a lot of UI/UX noise I don't need to care about.


There is, it's called SALOME. I've found it to be more intuitive than FreeCAD and they share a lot of code. Blows my mind that it's not more widely known. Bad marketing I guess - it's billed as a CFD preprocessor.

https://www.salome-platform.org/


I'm curious: have you found a way to export your models to a mesh file format (eg obj) with some amount of control tessellation?

Last I tried, I didn't manage to find the control. I assume it exists, but the UI was simply to painful to navigate.


I mention SALOME above - it's a bit of a sister project to FreeCAD, and it has extensive mesh generation facilities as part of its role as a CFD pre-processor. I've no doubt you could use this to assert fine control over a surface mesh export.


> I've only tried OpenSCAD and FreeCAD.

This is the crux of why you've come to this conclusion: FreeCAD is frustrating to work with compared to other CAD platforms.


OpenSCAD, as noted by the author of the website sorely lacks a number fundamental features.

    - proper fillets

    - proper chamfers

    - surface-surface intersection
It is also limiting because it can only generate triangle meshes and can indeed be slow when models get big

However, for many situations, especially for prototyping, it is good enough and a really great tool.

It is definitely the first tool I turn to when I want to model a simple part quickly.


> Basic things like 'hollow this object out, leaving a 3mm shell' are nearly impossible.

Yeah, I think that's a consequence of how they're constructing the objects. But things like signed distance fields make that easier* because it'd just be "expand the SDF by 3mm" - https://github.com/fogleman/sdf has `shell` for this.

* if you can wrap your head around the math/geometry, I guess


Except that only works when the distance field accurately represents Euclidian distance, which it certainly won't the minute you apply any sort of non-trivial distortion.


Do you have examples?


Sure. Non-uniform scaling, bends, and twists all render the distance field non-Euclidian.


I agree. Articles like this may be confusing to people new to or unfamiliar with CAD: Tools like OpenSCAD aren't on the same level as the better GUI tools like SolidWorks and Fusion. Even FreeCad is a better bet for anything other than experimenting.


You can probably try ImplicitCAD . I have not used yet, but it's on my stack of things to try for the next time OpenSCAD fails me. And it does have a shell operation.


Hey, the author here.

I'm sure I'm missing some, let me know if you know of any.

One project that's not on there and frankly it's too early to list but I'm hopeful for is KittyCAD [1]

Getting funding behind one of these projects could go a long way.

[1] https://kittycad.io/blog/introducing-kittycad


Just a quick diff between your list and mine, apologies if I missed them or if there is a reason to exclude these:

    - https://github.com/nickc92/ViewSCAD
    - Matt Keeter's stuff (listed here https://www.mattkeeter.com/projects/, including https://github.com/mkeeter/antimony and https://www.mattkeeter.com/projects/ao/, though I see you have libfive)
    - https://solvespace.com/index.pl
    - https://mirmik.github.io/zencad/en/
    - https://github.com/fogleman/sdf
This is from a list entitled "migrate away from OpenSCAD", but somehow I can never manage to do that...

Thanks for this site!


SALOME: https://www.salome-platform.org/

OpenCASCADE, contraints engine lifted from FreeCAD, Python bindings that map 1:1 with the GUI (like Blender). A criminally underrated tool.


I would urge the KittyCAD people to join in with the STEP development effort, the world doesn't need yet another incompatable CAD exchange file format.


(preface: I love the comprehensiveness of this post, lots of stuff I've never heard of!)

I use openscad because its fast and easy, but I can feel its limitations.

I want to love CadQuery (cq-editor GUI), because I do a lot of Python work, but something is wonky with the renderer (projection? the edge of a box further from the screen is wider than the edge close to it! like they got the matrix inverted or something)

and something else is wonky with the camera controls compared to... every other 3D application.

I try it again every 6mo to see if it feels good yet, they're still working on it.

Nevertheless, i suspect when they get it right, it's a tool that will eventually be like turbocharging my workflow.


CadQuery is one of the best one imo, part of the reasons why it was the second integration we added to Cadhub [1]

[1] https://cadhub.xyz/dev-ide/cadQuery


I honestly do no see the point of code CAD for anything but a couple limited cases. Designing is an inherently visual process and you lose a lot by working with code.

In modern CAD software one already does 'programming' by specifying geometric constraints. For a great example of the power of this approach, see Ivan Sutherland's sketchpad. Specifying geometry using equations as one often does in code CAD is a much more difficult process than specifying geometric constraints. For example, specifying that a hole is some distance from the edge of a part is quite difficult with code CAD.

In addition, there are already multi-user CAD approaches for doing CAD design as part of a team. BYU's multi-user CAD system is a great example of this. I can't find a video, but it claims to be google docs for CAD, allowing users to edit the same CAD model in parallel using extended versions of commercial CAD software.

Honestly, I think the only reason why code CAD is popular at all is that no good open source CAD software exists, so manual use of CAD kernels is filling the void. Although, FreeCAD is continuing to improve so this may change.

BREP is not necessarily futureproof too. At the current time we can manufacture more complicated parts than we can design. With additive manufacturing we can make very, very complicated parts. [0] gives a great example of some. At the current time there are printers which can make centimeter scale parts with micrometer-scale geometry and there's good reason to believe that the same printing process can be scaled up. Describing a 1 meter cube with a micrometer scale lattice structure using triangle based formats takes something like 500 TB.

Additive manufacturing is also capable of printing multiple materials too. In some cases you can even mix material together, to say have a gradient going from soft to hard material. So there is now a need to describe material composition and be able to describe how that material composition changes in 3d space. Things get particularly weird if bring composites into the mix too. There are number of very different approaches to solving these problems. Some proposals include voxels with 3d textures, volumetric-representations, and even some approaches based on functional programming[1].

[0]https://www.researchgate.net/publication/317614395_Nanolatti... [1]https://www.sciencedirect.com/science/article/abs/pii/S00104...


That may or may not be true. Certainly I'd like the option of good open source visual CAD software.

But the code/textual format is a boon for me personally: version control, Thingiverse's customizer, and easy re-use. You can grab geometry or constructs from other projects. Whether or not those properties are incompatible with a visual approach - I'm not sure?


Nice to see sdfx [1] there, this project is impressive.

deadsy built some rather sophisticated models, be sure to check out the renderings in the github README!

https://github.com/deadsy/sdfx


Slightly OT:

So after reading this, I went and tried cadquery ... it's really nice, but it is very, very unfortunately tied at the hip with anaconda, which is a monstrosity.

I'm not sure why they would tie such a ball and chain to an otherwise super nice CAD scripting tool.

There is luckily a docker based solution [1] that cleanly lets you wrap and try the whole cancerous thing without it spilling all over your system.

[1] https://github.com/RubenRubens/cq-containers/tree/master/cq-...


I haven't used anaconda, because frankly I assume adding any more python package management tooling will make an even bigger mess on my system, whether it's a good tool or not. But I have no experience with it, so I'm curious, what makes you so opposed to it that you call it a cancer?


> I'm curious, what makes you so opposed to it

I confess to having not kept a very detailed track of the headaches conda has caused me over the years, but here are my recollections:

    - conda plain and simple failing to install with a cryptic error message after downloading multiple gigabytes of crap only to test a small piece of software. Back then (slow download / disk writes / CPUs), easily an hour wasted.

    - conda ruining my existing pip install and silently overwriting apt-get managed packages.

    - conda unilaterally grafting bash code in my .bashrc, a practice I find - to remain polite - distasteful, not to mention the (IIRC) creation of a giant turd of a repo in my home directory.

    - conda, when used to run tensorflow based packages on my NVidia linux box completely wrecking the existing NVidia drivers installs to the point of it booting in "safe mode" or giving me a black screen.

    - post conda install, some binaries didn't want to run anymore because conda-installed libs were newer.
To be fair these grievances are old: I've avoided conda like the plague for - easily - the last 5 years, and they might have cleaned up their act.

However, I still find the notion of having to install 2 gigs worth of stuff on my machine only to try a simple CAD package for a few hours a rather offending proposition. Call me an old curmudgeon if you have to.

To be fair to the cadquery folks: they seem to have realized the issue and they now offer what looks like a somewhat self contained binary dowload of the cq-editor package [2].

Finally, I'll leave you with this, taken from the cadquery homepage itself [1] (note the use of the word "polluting" in there, looks like I'm not the only one feeling this way):

    For those unfamiliar (or uncomfortable) with Anaconda, it is probably best to install Miniconda to a local directory and to avoid running conda init. After performing a local directory installation, Miniconda can be activated via the [scripts,bin]/activate scripts. This will help avoid polluting and breaking the local Python installation. In Linux, the local directory installation method looks something like this
[1] https://github.com/CadQuery/cadquery#alternative-anaconda-in...

[2] https://github.com/CadQuery/CQ-editor/releases


How does OpenCascade implement robustness?

In this sense:

https://en.wikipedia.org/wiki/Robust_geometric_computation


Question: How hard would it be to make to re-impletment freecad in wasm? Someone needs to break it out of qt or at least make it more customizable. Is this ever going to happen?


IceSL[0] would also qualify to be on that list. [0]: https://icesl.loria.fr/


No mention of solvespace on the site?


Solvespace is traditional gui cad and not code cad?

> software that allows you to define 3D CAD models with code


> Solvespace is traditional gui cad and not code cad?

Fair enough, but:

1. IIRC the engine is original (eg not relying on OpenCascade or somesuch) and high quality code.

2. Adding some sort of Python API to it would be fairly simple given the file format: if you open a solvespace model file [1], it's almost already a script (ascii, with clear commands).

[1] https://solvespace.com/examples.pl


> Adding some sort of Python API to it would be fairly simple given the file format.

Great, as soon as they add some sort of API or script input, I will notify author of article about this. BTW, ascii based file is not a script, STL file is also ascii.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: