CADing and 3D printing like a software engineer

by bo0tzzon 12/12/24, 12:38 PMwith 103 comments
by atoavon 12/16/24, 8:04 AM

I thought immidiately: "CAD for programmers? This has to be about OpenSCAD/CadQuery or the likes", but no.

So if you want (need) to create parametric CAD parts and can program this might interest you: https://cadquery.readthedocs.io/en/latest/quickstart.html#qu...

I e.g. used it to create parametric electronic parts for visualizations of printed circuit boards where modelling each slightly differently sized variant manually was too much effort.

by ansgrion 12/16/24, 8:49 AM

Bambu and Fusion360 sure look nice, but if you're on tighter budget, 3D printers became both cheaper and more reliable in general, and FreeCAD recently got to 1.0 and is quite capable.

I worked alongside people using early versions of Makerbot and Ultimaker, and those were a maintenance nightmare. But recently I got a Kobra 2 Pro for $200, and it's both more capable and easier to use than those old monsters. With PLA it's pretty much hassle-free, no need to tweak anything except print orientation and maybe some support options.

by fmeyeron 12/16/24, 10:48 AM

Nice post, let me build up on the software engineering analogy.

I've had a 3D printer for a while, and I have to say that Bambu has completely changed my perspective on the whole experience.

Before, I treated it mostly as a time-consuming hobby - setting up my own Octopi for remote printing, tinkering with different settings and parts on my Prusa. It was all trial and error, with most prints turning out below average.

Now it feels more like a continuous integration system. It runs mostly unattended, always ready to execute my next batch of prints.

I recently traveled for a week and only needed my wife to refill the filament and remove finished prints, allowing my workflow to continue uninterrupted.

I don't regret my initial experience since I learned a lot, but I really appreciate having a more streamlined process now.

by i_am_a_squirrelon 12/16/24, 7:08 AM

I just went through this journey, except I learned freecad.

You end up having to click and enter so many numbers if you need exact dimensions, so I'm planning on switching to cadquery.

It would be cool to make a framework for modifying cadquery code with natural language, for example "make box 1 and box 1 flush" or "create two concentric semi-spheres and subtract the smaller one from the larger one"

But idk, maybe once you're fast at fusion this kinda stuff is faster to hotkey than speak

by willvarfaron 12/16/24, 7:57 AM

Of course this title triggers me and I need to share/rant about my own programming struggles with CAD :) Sorry

Coming at the problem from another end, I have have been designing dream houses as a hobby but have been struggling and frustrated by the current CAD and 3D editors.

There are a lot of drawing-house-plans apps like SweetHome3D and Homestyler etc, and they are all really good at getting some wall lines down quickly, but quickly start to get hard to do anything advanced and all give up on real roofs and attics.

From the other end there is Sketchup, which is both good and easy yet also difficult to control.

The general advice for people wanting to see a house design in 3D is to draw the plan in some house plan software then save that as a jpg and import that into sketchup and then to build the walls on top of the drawing etc.

Of course, being a programmer, I had some ideas... and have about a dozen abandoned starts on a house drawing program that actually understands that 'this is a wall, and this is how thick walls are' etc.

The openscad approach is good and I have some routines that do sensible tricky roofing angles and things, but you can't really go and and parameterise whole houses. Its a nut that still hasn't cracked.

I've watched and talked with a lot of architects and tbh they are sketching and treating their CAD as a bunch of lines rather than the CAD knowing what walls and beams really are.

by soneilon 12/16/24, 8:51 AM

A bit of a tangent, but on your note amount multi-material being wasteful - you can improve that a lot by thinking ahead in your design and being strategic about where you use colour.

Your benchy is almost a worst-case scenario (which is likely intentional) - because the coloured features are vertical, there will be several changes per printed layer. If you can constrain your material changes to layer boundaries you'll get a much better waste ratio.

