Live data from Hacker News

Build123d: A Python CAD programming library

github.com

41–50 of 67 posts

Re: Build123d: A Python CAD programming library

#41
post #16

Earlier quoted context omitted.

I think most GUI CADs have some kind of API like this. In FreeCAD it's Python. In Solidworks, it's VBA or C#. I don't think any are particularly well documented or supported by tutorials.

Solidworks has VBA macros, which (on top of being poorly documented and unstable) subvert to the whole benefit of parametric CAD. Once you're creating features with a macro, you naturally want to edit them, but you also naturally want to rerun the macro itself to create them differently. It's like editing generated code and it's not a viable long-term setup. FeatureScript is a different beast. It actually runs as par…

> runs as part of regeneration

You can do that in FreeCAD. Performance is horribly slow in my experience, but maybe I'm doing something wrong.

https://wiki.freecad.org/Scripted_objects

https://wiki.freecad.org/Create_a_FeaturePython_object_part_...

Re: Build123d: A Python CAD programming library

#43
post #4

I like Build123d but I really want a hybrid mouse/code CAD built around it. I want to be able to click on entities and have them show up in the code editor instead of blindly trying to select edges.

Agree 100%.

I've tried various code CADs before, and they're fine as long as what you're creating is simple enough to build from independent pieces, ideally that you can keep in your head. As soon as you need to refer to aspects that have been created within the CAD, like an edge, or a particular face of an extruded shape, the paradigm falls apart.

Re: Build123d: A Python CAD programming library

#44
Ahh, but can it do a clean self-reversing diamond thread including the reversing portion?

You'd be amazed how hard this is to achieve with open source tools. IIRC modern FreeCAD can't, old FreeCAD can, ~5 ways to achieve it in OpenSCAD don't work properly, Blender keeps shifting-sands and mostly can't but I believe the very latest can maybe do it with difficulty using geometry nodes.

Re: Build123d: A Python CAD programming library

#45

Why do these tools never have the equivalent of sketch contraints in FreeCAD? That's how I build my models and it avoids a lot of math. I'd really like a "CAD as code" tool that's basically the FreeCAD Part Design workflow but with code. I know FreeCAD has a python interface but it's far from developer friendly.

This is also something I really want, what is the best way to include constraint solvers? I have been messing around with sympy see what insights it provides in this domain, but to actually use it the cad DSL would have to be python, is there an easy way to build a simple constraint solver out of a normal imperative workflow?

Re: Build123d: A Python CAD programming library

#46

In many ways this looks fun. I love the precise control and programming power of tools like this, but when I need something in real life, I never use them any more. The productivity of graphical tools is so much greater (as far as my brain works). When I was younger I used POVray for a few small projects, but once I had access to graphical interfaces the difference in output quantity and quality was huge. I still kee…

Oh my, thank you so much for bring back the POVray memories!

Re: Build123d: A Python CAD programming library

#47

Why do these tools never have the equivalent of sketch contraints in FreeCAD? That's how I build my models and it avoids a lot of math. I'd really like a "CAD as code" tool that's basically the FreeCAD Part Design workflow but with code. I know FreeCAD has a python interface but it's far from developer friendly.

The reality is build123d is a fairly thin layer over the OCCT kernel with some pythonic affordances. I'm not sure OCCT has a robust constraint solver, so there is little development there. FreeCAD on the other hand (besides being significantly more mature) is also build on OCCT, but also does a lot on top of the kernel to make it more featured and stable.

When I've needed to solve for something in OpenSCAD I've just written a recursive module --- would that not work in Build123D?

Re: Build123d: A Python CAD programming library

#48
post #4

I like Build123d but I really want a hybrid mouse/code CAD built around it. I want to be able to click on entities and have them show up in the code editor instead of blindly trying to select edges.

I agree, I love code-based CAD but there needs to be a hybrid with GUI tools because selecting stuff with a mouse will almost always be easier.

I known there is research out there (can't dig it up at the moment), but the goal would probably be to generate a robust geometric query for a selected item, so that small changes in the model don't affect which edge gets selected after subsequent operations.

So if you extruded a face upwards, and then filleted all the edges at the top of that extrusion, this hybrid tool would generate a query which gives you all the top edges, instead of whatever the indices of those edges happens to be. I can't imagine it's an easy problem though to generate robust queries for all possible geometry a user might select.

Re: Build123d: A Python CAD programming library

#49
post #14

Earlier quoted context omitted.

I’d love to see this. It was a frustrating learning curve for me to realize that I couldn’t STEP export work from OpenSCAD to something like Fusion. Build123d is much better (supports STEP export and import) but a tightly integrated CAD frontend would be ideal!

PythonSCAD now has STEP export: https://github.com/pythonscad/pythonscad

Wait to usefully import and export STEP you need to be BREP based right? I thought SCAD’s engine was fundamentally incompatible (only really one open source BREP engine out there - OpenCascade)

Re: Build123d: A Python CAD programming library

#50
post #49

Earlier quoted context omitted.

PythonSCAD now has STEP export: https://github.com/pythonscad/pythonscad

Wait to usefully import and export STEP you need to be BREP based right? I thought SCAD’s engine was fundamentally incompatible (only really one open source BREP engine out there - OpenCascade)

Yes, AFAIK you are correct that SCAD is incapable of outputting clean STEP files.
Post reply on HN