Top
Best
New

Posted by c0nsumer 3 days ago

OpenSCAD is kinda neat(nuxx.net)
322 points | 248 comments
fogleman 3 days ago|
It is kinda neat, but OpenSCAD's limitations are the main thing that motivated me to write this Python library to generate 3D meshes used signed distance functions:

https://github.com/fogleman/sdf

One big plus to doing it this way is that it's "just" Python and you can use arbitrary logic to help construct your model.

You can even load an existing 3D mesh and operate on it as an SDF. Great for hollowing, chopping, eroding/dilating, etc. existing models.

I should probably do more with this project. I think there's a lot of interest in this space.

vhanda 2 days ago||
Could you please elaborate on how this is different than the other python based modeling tools - build123d[0] and CadQuery[1].

I recently also got annoyed with OpenSCAD and its limitations and therefore started experimenting with Build123d. I'm very much a beginner in the CAD space and would love to understand what inspired you to build sdf.

My basic understanding is that STL files are essentially like Bitmap images and store a list of triangles and their positions, whereas STEP files are more like Vector art where there is a list of instructions on how to build the model. Most CAD GUI programs also operate on a similar model to vector art where they record a list of operations one on top of another. It's why STEP files are a standardized format and can be imported / exported from most GUI based CAD builders. I think.

Given that SDF also seems like it builds only STL files (I could be wrong), wouldn't learning build123d or CadQuery work better if one cares about compatibility with existing GUI based CAD modeling software?

Additionally, atleast build123d offers a similar conceptual model to using Fusion360 and FreeCad - I have limited experience here - but essentially you sketch something in 2D on a particular plane, and then apply some operations to convert it to 3d in a particular manner - the simplest being extruding. This means the mental modeling of how to construct something is very similar across both GUI based CAD programs and Build123d, and that makes it easier for me to jump between GUI based and code based CAD modelling.

I'd love to understand your point of view, and learn more.

[0] - https://github.com/gumyr/build123d

[1] - https://github.com/CadQuery/cadquery

fogleman 2 days ago||
It seems like you already understand the differences. I wasn't aware of those other projects. build123d looks pretty neat.

Like most of my projects, this was just for fun and I mainly made it for myself. I'm a DIY kind of guy when it comes to software. I just throw things up on GitHub in case anyone else can get some use or inspiration out of it.

silvertab 2 days ago||
> It seems like you already understand the differences.

Honestly I was about to ask the same questions as the parent comment. Whenever I'm interested in something I usually look at what available tools exists out there already; seeing a new tool mentioned that I've never heard of before, my reflex is to ask "oh neat, what makes it different than the existing tools?". I don't think the question was ill-intended, just genuine curiosity; assuming that you wrote your library because you had no idea build123d existed rather than because you were unsatisfied with it and wanted to tackle the problem differently is a bit of a leap.

fogleman 2 days ago||
I know it wasn't ill-intended, but my answer is largely the same. I like the idea of using SDFs to define models and this was just a fun little side project. And FWIW, my project predates build123d.
ur-whale 2 days ago|||
SDFs are very neat up until the point where you need to build parts that have very precise specifications.

Something like two precisely interlocking gears with a tooth geometry with a profile that's the developed curve of the opposite tooth is a nightmare to build with SDFs

Or precise fillets.

Or hard intersections and differences.

Very useful for doing soft, squishy shapes, less so for hard CAD.

