Live data from Hacker News

Build123d: A Python CAD programming library

github.com

51–60 of 67 posts

Re: Build123d: A Python CAD programming library

#51
post #41

Earlier quoted context omitted.

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_...

[dead]

Re: Build123d: A Python CAD programming library

#52

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.

Do you have an image of the reversing portion? Any examples of pitfalls?

On the face of it, it seems like you'd define paths and sweep profiles for the material to remove. Is the difficulty in defining the path of the reversing portion, where it's not a helix?

Re: Build123d: A Python CAD programming library

#53
post #52

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.

Do you have an image of the reversing portion? Any examples of pitfalls? On the face of it, it seems like you'd define paths and sweep profiles for the material to remove. Is the difficulty in defining the path of the reversing portion, where it's not a helix?

Threads have a range of properties, all of which must be supported, then it's generally the capacity to mirror a thread along the same face (exactly), and at either end add a transition zone that reverses, preferably with configurable characteristics (straight portion, rounding, etc.). Many approaches fail because the reversing transition zone is not readily aligned with the existing thread except through hacks or because reversing is incompatible with the programmatic approach used. Once that's all done, there are additional complexities for a captured element to ride in it which typically has a geometric relationship with the thread pitch, crossovers and transition zone. It's one of those "harder than it looks" problems, even for machinists. That's why, if the codebase can achieve it, I'd give it respect.

PS. I also use a lot of OpenSCAD. Liked your comment. I started in POVRay so it made a lot of sense after managing non-FOSS CAD people for years.

Re: Build123d: A Python CAD programming library

#54
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)

Pretty much, that's why for DXF export I rolled my own:

https://github.com/WillAdams/gcodepreview/blob/main/dxfexpor...

(shows a DXF w/ arcs)

https://github.com/WillAdams/gcodepreview/blob/main/gcpdxf.p...

(shows a .py file for making DXFs)

See the PDF at the top level for more information.

Re: Build123d: A Python CAD programming library

#55

Earlier quoted context omitted.

I disagree. Most CAD is inherently visual. These code-based systems work great for highly parametric and regular objects like fasteners and gears, or for procedural art, but those are really the tiny minority of CAD tasks. Most of the time you need to see what you're doing and click on stuff. Most CAD is more similar to graphic design, painting, etc. You wouldn't expect a "code first workflow" for Illustrator, and as…

[flagged]

This is not true. Onshape was built with versioning and diffing as a first class capability.

https://cad.onshape.com/help/Content/Document/compare.htm https://cad.onshape.com/help/Content/Document/versions_and_h...

Code diffing of something that is very visual is quite poor UX.

Re: Build123d: A Python CAD programming library

#57

Earlier quoted context omitted.

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?

Parent was complaining about the lack of a built in sketch constraint solver in build123d, which is table stake feature of any "real" GUI CAD suite. build123d has some constraint options and you could probably use solvespace with it. Of course you can roll your own.

Re: Build123d: A Python CAD programming library

#58
post #40

Earlier quoted context omitted.

Yeah that would be amazing, but sadly nobody has made that work for any CAD of reasonable complexity. In reality, CAD version control is done just like assets in the artistic world (game design, animation, films, etc): with file locks. I used to work for Dyson. There's no way you're designing a vacuum cleaner with code-based CAD. We used TeamCenter (which is probably the worst software I've ever used, but for unrelat…

I mean, the CAD software, even though visual, has to retain some internal state of the model, right? It's possible, but I don't think there's enough pressure for these companies to support exposing that state to the user.

It does but the internal state is not going to be very meaningful in text form. Edge 4826 connects to vertex 7264.

Think about SVG - you can do some simple stuff procedurally but you're never going to create something like the SVG tiger in code, nor would it be remotely useful to read the source SVG for the SVG tiger. Most CAD is like that.

Re: Build123d: A Python CAD programming library

#59

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.

Had to Google this one :-)

Since SolveSpace has a helix tool that can "extrude" any sketch along a helix it should be doable.

https://www.linkedin.com/pulse/dreaded-double-helix-tutorial...

Re: Build123d: A Python CAD programming library

#60
post #59

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.

Had to Google this one :-) Since SolveSpace has a helix tool that can "extrude" any sketch along a helix it should be doable. https://www.linkedin.com/pulse/dreaded-double-helix-tutorial...

That's the right target in Solidworks, but I'm seeking open source solutions.

I think the very latest Blender can do it, I haven't got it working yet though.

Post reply on HN