A good example of this is printing coloured labels/features on a faceplate. So you print the whole faceplate in a single material, then switch material and print the highlight colour as raised features. That gets you a lot of result for a single material change. (On single-material printers there's a method where you strategically pause the print and swap the materials by hand. Learning lessons from that will really hammer home the mindset of optimising tool changes!)

There's a lot of lessons like this you'll pick up, where making your design sympathetic to the print process can have huge payoffs.

by freeqazon 12/16/24, 7:12 AM

I've been 3D printing slinkies (helical coils) and I used build123d for it. Somebody on HN recommended it as a first pass if you don't know CAD.

It's a little rough but I was able to get it to do what I needed it to! Here's my code: https://github.com/freeqaz/light-coil-model

Let me know if you want one. They're pretty rad!

by fecal_hengeon 12/16/24, 8:59 AM

I bought a Stratasys J35 and its just a bucket to dump money into... I mean it can print absolutely tiny features but maintinance and consumables are so expensive.

Meanwhile my colleague bought a Bambu Carbon for I think 2% of the price of my J35 and its such a brilliant machine. Fillament printers just seem to be getting better and better.

by synackon 12/16/24, 8:10 AM

I had the same problem with my webcam and solved it with 3d printing: https://www.printables.com/model/370558-logitech-c920-shim

by 082349872349872on 12/16/24, 9:31 AM

> [the webcam's] mount’s front-facing part dips too much down beyond the bezel, and it ends up blocking my screen.

As an old-school software engineer, I would've been strongly tempted to solve this excess material problem with a file.

by bschwindHNon 12/16/24, 3:34 PM

I recently gave a talk on this topic though it was more focused on code-based CAD, and with extra emphasis on Rust because it was at a Rust meetup. But very similar vibes overall, I think there will be many software engineers picking up CAD and 3D printing in the near future.

https://youtu.be/0wn7vUmWQgg

by self_awarenesson 12/16/24, 11:11 AM

Being on a budget and buying X1C with AMS has nothing in common. It's a bad choice. It's a really awesome printer that just works, but it's not a budget option.

If you're on a budget, buy yourself BambuLab A1M, which is the best quality-to-money ratio.

by hurtuvac78on 12/16/24, 8:35 AM

I have been using Blender to design 3D models, since I had some knowledge of it. Wondering why not more people are using it for CAD. Are the other tools much better? Why?

by rekttraderon 12/16/24, 6:33 AM

OpenSCAD is your friend.

by constantcryingon 12/17/24, 3:27 PM

>Parametric CAD is basically functional programming.

It very sadly is not. Parametric CAD does not have the invariants that functional programming has. If you insert an operation in the timeline, which changes e.g. the number of faces, the CAD software can only guess to which faces the operations after it apply. In functional programming you explicitly state which elements you mean, in Parametric CAD this is done by guessing.

OpenSCAD is functional programming, it also is orders of magnitude less powerful than Fusion360.

by 65on 12/16/24, 3:21 PM

Fusion 360 has an API in C# and Python.

I use the Python API to write 3D modeling scripts for everything I 3D model. It takes a little longer to build up your own utility function library so you can make models quicker, but once you've got a solid utility library of your own, making 3D models with code is really easy and fun.

by gottson 12/16/24, 7:50 AM

functional programming is such an (semantically) overloaded term, it means completely different things to different people. Each time I read it in a blog post/tweet it makes comprehension slightly more difficult.

by proeeon 12/16/24, 3:00 PM

When you start designing products with lots of gears and linkages, does animating/simulating your design become critical? What CAD tools are best for simulating your design, or is this even the right way to verify all your mechanical items are working together as expected?

by timonokoon 12/17/24, 5:11 AM

I did not understand what this was about, I why it was upvoted.

Anyways. I have solved the only problem OpenSCAD ever had. And that was -- you cannot tweak parameters just by pointing at them:

https://youtu.be/eG5lhLYvihQ?si=WiCnxahDx7_mJTrC

by randomghost1on 12/16/24, 7:46 AM

Hey, shameless plug in case you are interested.

We're building this AI copilot for Fusion 360 called MechAI. Like a SWE, it enables you to store files on GitHub in JSON format with diffs, merging, etc. ;).

Beta coming out soon, check out the demos and waitlist on our website: https://www.trymechai.com/.