Also, a suggestion: in your project, please consider using Wavefront OBJ as an output format, it is a much, much better choice than STL (STL can't represent the actual topology of the object, it has to be reconstructed).

jandrese 3 days ago|||
> You can even load an existing 3D mesh and operate on it as an SDF. Great for hollowing, chopping, eroding/dilating, etc. existing models.

This has my instant interest. Multiple times I have wanted to take an existing .STL file and cut a hole on it or add another object to it and have never had success.

I've tried things like Meshlab, but while the interface has what appears to be a hundred different functions, attempting to use anything returns some error code that requires a PhD to understand and none of the "repair" functions seem to help.

I mean seriously: Mesh inputs must induce a piecewise constant winding number field.

How the hell am I supposed to accomplish that on a STL file?

Brian_K_White 2 days ago|||
You can do that effortlessly right in openscad itself or in freecad for a more visual way, or in every single cad app in existence I think.

In freecad you first just open the stl file, then Part -> Create part from mesh, then you have a solid you can modify.

jandrese 2 days ago|||
Sounds great in theory until you actually try it and discover that anytime a STL touches another object the F6 render craps out with "Manifold conversion failed: NotManifold"
fogleman 2 days ago|||
I just tried this in OpenSCAD and it crashed:

intersection() { import("3DBenchy.stl"); sphere(30); }

bartvk 2 days ago||
FYI, I just tested this in OpenSCAD version 2025.09.13 and it works fine.
fogleman 2 days ago||
Indeed it does. Looks like their recent dev builds are way better. Good to know.
ajolly 6 hours ago||
Yeah you definitely want to use the dev builds for openscad
fainpul 2 days ago||||
People should share the original files or at least step files along with the stl files. But if you must work with stl, Fusion works brilliantly for this. You can open the stl file, which gives you the usual mesh that's hard to work with. You then convert that mesh to a solid object, on which you can use "direct modeling". It's not the same as a parametric object, but the editing features are quite powerful and sort of mindblowing. [1]

If you have the paid version of Fusion, you can run "feature detection" to turn things like holes, fillets, extrusions etc. into dedicated features which are even easier to edit. [2]

[1] https://www.autodesk.com/learn/ondemand/curated/direct-model...

[2] https://www.autodesk.com/learn/ondemand/curated/direct-model...

fogleman 3 days ago||||
That feature requires getting pyopenvdb installed, which can be a headache, and I never really updated the README with examples, but it does work. There is one example script:

https://github.com/fogleman/sdf/blob/main/examples/mesh.py

You basically just say:

f = Mesh.from_file(path).sdf(voxel_size=0.25, half_width=1)

Then you can operate on `f`.

yaky 2 days ago||||
If it's a one-time thing, Prusa Slicer (and some other slicers too, probably) allow adding and subtracting simple shapes. So if, for example, you need to add a hole for a screw, you can do it directly in the slicer without messing with (and breaking the mesh of) an STL.
dekhn 3 days ago||||
Blender also has a high learning curve but you typically don't need a PhD to understand the errors (instead you just watch youtube videos and copy what they do).

Removing faces from an STL and adding other objects is quite straightforward. Previously, Autodesk had Meshmixer and 123D, I guess Meshmixer is still available: https://meshmixer.org/ and I found it to be great for quick editing of the type you're describing.

kesor 3 days ago||||
OpenSCAD can load STLs and cut holes in them.
btbuildem 2 days ago|||
Tinkercad is a very low-barrier-to-entry option here
WillAdams 2 days ago|||
Interestingly, PythonSCAD has support for SDF by way of libfive:

https://pythonscad.org/examples.php

(search for "sdf" about halfway down the page)

mosura 2 days ago|||
This is brilliant. The ability to do blobby/metaball style blends so easily is a big benefit.
FeepingCreature 2 days ago|||
See also my site fncad https://fncad.github.io ! It's basically intended as "SDFs in your browser with realtime preview with openscad-like syntax". I mostly use it for 3d models for printing.

What do you use for sdf meshing? I never really got the perf where I wanted it.

fogleman 2 days ago||
It's explained in the README. The SDF is evaluated on whole batches of points (32x32x32 tiles by default) using numpy. (And it's multithreaded.)
FeepingCreature 2 days ago||
So uniform sampling? And then I guess marching cubes or sth?
fogleman 2 days ago|||
I see you still haven't read the README.
djmips 2 days ago|||
marching cubes yep.
userbinator 2 days ago|||
From what I know, SDFs were popularised by the demoscene; it's interesting that they've now found more practical applications as a result.
mkl 2 days ago||
They long pre-date the demoscene, going back centuries in mathematics. Ray tracing/casting of implicit surfaces (described with SDFs and more general signed functions) for computer graphics goes back to the 1960s and 70s. The 1990s demoscene 2D metaball effects were based on computer graphics work by Jim Blinn for Cosmos in 1980. Most current applications are based on that long ongoing research. (I did my PhD in implicit surface stuff, so I've seen tons of academic papers on it going back ages, and I never ran into demoscene methods in that context.)
pbhjpbhj 2 days ago||
Going back centuries piqued my interest, but I assume you just meant decades?
gmiller123456 2 days ago||
Not sure about SDFs, but ray casting/tracing goes back a long way being used to design sundials thousands of years ago. A method of ray casting was published in the 1600s to show how to trace out the outline of the Moon on the Earth during a solar eclipse.
JonathanRaines 3 days ago|||
I've used your library and really like it!
zimpenfish 2 days ago|||
Bless you for your service, sir! I have used `sdf` to create a whole bunch of stuff (buttons for my mother, tealight holders, etc.) and `gg` gets used in a bunch of places (including a couple of bots).

> I should probably do more with this project.

I, for one, would be glad.

the_cat_kittles 2 days ago||
maybe this will finally be the solution to my tapered variable pitch helix woes. it looks cool, thanks
charlie-83 3 days ago||
Just started using OpenSCAD recently and love it. While most CAD tools have a million features to learn, OpenSCAD is completely described by a cheat sheet you could print on a piece of A4 (like most programming languages).

I would really recommend using the git master than the latest release though. The last release was 2021 but they are still actively working on it and it's much faster now.

I also have to recommend the BOSL2 library which means you don't have to implement all of those one million features from typical CAD software yourself. Its definitely got a bit of a learning curve but the fact that you can always default back to vanilla OpenSCAD and that you can actually see how stuff is implemented makes it much more satisfying to me to learn than learning what all the traditional CAD GUI buttons do.

porkloin 3 days ago||
Commenting off of you since I wrote all of this and then realized it's basically exactly what you're saying. But to +1 everything you just said in my own words:

I love OpenSCAD. I've been 3D printing for a while, but I never really got to a place where I could design interesting parts until I started to get the precision of doing models in code. Sometimes it is slower, for sure.

Every time I've used as a CAD GUI program I would get to this point where I would need to alter a single dimension by 0.25mm and realize that _all_ of my fastener holes, cutouts, etc have to be nudged with the keyboard or mouse to accommodate it. The input devices lack precision for that kind of task, and having to repeat the operation dozens of times (or bulk select) gave me a terrible sinking feeling, and I'd often just step away and give up on the design at that point out of frustration. I try to approach everything in OpensSCAD in a way that means I never have to experience that feeling again.

I will also say that doing everything from scratch in OpenSCAD would be it's own special kind of hell. Libraries like [BOSL2](https://github.com/BelfrySCAD/BOSL2) provide a good set of core ideas and preferences that help set you on a good path. A good example: BOSL2 shapes tend to have a "center origin" by default, which is different than the OpenSCAD default, but makes doing transforms later way easier.

Anyway, happy to see OpenSCAD getting some attention here :)

zargon 3 days ago|||
> Every time I've used as a CAD GUI program I would get to this point where I would need to alter a single dimension by 0.25mm and realize that _all_ of my fastener holes, cutouts, etc have to be nudged with the keyboard or mouse to accommodate it.

There seems to be some fundamental misunderstanding of CAD here. I can't imagine how you could even design something in CAD in a way that you would end up in this situation.

dcminter 3 days ago|||
I wonder if he's using TinkerCAD or something similar? I often use that, 'cos it's quick for simple things that are one-offs, but it has exactly this issue as it's not at all parametric, just primitives and booleans (though it does have some basic sketch capabilities now)

When I'm doing something more sophisticated I use SolveSpace, but I'm a lot slower with that.

porkloin 3 days ago||
yeah, op here: it's exactly that. I've used most of the free or open source software options and it seemed like none of them are parametric. I know I could buy fusion or something like that, but I found OpenSCAD before I got to that point and feel like it fits the bill for me.
le-mark 2 days ago|||
Freecad is fully parametric, set constraints so it’s 0 degrees of freedom and you shouldn’t have that problem.
sfifs 3 days ago||||
Fusion is free for personal use and in my experience at least was much faster experience than OpenSCAD.
Kerbiter 2 days ago||||
You don't necessarily need to buy Fusion, it has a well hidden free tier for personal use, just gotta dig on the site a bit.
WillAdams 2 days ago||
Sure, until the next time Autodesk decides to take a feature which you rely on out of the "free" tier.
dcminter 2 days ago||||
FreeCAD is open source and has parametric capabilities. Personally I find it unusably buggy, but apparently there are lots who don't - ymmv.

SolveSpace is open source and has parametric capabilities. It's much more limited in scope (e.g. you can't do filets) but good enough for my purposes.

I've not explored the commercial options beyond TinkerCAD, and that's not parametric. Super easy to bodge something together though :)

skybrian 2 days ago||||
I like Onshape. It’s free to use provided that you’re okay with your design being public.
Arodex 2 days ago|||
Solvespace and Onshape are free and parametric.
coldtea 2 days ago|||
>I can't imagine how you could even design something in CAD in a way that you would end up in this situation.

Are all CAD programs parametric or make their parametric functionality obvious? If not, that's how you end up in this situation.

zargon 1 day ago||
It's not about parametric functionality being obvious, it's that you can't draw something that isn't parametric in the sense described. At least I don't think I would be able to if I tried.
coldtea 1 day ago||
It's pretty trivial
Arodex 3 days ago||||
>Every time I've used as a CAD GUI program I would get to this point where I would need to alter a single dimension by 0.25mm and realize that _all_ of my fastener holes, cutouts, etc have to be nudged with the keyboard or mouse to accommodate it.

What.

This makes no sense. This isn't PowerPoint; your holes and cutouts are supposed to be parameterized. How are they even supposed to be at the proper position in the first place?

As a CAD user, this is like e.g. a coder seeing someone write code with global variables everywhere.

porkloin 3 days ago|||
I think I'm realizing that openscad was probably just the first time that parametric design options were given to me in a context where it made sense to me (in code). Maybe some of the software I've used has supported parametric positioning, but it wasn't made obvious to me. In OpenSCAD it's parametric by necessity. I said this in another comment, but the other programs I've worked with in GUI are most certainly not high end pieces of software: tinkercad, freecad, sketchup.

I'm not doing complex character model designs, I'm usually building functional prints like enclosures or cases. It certainly sounds like there are features of better CAD software that makes parametric the default?

exasperaited 2 days ago|||
I think I understand this — I mean, OpenSCAD was my brief gateway to parametric CAD, and then I got to FreeCAD via brief stepping stones of CadQuery and other packages.

But OpenSCAD isn't really parametric CAD. It's a programming language; it's parametric for that reason. But it's not really CAD, at another level, in the sense that it does nothing to "aid" your design work. It has no interim abstraction for generated geometry; everything must be explicitly described.

FreeCAD, though, is profoundly parametric, through and through, and really always has been. Indeed the parametric aspects are the main thing that made it workable before the TNP mitigations were added. It is not a limited CAD package, by any means. It's just a somewhat unfriendly one with a CAD kernel that has some limitations. Really it's almost better understood as a 3D IDE with some workflow affordances.

If you are stuck trying to get your head into how FreeCAD works, there are now three really good ways on Youtube: the Mango Jelly Solutions videos are incredible, the Shawn Hymnel/Digikey FreeCAD and 3D Printing course is good, and there are great recent videos by Deltahedra.

But what you will be able to make with it, once you get your head into it, is night and day different to what is possible with OpenSCAD. Because your parametric work in FreeCAD (or other CAD packages) can operate on the geometry of the result of previous operations.

Give it a try in the New Year with FreeCAD 1.1 when it is released.

If you want another stepping stone from OpenSCAD to FreeCAD or any other package, I really recommend you look at CadQuery/Build123D. This will give you a similar coding approach but it will introduce you to operations on the true faces, edges and vertexes of the output of other operations.

(FWIW I would not say that Sketchup is not high end, either. It's not to my tastes but it is quite powerful)

WillAdams 2 days ago|||
The one thing which I need to see in FreeCAD to be successful with it is an interface option which doesn't require a multi-button mouse, but which will work with a trackpad, or better still a tablet and stylus --- I spend 5 days a week essentially chained to a desk using a mouse (sometimes a Trackpoint) and evenings/weekends I prefer to sit somewhere more relaxing than a desk and to use a different sort of pointer.

Dune 3D seemed quite promising, but very limited --- is there a set of options for the UI in FreeCAD which will create a similar interface?

argiopetech 2 days ago|||
Check out the other mouse options. I learned FreeCAD 1.0 entirely on trackpad (Mac, no middle click).

Now, if the random crashing were fixed, that would make a real difference for me...

exasperaited 2 days ago||
I use a mac trackpad too. In “Gesture” mode now.

That mode works OK on touchscreens, in the sense that any app with tiny buttons to click does. I have tried using a tablet with a pen but it is a heavily modal UI so it feels a little bit like old fashioned light pen territory, as much CAD does. Not like an iPad app; they need designing differently.

Quite a lot of progress on macOS FreeCAD crashes because they changed an exception handling strategy for exceptions outside the Qt loop, if I remember right. Some crashing in 1.1RC that is being fixed. In general it crashes a whole lot less than it did in 0.20, say. But if you can reproduce them, definitely report them.

exasperaited 2 days ago|||
I didn’t like Dune3D; its interface is clumsy even if the 3D constraints thing is interesting.

(Which is not to say that I am not pleased to see more open source CAD packages taking different approaches. Dune3D is interesting, Blobfish's Cadseer is very interesting to a coder I'd have thought, and SALOME has obvious value)

The one small tweak I would suggest for FreeCAD is to use the tab bar workbench selector rather than the dropdown version. It’s such a small change but it helps flow between things in a way that feels like the various functions are more closely integrated. That, combined with custom panels if you want them, makes it more fluid.

(I am not making any particular claims for FreeCAD's usability; I do though think it is much better and much more learnable than the average HN perspective of it, which seems to often come across more as TUI-exceptionalism or "but I don't wannnnnaaa learn a guuuuuuuiiii". GUI CAD isn't intrinsically some inferior, imprecise, unformalised thing.)

lsaferite 2 days ago|||
> OpenSCAD isn't really parametric CAD. It's a programming language; it's parametric for that reason. But it's not really CAD

Maybe this is pedantic, but why wouldn't OpenSCAD qualify as CAD exactly? It's still "Computer-Aided Design"? Sure, the UI/UX is different, but is there some qualifier to CAD around the UI/UX?.

exasperaited 2 days ago||
It's me being picky about the meaning of the word "aided".

CAD is software to help people make complex things without having to do complex geometry/trig/general maths.

OpenSCAD doesn't really "aid" you much with this. It's a 2D/3D shape generator with boolean operations, but because it doesn't let you do constraint operations on 2D geometry, and it doesn't let you do further operations on the fundamental geometry (faces, edges, vertices) of the generated 3D solids either, it never liberates you from most of the difficult work.

I'm not even sure how much it aids you with "design": it doesn't support chamfers or fillets, it offers no tools for adding drafts or making truly uniform thicknesses. And it only generates meshes.

OpenSCAD is useful. I'm not saying it's not. But it is useful mostly for drawing strongly geometric or mathematically-derived solids and producing a mesh from it.

jazzyjackson 2 days ago||||
FreeCAD is definitely parametric but I hear you that the interface doesn't make it obvious. It might be worth another look particularly since it's interoperable with OpenSCAD and can work on CSG trees within the interface

At least you've inspired me to try it and see if it's "worth writing home about"

https://wiki.freecad.org/OpenSCAD_Workbench

JP44 2 days ago||||
If you're doing enclosures, check out Dune3d! Has been featured here as well (it's how I found it). It's pretty easy to use and feels intuitive for prints you'll only have to make once or twice. It's missing some things here or there but nothing fundamental (except trimming edges i.m.o.)

I often switch between FreeCad and Dune3d now, Freecad for things I know how to design properly and Dune when I'm in 'claying' mode. E.g. export a .step part when I get stuck in FreeCad, import it into Dune, make some progress and vice versa so I don't walk away from the project

Arodex 2 days ago|||
Oh, it is not that software like freecad is not parametric by necessity; it is just that in a parametric design process, you don't set all the parameters at once. Why? Because a) you don't overconstraint a design, and b) your parameters rely on references (a point, a line, the side of another object, a tangent), and you may want to change which reference you choose.

For example, if you put a hole in a box, do you want to reference the center of the sides of the hole? And do you want to place them relative to the left side or right side, and front or back? You never say "it's x mm from the left and y mm from the right and my box is w mm wide" - because the relationship x+y=w is always here! You only define 2 out of 3. But it may happen that you picked the wrong 2 - and a parametric CAD makes it very easy to do so in a few clicks, while a programmatic CAD like OpenSCAD is a large rewrite with calculation you have to do yourself on the side.

My example is silly but start doing big designs, large assemblies, and you "chains of cotations" may need to be redone again and again - especially when tolerances begin to add up.

tonyarkles 3 days ago|||
You would not believe how many CAD models are not parameterized. Not mine, but ones I’ve had to work with.
0_____0 3 days ago||||
A properly parameterized model shouldn't have the issue with having to nudge everything manually after a trivial change.

I had the change the height of an entire enclosure to accommodate a taller than anticipated PCB, and simply edited the sketch at the top of my design tree that defined the overall dimensions.

It took about 5 minutes to adjust the odd broken fillet and change some mates in assembly and it was done. No fidgety mouse movements. I actually do a lot of mech design on a laptop with a trackpad, arrow keys for view changes and numeric dimensioning for 95% of everything else.

abdullahkhalids 3 days ago||||
> Every time I've used as a CAD GUI program I would get to this point where I would need to alter a single dimension by 0.25mm and realize that _all_ of my fastener holes, cutouts, etc have to be nudged with the keyboard or mouse to accommodate it.

I am just starting to learn CAD and FreeCAD - also dabbled a bit in OpenSCAD. But I do know that FreeCAD has Spreadsheets [1] and Configuration Tables [2] which allows you to define your model parameterically and changes values as needed.

How good this is, I don't know yet.

[1] https://wiki.freecad.org/Spreadsheet_Workbench [2] https://wiki.freecad.org/Configuration_Tables

ElCapitanMarkla 3 days ago|||
It’s a fantastic feature and works really well, my problem is I can never invest the required time to learn the interface. It all falls apart when I need to switch modes to move something or whatever. With scad can usually knock whatever I want together pretty quickly without having to relearn how to use the tool.
MegaDeKay 3 days ago|||
Spreadsheets are really slow in FreeCAD. I'd suggest you look into Varsets [0] if you don't need some of the fancier capabilities that spreadsheets provide.

[0] https://wiki.freecad.org/Std_VarSet/en

exasperaited 2 days ago||
Yes, VarSets are definitely better (more granular dependency recalculations).

The little-known Configuration Tables aspect of Spreadsheets is absolutely worth using, though, and has no equivalent in the VarSets scheme at this point. Once you get that set up it is great fun.

RobotToaster 2 days ago||||
> Every time I've used as a CAD GUI program I would get to this point where I would need to alter a single dimension by 0.25mm and realize that _all_ of my fastener holes, cutouts, etc have to be nudged with the keyboard or mouse to accommodate it.

I can see how you would end up in that position

You need to add constraints to your sketches. In other words tell it that the hole needs to be x distance from certain lines.

If you don't do that what you get is the equivalent of hard coding a hole location in OpenSCAD. I guess OpenSCAD just forces you to think parametrically.

Also in fusion 360 make sure timeline editing is on.

amelius 2 days ago||||
I sometimes think that "parametric" is not the right description or the word is used in the wrong way.

As an example, consider a bar with a constrained length, e.g. 1000mm. I want holes in the bar every 100mm (not a strange requirement). Now I change the length constraint to 800mm. Consequently, the number of holes should change. But this seems not possible in a "parametric" modeler. Maybe I'm missing something, though.

girvo 2 days ago||||
> I would get to this point where I would need to alter a single dimension by 0.25mm and realize that _all_ of my fastener holes, cutouts, etc have to be nudged with the keyboard or mouse to accommodate it

Thats surprising! Last time I used software like this (Inventor, back in ~2005-2006) constraints meant that I didn't need to do this at all

s5300 3 days ago|||
[dead]
moebrowne 3 days ago|||
> I would really recommend using the git master than the latest release though.

This. The master version is so much further ahead of the last tagged version. The render time can be orders of magnitude faster for more complex models.

jasongill 3 days ago||
It appears that regularly-updated builds are available here: https://openscad.org/downloads.html#snapshots

or with Homebrew you can do `brew install --cask openscad@snapshot` to install the latest snapshot version.

Or, browse all the snapshot builds here: https://files.openscad.org/snapshots/

(as of this comment, the last snapshot build is from yesterday)

exasperaited 3 days ago|||
OpenSCAD isn't a CAD tool, IMO. It does nothing at all to aid your design. It barely even helps describe it in any abstract way.

It is a useful tool for programmatically describing either very simple or heavily geometric objects. For everything else it's the wrong tool.

voxleone 2 days ago||
I'd put it this way: CAD = Computer-Aided Design, i.e., software that assists in the creation, modification, analysis, or optimization of a design.

OpenSCAD clearly qualifies because it creates precise 2D/3D models; supports parametric modification; enables reproducible designs; produces manufacturable geometry (STL, DXF, etc.). The fact that it is code-based does not disqualify it. By the same logic, CadQuery, SolidPython, or FeatureScript would also not be CAD - which is not a position held in engineering practice.

exasperaited 2 days ago||
I am not disqualifying it because it’s code-CAD. (I think it’s a bad language design but that is a total aside)

CadQuery, Build123D, Featurescript etc. all have something OpenSCAD does not have: they all have facilities to operate on generated geometry such as edges, faces and vertices. So they have generalisable operations, and they can output pure geometry representations as STEP/IGES. Featurescript presumably also allows access to sketch constraints. (Build123D is beginning to add those I think.)

These are the things I think are necessary to “aid” design, because they are the things that begin to abstract away the mathematics. OpenSCAD never does. So it “aids” design little more than any pixel graphics library aids 3D software developers.

And it does not, in fact, create precise 3D models! It produces mesh representations of them. So it cannot, by definition, produce a precise representation of a cylinder, sphere, cone or curve.

The 3D models from OpenSCAD are not highly manufacturable at all, except with additive production techniques. STLs do not make good inputs for a CNC (nobody will tell you that is good engineering practice).

WillAdams 2 days ago||
STLs for subtractive CNC may not be good engineering practice, but it is quite workable as MeshCAM has shown:

https://www.cnccookbook.com/meshcam-great-ease-of-use-in-a-3...

exasperaited 2 days ago||
I am pleased MeshCAM exists, I am pretty sure I will end up using it!

But I think we agree that mesh formats don't make good engineering interchange outside additive manufacturing.

Personally I think they often make a bad format even in additive manufacturing. They are the right format for medical/dental, and yes, slicers make internal STL-ish mesh representations of STEP etc. before slicing, but they are much harder to modify precisely than STEP.

WillAdams 1 day ago||
If you have to modify an STL, you're doing something wrong --- go back to the original/source file.
exasperaited 1 day ago||
Well this is true, but it is STL files that people send around everywhere and publish in the 3D printing world, especially.

People will reasonably choose not to publish their original designs but can only publish STL because of OpenSCAD, Blender and because of the free tier of commercial CAD.

And having the OpenSCAD source doesn't help that much; you can modify it but you are still stuck with STL. OK so FreeCAD can reinterpret some — not all — OpenSCAD operations in a bRep context. But it's not a great way to work; it doesn't really help much with interchange.

I absolutely have had to modify STL files for people because that is the only interchange format the designer made available to them, or even could make available because they used the wrong tool for the job (like Fusion's free tier). At this point there are many STL-folk-song designs out there, CC-NC, with bad geometry, non-centred exports, etc.

Thankfully there are ways, in core FreeCAD and in a third party workbench (MeshRemodel), to more easily extract and reconstruct some key geometry from a mesh, such that parametric modifications can be made. (Whereas with OpenSCAD you're basically stuck with cut-out-and-roughly-refill).

cm2187 3 days ago|||
Agree but you quickly run into its limitations. Like if you 3d print something, you need to eliminate when possible sharp edges. That's not fun to do with OpenSCAD.
m4rtink 3 days ago||
BOSL2 can help with that:

https://github.com/BelfrySCAD/BOSL2/wiki/rounding.scad

https://github.com/BelfrySCAD/BOSL2/wiki/Tutorial-Rounding_t...

m4rtink 3 days ago|||
BOSL2 is SO nice and powerful, can also highly recommend it! :)
gortok 2 days ago||
Can you link to this cheat sheet?
WillAdams 2 days ago||
Presumably:

https://openscad.org/cheatsheet/

Note that updating it is one of the blockers for a new release, so it doesn't include some newer features/syntax

There is also:

https://cubehero.com/2013/11/19/know-only-10-things-to-be-da...

FWIW, when I need to rough something out in OpenSCAD, I usually use:

https://www.blockscad3d.com/editor/

yoan9224 2 days ago||
OpenSCAD is perfect for the "programmer's brain" approach to CAD. Being able to parametrize everything means I can design something like a project enclosure once, then generate variants for different screen sizes or component layouts by just changing a few variables.

Pro tip: Use the latest nightly build and switch to the Manifold backend in preferences. Render times drop from minutes to seconds for complex models. The official 2021 release is painfully outdated.

Also, the BOSL2 library is essential - it adds proper filleting, rounding, and attachment operations that vanilla OpenSCAD lacks. Makes the difference between toy projects and actually useful designs.

The Git-friendliness is underrated too. Diffing .scad files is trivial compared to trying to understand what changed in a binary Fusion 360 file.

s0rce 2 days ago|
hmm, I didn't know about the BOSL2, I was struggling with fillets and chamfers, you basically had to figure out how to define them somehow which isn't really straightforward. Been using FreeCAD mostly which still has weird issues with fillets sometimes.
WillAdams 3 days ago||
The great thing about OpenSCAD is that it makes it easy to 3D model things which may be described using spheres, cylinders, and cubes which are stretch, and/or rotated, and arranged in 3D space.

The awful thing about OpenSCAD is that what one can model in 3D is limited by one's ability to mathematically stretch, rotate, and/or arrange spheres, cylinders, and cubes in 3D.

For folks who want "real" (read mutable in normal terms of scope) variables there is a Python-enabled fork (which should become part of the main release presently:

https://pythonscad.org/

IgorPartola 3 days ago||
Not just that but it also positions everything in absolute coordinates and does not have the ability to reason about solids, just surfaces. Basically if you want to model something like a bolt you need to create a cylinder for the shaft, a separate head of the bolt, and then a thread profile you can rotate around the cylinder. You must ensure there is enough overlap between these three separate parts so the resultant object is a single surface and not three separate ones.

You can use modules to create a semblance of relative measurements but you still cannot do things like “attach this surface of object A to that surface of object B)”. In practice this means that if you want to create something like a spacer or a bracket you can do that easily enough. But if you want to make a part that matches some real world design you are stuck doing a lot of caliper measurements and math to try to create a part that lines up correctly. The you 3D print it and find that you positioned some hole based on its edge and not center and so nothing quite fits.

OpenSCAD is easy to start but difficult to scale because of these limitations and because once you hard-code any measurement you are stuck with it. The “proper” way to do this is to give everything a variable but honestly that makes reasoning about how to line things up even more difficult. “Does base_width include the width of the vertical walls? What about the margin to make the parts fit together?”

I have never been able to understand how things like FreeCAD lay out their UI. TinkerCAD is relatively simple but clearly a lot less powerful. I did try cadquery which solved a lot of OpenSCAD’s issues by having all offsets be relative by default but also introduces a few issues of its own.

One tip I will give about OS: grab a copy of the latest beta/dev release. The renderer is several orders of magnitude faster.

c0nsumer 2 days ago|||
> You must ensure there is enough overlap between these three separate parts so the resultant object is a single surface and not three separate ones.

(Post author here.)

This was a very weird thing to me I ran into and have thus far just sort of... accepted.

In Fusion, and other CAD software, if I have two faces end at the same point, unless I've specifically said to create them as separate bodies, they are joined, because they share a plane.

In OpenSCAD, in the tutorial, it has you extend an object 0.001 to ensure they overlap. To quote:

> In the example above, the second cube sits exactly on top of the first cube. This is something that should be avoided, as it’s not clear to OpenSCAD whether the two cubes form one object together. This issue can be easily solved by always maintaining a small overlap of about 0.001 - 0.002 between the corresponding objects. One way to do so is by decreasing the amount of translation along the Z axis from 10 unit to 9.999 units.

This struck me when making the example in my post. In line 47 I specifically add 1 to heightCompartment to ensure the opening extends past the top of the main body. If I didn't do that, this happens during preview: https://imgur.com/a/Amc1dK6 (That's an exported image from the latest nightly of OpenSCAD.)

But it doesn't happen during the actual render?

Still, that just feels... like there's something going on with a floating point value or something which, programatically, is probably correct... But from the perspective of someone trying to design something feels Very Wrong. Because I have a 20mm high box, I subtract a 19mm high box from it, starting 1mm up from the base. Why shouldn't the top be open? Why is it acceptable for it to be maybe kinda open but broken by design?

don-bright 2 days ago||
Floating point numbers are not closed under addition. They are not real numbers and not rational numbers. FP is on a grid whose size changes the farther you get from 0,0. For example 0.1 doesnt exist in fp nor does any number not representable by binary fractions. Also its a quirk of opengl and most 3d renderer to get issues when one surface coincides with another so the preview renderers like the little bumps. Also the underlying CGAL rendering kernel can be problematic when planes are almost nearly coincident but not one hundred percent. Finally OpenSCAD has an internal grid it tries to snap things to which can also cause issues. Not sure if the new Manifold renderer has these issues but in general the loss of info from ascii decimal to FP is the source of most of the problem. Those professional cad programs have enormous resources behind the scenes to make that stuff appear easy when its actually very complex and basically an illusion. Rotating anything using sine and cosine instantly loses information so planes with more than three points become non planar ever so slightly. So this assembly you made with “two surfaces touching” is not touching after rotation due to sin eing transcendental function simulated on a computer with finite time and memory. For example. These fancy CAD systems all have ways to deal with this.
c0nsumer 2 days ago||
Thanks for explaining that; that makes sense.

I still don't /like/ it because it seems I'll need to add in some sort of 0.001mm overlap into the code if I want to ensure this doesn't become a problem. And this feels like a messy way to go about it.

somat 3 days ago||||
> but you still cannot do things like “attach this surface of object A to that surface of object B)”

Sure you can, but openscad is an imperative language so you need to do it in an imperative manner.

    a_cube_loc = [10, 5, 5];
    a_cube_size = [2, 4, 1];
    b_cube_loc = [a_cube_loc[0], a_cube_loc[1] + a_cube_size[1], a_cube_loc[2] ];
    b_cube_size = [2, 4, 1];

   translate(a_cube_loc) cube(a_cube_size);
   translate(b_cube_loc) cube(b_cube_size);
It would be nice to have more declarative constraints. The solvespace file format is plain text and it almost feels like you could write it by hand, but that would be a lot of manual record keeping. and you would loose all that imperative goodness. Perhaps you could have an imperative layer(say python or lisp or forth) that outputs the declarative layer(solvespace) and then solvespace renders(picture or stl) the declarative layer.
WillAdams 3 days ago||
I think a text input option for Solvespace which was optimize for readability and usability would be _very_ interesting approach, esp. if Solvespace was able to write back out to the same format, and it allowed math/variables/parameters and supported the same in the UI.
coryrc 3 days ago||||
BOSL2 allows attaching when you define attachment points or something with attachment points defined for you (most everything in BOSL2).

Manifold backend also eliminates the need to avoid coincident faces.

IgorPartola 2 days ago||
Can you explain this a bit more? Might be the after effects of the COVID/flu vaccine I got yesterday but I am not picking up what you mean.
coryrc 2 days ago|||
Consider making a standoff: a hollow cylinder. You take a cylinder primitive and subtract a cylinder primitive with a smaller radius. If they have the same height, the top and bottom faces of the cylinders are exactly the same plane, which the Preview gives odd effects. The old recommendation is to name your subtracting cylinder taller and shift it down a little, so those faces don't share a plane. Manifold doesn't care.
coryrc 2 days ago|||
Oh, maybe you mean attaching.

https://github.com/BelfrySCAD/BOSL2/wiki/attachments.scad

m4rtink 3 days ago||||
Let me introduce to the awesomness of the BOSL2 screw module:

https://github.com/BelfrySCAD/BOSL2/wiki/screws.scad

IgorPartola 2 days ago||
This is amazing but the first time I needed to make a screw I needed to make one that used the NPT standard which this module still does not cover :)
ur-whale 2 days ago|||
> I have never been able to understand how things like FreeCAD lay out their UI.

I'm 100% with you there. One of the most utterly confusing UI I've had to deal with.

And I suspect the answer is : the FreeCAD devs don't either.

RobotToaster 3 days ago|||
> The great thing about OpenSCAD is that it makes it easy to 3D model things which may be described using spheres, cylinders, and cubes which are stretch, and/or rotated, and arranged in 3D space.

It also has hulls and minkowski sums, which are powerful once you understand them.

WillAdams 3 days ago||
Aren't hulls just a direct connection of the edges of two shapes (which could be simulated by a series of duplications) while Minkowski is "just" a matter of putting spheres along the edges of an object to round the straight edges?

So, spheres and cylinders and cubes placed, rotated, stretched and placed mathematically.

bashkiddie 1 day ago||
A hull requires at minimum one shape and returns a convex shape.

A minkowski sum, as far as I understand it, requires a surface and a volume and returns a volume.

Example 1: apply hull() to a star shape

Example 2: You want to fold a picture (SVG) around a cylinder and make its edges FDM printable by 45 degree overhang, apply a cone to the image

culi 3 days ago|||
There's also OpenJSCAD. Which, being JavaScript ofc, can run in the browser

https://openjscad.xyz/

https://github.com/jscad/OpenJSCAD.org

xixixao 3 days ago|||
From my testing, the CSG operations, with post-processing, don’t produce watertight meshes. And being focused on printing, it doesn’t support different colors for the CSG operands. My use case is animation/games, so I’m reimplementing the CSG with a watertight b-rep.
rafabulsing 3 days ago||||
Re: JS based CAD, there's also replicad, which I've used previously and found to be really good.

https://replicad.xyz/

spwa4 3 days ago|||
Don't people think this is one tool that would greatly benefit from using the very fastest languages available? Where's the C++, Rust, maybe even FORTRAN version?
htgb 3 days ago|||
This is only the language for describing the volumes. That's not heavy, rather the importance is that you can express the ideas you want. The heavy lifting of rendering and computing how volumes interact etc is already implemented in native code.
WillAdams 3 days ago|||
My understanding is that the core of OpenSCAD is done using C++.

If you wish to use Rust for 3D modeling directly there is:

https://fornjot.app/

(the developer of which is actually working on a BREP kernel)

jandrese 3 days ago|||
You can also make more complex shapes if you're willing to define points, even on a 2D plane that you can then extrude. Downside is that it's basically a MENSA test to define all of the points in the correct order. I've done it a few times, but it's never fun.
anthk 2 days ago||
Solid of revolutions and Bezier curves. That and some elementary Calculus will help everyone a lot.
coryrc 3 days ago|||
Also you can use the new backend by writing C++: https://github.com/elalish/manifold

Which avoids using the OpenSCAD language, but also means you can't use BOSL2. Might as well use FreeCAD.

pca006132 2 days ago||
It has many language bindings, including python and js. Though the js backend is not parallel because it uses wasm, and we had problem with mimalloc memory usage with pthread enabled.
coryrc 2 days ago||
That's true, if you use i.e. Python you can use numpy for custom matrix math, but using C++ you can just do anything and it'll be pretty fast.
tombert 2 days ago|||
I think people should also give Bowler Studio a shot. It has a pretty decent Java-based CAD thing, and it even has built in Clojure support, with physics simulation support and everything. I really like it.
JoshTriplett 3 days ago|||
Another interesting option is FreeCAD, which is scriptable in Python but its primary interface is a GUI. So you can use a script to create things programmatically, edit graphically, or both.
criddell 3 days ago|||
FreeCAD sounds great but in practice it’s sooo slow.

If you are coming from SolidWorks, Fusion360, Inventor, or OnShape, it won’t take long before you start finding that there are a lot of things missing from it.

zihotki 3 days ago||
I'm coming from Fusion, advanced hobbyist, I can't find anything missing. </anecdata>

There is a problem though - sometimes what you want requires deep understanding. It's less user friendly, polished, and documented. That's also relevant to the performance - it's easy to cause performance issues. But I remember the same was also applicable to Fusion.

Animats 3 days ago||
Of course FreeCAD is less user friendly, polished, and documented. It's open source. Open source people do not get GUIs. They think command line. It's taken decades for artists and graphic designers to nag the GIMP and Blender people into usable interfaces, and they're still inferior to Photoshop and Maya.
WillAdams 2 days ago|||
Isn't the Python scripting in FreeCAD just a direct representation of the internal object model?

It's _not_ something which was designed for ease of use, or rational semantics, or to facilitate expression.

ai-christianson 3 days ago|||
I've had really good luck with https://github.com/SolidCode/SolidPython
ur-whale 2 days ago|||
> https://pythonscad.org/

Thanks for this, didn't know about it.

How does that compare to solid python 2?

https://github.com/jeff-dh/SolidPython

WillAdams 2 days ago||
It's native and more direct.

Rather then adding an additional compile cycle:

- run Python code to generate OpenSCAD code

- render OpenSCAD code to see output

OpenPythonSCAD creates a .py code window in the OpenSCAD interface which one interacts with in the same way as a .scad code window (there's even basic support for the Customizer).

I suspect it would be really easy to port SolidPython to work w/in OpenPythonSCAD (if it hasn't already been done)

NortySpock 3 days ago|||
I ended up adding the https://github.com/BelfrySCAD/BOSL2 library to OpenSCAD and it had some reasonable options for some gear and rack-and-pinion modeling that I needed to do.

(3D printing a sacrificial gear for a seat position adjustment mechanism)

TOGoS 2 days ago|||
> The awful thing about OpenSCAD is that what one can model in 3D is limited by one's ability to mathematically stretch, rotate, and/or arrange spheres, cylinders, and cubes in 3D.

Not at all. You can build any polyhedron you want using the polyhedron command.

Which would be an enormous pain to write out by hand every time, but I wrote a function once upon a time to generate a polyhedron from a stack of layers, each of which is a list of points, and haven't had to mess with old cubes and spheres since.

One annoying thing is that the default way of writing programs in OpenSCAD uses 'modules', which are a bit limited compared to functions (you can't store them as values to to functions or other modules). I worked around that by writing a module that interprets arrays (think S-expressions) that representing the shape, and then just build up that S-expression-like thing with functions and whatever.

Once you've built your own programming language inside OpenSCAD it's perfectly usable. :-)

This might sound like sarcasm but I actually do prefer this to dealing with Python's mutable state jungle / package management nightmare.

WillAdams 2 days ago||
Fair point.

This sounds _fascinating_ have you posted your code or written this up in a math journal? Link?

I don't touch polyhedrons in OpenSCAD because the logic of point placement mystifies me --- a tool such as you describe would make life a lot easier for a lot of folks, esp. if there was a way to use it to import a series of SVG files which could be used to define the points interactively.

I sometimes wonder if the key to future computer usage would be a series of Domain Specific Languages each intended for a given task:

- 3D == OpenSCAD

- 2D == METAPOST

- SQL == databases

- TeX == text/page composition

- sed == text

(and yes, I know this is the Unix ideal)

but such languages seem to be most successful and most approachable to typical users when they are paired with a front-end which affords editing, previewing, and, direct interaction.

I'm actually nuking my Python install right now, because I got it into a state where I couldn't get Fullcontrol G-code to run, so I agree that the state of Python package population is pitiful, hence of course, the XKCD:

https://xkcd.com/1987/

TOGoS 2 days ago||
An example of an OpenSCAD design written this way: https://github.com/TOGoS/OpenSCADDesigns/blob/master/2023/ex...

I wrote about the approach a little bit in this Reddit post: https://www.reddit.com/r/openscad/comments/186b54r/interpret...

The interpreter itself is just a single module: https://github.com/TOGoS/OpenSCADDesigns/blob/master/2023/li...

M_bara 3 days ago||
Or perhaps take a look at cadquery? It’s also pretty neat - http://cadquery.readthedocs.io/
elcapitan 3 days ago||
For me as a casual 3d-modeler, my favorite thing about OpenSCAD is that I don't have to learn a new application the size of Photoshop with everything hidden 7 levels deep in some menu that is probably intuitive for some people who learned CAD in the 80s.

Instead it's basically like graphics programming, with a couple of basic primitives, some linear transformations and a bit of set theory. When I do a model a month and get back to previous work, I read a few lines of code and know exactly how I achieved the result.

unbelievably 3 days ago|
I was once a big OpenSCAD user myself but I'm really skeptical that there are many use cases where it's actually more intuitive than a traditional CAD program, even if you're a programmer. It's true CAD programs have a huge amount of features but the basic sketch, extrude, revolve, and loft tools aren't conceptually difficult and are basically the same between Onshape, Fusion, Solidworks, etc. Those tools are sufficient to make 99.99% of OpenSCAD models I'm seeing.

I also have the opposite experience about understanding previous scripts. Unless it's dead simple I'm usually thinking why the hell did I multiply this thingy by sqrt(3)/2 plus this other thing. Maybe a documentation problem, but it's inescapable that sometimes you need a lot of math for what are trivial constraints in an interactive sketch. A real CAD program will let you roll back to any feature to figure out how it's constructed step by step so there's really nothing to decipher.

IshKebab 3 days ago|||
Yeah I agree. OpenSCAD is good for highly parametric modelling: fasteners, gears, generative art, ... that's about it. Most things aren't like that, and a traditional parametric CAD program is 10x easier.
WillAdams 3 days ago||||
I've been trying to model joints for woodworking, and in traditional tools, the shapes I wish to arrive at verge on nightmarish, while I was able to knock them out in OpenSCAD in pretty short order --- except that when I sent a 1" x 2" x 1" test joint to a CAM program, it took some 18 minutes and generated a ~140MB G-code file, hence my working on:

https://github.com/WillAdams/gcodepreview

wat10000 2 days ago|||
The older I get, the less I want GUIs. If I want to rotate something, I want to type “rotate,” not find the rotation icon or menu item or remember the keyboard shortcut or whatever.

I know this is not typical, and nothing against folks who see it the other way. But OpenSCAD fits the way I think and want to work better than the more “normal” tools.

convolvatron 3 days ago||
I love the model, it's nice to be able to generate things parametrically instead of grabbing knots with the mouse. so I use scad pretty often.

but it has real problems - the language is weird and unfortunate. not anything super fatal, just the obvious product of evolution that would be more cohesive if it were architected wholesale

  epsilons are really unfortunate. you have to expect that after getting what you want in the whole, you're going to have to scan over the whole thing and look for cracks or collision where there shouldn't be 

  performance is quite sad. here you are happy going back and forth between the view and text windows, but as you go on, it starts taking .. minutes.. to update the view once you have a reasonably complicated geometry

  high-level operators would also be nice. I made the mistake of using a thread library once, not only did that make my model unrenderable, there was so much noise in the model and the manufacturing process I had to make 3 expensive test prints in sintered nylon to get the fit right. (I'm thinking an annotation on a cylinder that says 'standard 1mm thread')
MattRix 3 days ago||
It actually renders things incredibly fast if you get the nightly version and set the backend to Manifold. It is probably 100x faster (!!). In fact it renders so fast that I put a render() command at the top of my hierarchy so that everything just renders all the time, it’s faster and more performant. I make incredibly complex models with it too, with hundreds of holes, complex svg files with text in them, etc.
coryrc 3 days ago||
Why not just press F6 instead?
MattRix 2 days ago||
It does it every time I save the file instead, basically the regular openscad workflow of update-on-save, but instead of doing a preview it’s just full rendering all the time.
WillAdams 3 days ago||
If you're inclined to use Python there is:

https://pythonscad.org/

Brian_K_White 2 days ago||
It's a lot of work to make models that are useful in real life, but for some things it's worth it because it's sooo nice having 2k of plain text that describes an entire object, and it's even fully parametric, and it even comes with a customizer panel for the parameters, so every model isn't just a model, it's a model generator app, and even has meaningful diffs in git.

The same model in freecad is like 6 megs of zipped xml and realistically not nearly as usefully parametric.

That couple-k of plain text is such a huge deal that it makes all the other difficulty worth it for mechanical/functional stuff.

dheera 2 days ago||
OpenSCAD is the only CAD tool I use. I can'd figure out how to operate a graphical 3D software with a 2D GUI so it's just easier to describe things mathematically.

I just wish it had operations for subtractively chamfering, rounding, etc. as doing minkowski() with cones and spheres to achieve that result can be unwieldy.

Brian_K_White 1 day ago|||
A few years ago I made a little module rounded_cube that generates a cube by drawing 1/8 spheres wrapped in hull, andnsince then I've been using that for everything, making inside fillets by using a rounded cube as a cut shape. Since it can generate a hollow box with a desired wall thickness, you have the shell of an enclosure box in a single call.

Over time I added other things like a single linear fillet, a single radial fillet, both interior and exterior, convenience things built out of those like a screw post with a fillet base etc. But really I always end up just using mirror_copy and rounded_cube a lot.

There is a scifi book series aboit a programmer who gets zapped into a fantasy world that has magic, and he becomes the most powerful wizard in the world because he applies the coding concept of reusable components and building big things out of smaller things and automation, which none of the other wizards ever thought of.

openscad is like that. To get anywhere you first have to build a library of useful higher level things out of the low level things. Like forth or assembly, or really all programming I guess.

derkades 2 days ago|||
Do you know about BOSL2? It can do rounding or chamfering very easily.

cuboid([20, 20, 30], chamfer=5);

bb88 2 days ago||
I find that I'm often making one-offs. I take a part I designed and I need a slight modification for it for some reason.

Fusion is great for that as long as there's not too many parts. But sometimes I'll want a new variant or a series of new variants.

And reaching for python makes that easy.

anfractuosity 3 days ago||
It's super useful, been using with my 3D printer to print things such as an adapter to connect a Canon EF lens to night vision tube and parts to link motorised linear stages together.

Currently I'm playing with a gear library which is part of BOSL2 (https://github.com/BelfrySCAD/BOSL2/wiki/gears.scad), to make something to rotate a polariser in my microscope.

jacquesm 3 days ago||
It is amazing. I spend more time in OpenSCAD than in any other program I use and I'm amazingly productive with it. 3 to 4 cycles / day, the longest time is waiting for the printer to cough up the next iteration, then it is building debugging and improving again.

The power of parametric cad is such that I wouldn't be a 10th as productive using an interactive cad system. And because it is effectively software you are writing (even if it compiles into physical objects) you can use all of the goodies that you can use to manage software. Diff files, git, kompare, branching, merging. It is nothing short of amazing, it is like I have a design team and a prototype injection molding facility in one. And the turnaround time is something you'd have killed for in the 90's.

echoangle 3 days ago|
> The power of parametric cad is such that I wouldn't be a 10th as productive using an interactive cad system.

This sounds like parametric and interactive CAD are polar opposites. Normal CAD software is generally parametric too.

The other points about the advantage of text files still applies though.

jacquesm 3 days ago||
'Normal' cad software is parametric in an entirely different sense. You don't normally build up from entities just like you would in software, which you can then manipulate symbolically.

There are cad packages that can do this but unlike OpenSCAD the main interaction there is the 3D window, not the text editor.

Though AutoCAD of course had this with AutoLISP since 1986.

Interestingly, I'm not sure which has the steeper learning curve, OpenSCAD or AutoLISP. OpenSCAD is really great once it clicks but most people give up long before then.

avmich 2 days ago|||
Interesting to read that. I don't remember any learning barrier for OpenSCAD, while FreeCAD and Rhino3D took many days before I had to put it down. I guess people differ...
WillAdams 2 days ago||
Same.

Two 3D CAD tools which seem to be focused on ease-of-use are:

- Dune 3D --- this has been discussed here a couple of times (I think I posted the two most active posts elsethread)

- Moment of Inspiration --- created by the developer who created the program Rhinoceros 3D was based on and who was the lead developer for that program for years, it focuses on ease of use and apparently started with the idea of making a CAD Program suited to use on a computer pen tablet --- there's a video series: https://www.youtube.com/playlist?list=PLUilfM8GEmrS3yRLygdFO... which makes it seem very approachable

jazzyjackson 2 days ago|||
Iirc autolisp applies to 2D drawings, so it's not a competitor for generating meshes

Mathematica however is Lispy enough and has a lot of helpful geometry primatives and can export STL

nayuki 1 day ago|
> One part that confused me is how I needed to use let() to define startColumn and startRow inside the loop. I don’t understand this…

That's because you wrote a for-loop without braces, so it can only contain a single statement, and that single statement is your let().

Here is an equivalent way to write that section of code (and I did test it):

    for (r = [ 1 : numRows ]) {
        startColumn = ((c * thicknessWall) + ((c - 1) * batteryType));
        startRow = ((r * thicknessWall) + ((r - 1) * batteryType));
        translate([startColumn, startRow, thicknessWall])
            cube([batteryType, batteryType, heightCompartment + 1]);
    }
Side note, related to declaring variables but not an issue that you encountered: OpenSCAD does not allow setting the value of a variable more than once. So this code is illegal:

    x = 1;
    echo(x);
    x = 2;
    echo(x);
Second note is that whenever you introduce a construct such as {union(), difference(), if(), for()}, variables declared within the braces are scoped, so they don't exist between iterations or after the scope ends.

    if (true) { y = -1; }
    echo(y);  // Illegal
However, just introducing braces without a construct does not restrict the variable to the scope:

    { z = 5; }
    echo(z);  // Legal
More comments...