8 ms·
If you want to do code-CAD for anything substantial and you haven't yet developed a significant dependency on OpenSCAD, do your brain a favour and spend at leas
by throwgfgfd25 2y ago
If you want to do code-CAD for anything substantial and you haven't yet developed a significant dependency on OpenSCAD, do your brain a favour and spend at least some time with CadQuery, Build123D or (if you prefer JS to Python) Replicad.
As impressive as NopSCADlib and BOSL2 are (and OMG they are, when you consider what they have to work with!), OpenSCAD is a one-way, declarative CSG environment that essentially only outputs mesh formats. It's really not that much better than working with three-dimensional pixels. You won't really be able to analyse, iterate over or measure your models, easily build on faces, do easy chamfers or fillets, export STEP files, make use of constraint-based designs, model assemblies, or so many other things that "CAD" means in the 21st century. All the tools that help you do this on OpenSCAD are layers and layers of task-specific hacks and clever bodges.
I totally get wanting to make models with version-controlled text files instead of GUI CAD (which can be a sort of weird battle to learn for a programmer), and I get wanting to avoid FreeCAD. I just don't really get wanting to limit oneself to such a limited concept of a 3D "model"!
The three alternative systems I mention are all based around bindings to (or in Replicad's case, cross-compilation of) OpenCASCADE, which is a bRep CAD kernel capable of much richer interactions. It is not without its faults, but arguably code-CAD spares you from some of the inscrutability that trips up FreeCAD's interactive model.
- ajross 2y agoThat is... a weird post to be making from a throwaway account. Do you work for Big OpenSCAD or something? :) But that said, this is all correct. OpenSCAD is actually an extremely limited environment and much more expressive tools exist in the same "code-based 3D modelling" space.
- IBCNU 2y agoThat's my experience trying to use OpenSCAD from the cli for some home remodeling projects, there I was, neo-vim open, trying to do 3d with pure text files. But at the end of the day the platform felt very limited. Also "Big OpenSCAD" is hilarious.
- abetusk 2y agoThe operative word being "open". Much more expressive tools exist but the condition on libre/free/open reduces the size of that list substantially. OpenSCAD also has a lower barrier to entry in that the programming language and environment is familiar without needing a lot of training or context.
- throwgfgfd25 2y agoThe three I suggested above are absolutely as open as OpenSCAD. (With the addition of developer openness: directly meshing with Python or JS libraries)
- abetusk 2y agoNice, my bad!
- throwgfgfd25 2y agoThis is a totally reasonable question! I am using a throwaway to limit my HN usage, to be honest. I wish I had a better way to manage my addictive social media behaviour than torching accounts after a few discussions. But I do not. I saw this thread only because it's clearly a followup to the FreeCAD discussion the other day that I have contributed to. -- People do get oddly grumpy when you criticise OpenSCAD; there is an element of the "I can do maths and refuse to believe CAD needs to be any more than this" militancy about it. I absolutely don't hate it -- OpenSCAD's mere existence is what unlocked my ability to even reason in 3D, actually. But that quasi-militant tendency is holding back a fascinating, liberating software field.
- nrp 2y agoThis viewpoint resonates for me. OpenSCAD is a useful tool for hacking together 3D parts quickly, but an excellent tool for exercising the shape rotating parts of your brain.
- throwgfgfd25 2y agoIt's also good if your aim is to visualise maths.
- WillAdams 2y agoThere is actually a book on geometry which takes advantage of this: https://www.goodreads.com/book/show/58059196-make https://www.goodreads.com/book/show/58059196-make which has since become a series including: Trigonometry: https://www.goodreads.com/book/show/123127774-make https://www.goodreads.com/book/show/123127774-make Calculus: https://www.goodreads.com/book/show/61739368-make https://www.goodreads.com/book/show/61739368-make Currently working through a library using the new Python-enabled OpenPythonSCAD, and at the end of it, hope to work on a project which requires conic sections (which I'm still researching, so if anyone has any good resources on that I'd be glad of them).
- throwgfgfd25 2y ago
- wiw2 2y agoI poked around with CadQuery and Build123D. The learning curve required a paradigm shifted in abstraction. That was too much. I just want OpenSCAD simplicity, but with modern programming language syntax. I ended up settling with PythonScad. I was able to hit the ground running and leverage what I already know about python within a day. It's new, but the author is extremely active and collaborative on github (https://github.com/gsohler/openscad https://github.com/gsohler/openscad) and reddit (https://www.reddit.com/r/pythonscad/ https://www.reddit.com/r/pythonscad/). The author actually pushed for merging this into OpenSCAD mainline, but got gatekeeped out since OpenSCAD maintainers believed Python went against OpenSCAD's mantra of being 'secure'. I recommend PythonSCAD to anyone that liked OpenSCAD simplicity in abstraction but feel handicapped by the lack of expressiveness.
- throwgfgfd25 2y ago> The learning curve required a paradigm shifted in abstraction. This is true! And I think that brute-force simplicity of OpenSCAD is the appeal. I am still ultimately a CAD greenhorn but it got me started, and I don't blame you. But I guess the point I am getting to is, that paradigm shift is where you really want to be. It's certainly where I think most competent programmers who want to really build in 3D should want to be. Because it unlocks the ability to reason about the shapes you're creating, within the code that creates them. You can for example place a feature in the centre of a face of an object you just created, without having to recalculate the location of the centre of the face or the normal etc. You can write code that is truly parametric with real encapsulations, and without a battery of variable definitions and calculations for every single element -- because you can reflect on what you've already made. (You can also export STEP files to other packages, import STEP files and reason about/analyse those as objects rather than meshes.)
- wiw2 2y agoThankfully I have been able to do what I want to do without learning the complexity that comes with Build123d etc. Perhaps someday, but I havent had the need to get there thus far. Also: Encapsulation etc was achievable with Python, which is something I already know. PythonSCAD checked all the boxes for me without the learning curve.
- philsnow 2y ago> OpenSCAD is a one-way, declarative CSG environment that essentially only outputs mesh formats This is why such a basic-seeming thing as “how do i get the bounding box for this CSG frankenobject I’ve created?” comes up again and again on stackoverflow etc. it’s apparently not possible without some hacks. I’ll take a look at the alternatives you mentioned, thanks.
- criddell 2y agoI’d recommend taking a look at SolidWorks. For hobbyist use, it’s $50 / year or $15 for a month. You will save yourself so much time and headaches and develop a skill that could be useful for your resume.
- WillAdams 2y agoIf you're a U.S. (or Canadian) Veteran it's $20/year. BUT for these reduced price options, it's the educational version, and the files are watermarked, and the license precludes commercial use. That said, if your goal is to learn a CAD program and get a job --- in an industry/region which uses Solidworks_ (for some reason, CAD usage seems to be specific to either certain industries or regions, though SW is almost certainly the most widespread), that is definitely the way to go, along with a Community College course/degree and/or a training certificate: https://www.solidworks.com/solidworks-certification-program https://www.solidworks.com/solidworks-certification-program
- Filligree 2y agoOr OnShape, which isn't quite as capable, but is free and probably easier to learn.
- avhon1 2y agoSiemens Solid Edge is also available in a free community edition. https://resources.sw.siemens.com/en-US/download-solid-edge-community-edition https://resources.sw.siemens.com/en-US/download-solid-edge-c...
- 2y ago
- junon 2y agoComing from freecad as my only frame of reference, even though I understand the concepts of build123d, I found it wildly difficult to express anything useful in it. Not saying it's not possible - I've seen what it can do - but even with my software background it was hard for me to really work with something that isn't based on constraints.
- throwgfgfd25 2y agoI ultimately went the other way, and got to FreeCAD from OpenSCAD via CadQuery; it was CadQuery that helped me understand important concepts. CadQuery may appeal to you? It does have (some) early support for constraints in 2D and 3D I believe. (CadQuery and Build123D ultimately share both OCP underpinnings and viewer tooling.)
- microtherion 2y agoThe alternatives you suggest look interesting and worth checking out. I certainly have my annoyances with OpenSCAD, but one reason I keep coming back to it is that many of my models have user adjustable parameters, and as far as I know, OpenSCAD is the only tool supported by the thingiverse customizer. Personally, I rather like the constraint based approach in FreeCAD and miss that a lot in OpenSCAD.
- throwgfgfd25 2y ago> and as far as I know, OpenSCAD is the only tool supported by the thingiverse customizer I am sure you are right that this is still the case. This is a big plus for OpenSCAD. One of the alternatives I mention takes customisation to a different level that makes me hopeful. Replicad can be used as a library in a web app: https://replicad.xyz/docs/use-as-a-library https://replicad.xyz/docs/use-as-a-library And they have a demo here (a React app): https://sample-app.replicad.xyz https://sample-app.replicad.xyz
- jdevy 2y agoTo add, there's a new CAD kernal that is in slow development called truck [1]. Is is written in Rust and you script/make models in Rust. It doesn't have any geometric constraints though. There was a very short attempt at starting to make a GUI for truck [2] but development has seemed to have halted. There was discussion and hype about this here a couple months ago [3]. [1]: https://github.com/ricosjp/truck https://github.com/ricosjp/truck [2]: https://github.com/CADmium-Co/CADmium https://github.com/CADmium-Co/CADmium [3]: https://news.ycombinator.com/item?id=40428827 https://news.ycombinator.com/item?id=40428827
- throwgfgfd25 2y agoAhh! That was the name, thanks. I was trying to remember it to find the blog post for [3] again. It is uncommonly well-written.
- IshKebab 2y agoAh these look so much nicer, thanks! OpenSCAD's willful disregard for the entire CAD industry's well established parametric modelling paradigm always annoyed me.
- WillAdams 2y agoIf you would like to point out a library which allows one to use the "CAD industry's well established modeling paradigm" in OpenSCAD, I would be glad to try it out. If that doesn't exist, why not?
- dvh 2y agoAs I suspected, none of the 3 tools you mentioned are in Ubuntu repository.
- throwgfgfd25 2y agoOne of them is literally a browser-based client-side project; would you expect it to be? https://replicad.xyz/ https://replicad.xyz/ (N.B. the Replicad studio code editor on that site seems to be broken today, which is a bummer -- it wasn't when I last checked) CadQuery might not be in Ubuntu repositories on its own (same with Build123D -- these are python libraries really) but have you tried looking for cq-editor? (I think that's in Homebrew as well.) https://snapcraft.io/install/cadquery-editor/ubuntu https://snapcraft.io/install/cadquery-editor/ubuntu To be fair I'd probably install the VSCode support for Build123D and CadQuery instead, because 1) this is code-CAD and you really manage it as such, and 2) I'm not that fond of the cq-editor environment. https://marketplace.visualstudio.com/items?itemName=bernhard-42.ocp-cad-viewer https://marketplace.visualstudio.com/items?itemName=bernhard... https://github.com/bernhard-42/vscode-ocp-cad-viewer https://github.com/bernhard-42/vscode-ocp-cad-viewer This extension can install Build123D or CadQuery for you if you have a python setup for VSCode.
- throwgfgfd25 2y ago> (N.B. the Replicad studio code editor on that site seems to be broken today, which is a bummer -- it wasn't when I last checked) And appears now to be fixed.
- hyperbrainer 2y agoFornjot[0][1] is also really impressive as a CAD kernel. It is written in Rust, and is still a WIP, but I think is turning out nicely. [0]https://www.fornjot.app/ https://www.fornjot.app/ [1]https://github.com/hannobraun/fornjot https://github.com/hannobraun/fornjot
- mtndew4brkfst 2y agoI was extremely excited about Fornjot for both personal and professional reasons, but the author has shared important updates that would deter me from using it outside of hobbyist contexts: May 2023 https://www.fornjot.app/blog/a-new-direction/ https://www.fornjot.app/blog/a-new-direction/ I don't know how things will shake out long-term, but for now, I'm going to reduce my effort to one day per week... As of now, the goal of Fornjot is no longer to build a CAD application. From now on, Fornjot is a CAD kernel... Last week: https://www.fornjot.app/blog/changes-to-the-development-process/ https://www.fornjot.app/blog/changes-to-the-development-proc... There will be no more releases for the time being. I will no longer submit pull requests for my own work.
- brohee 2y agoAs scary as the last two lines are, it's not the developer abandoning ship, it's just him optimizating the process. Cutting releases was taking time best spent on dev, and commiting to main as a mainly solo project is perfectly reasonable.
- hereonout2 2y agoOn the contrary if you're a coder doing anything non-substantial and only rarely need to do some basic 3d modelling I would say definitely look to openscad! I make models for my 3d printer just a few times a year. I find it much easier to get back into openscad than remember my way around a gui or wrestle with more advanced tools. There's nothing I've not managed to make with openscad yet, though the things I have made are embarrassingly simple (yet highly functional).
- throwgfgfd25 2y ago> There's nothing I've not managed to make with openscad yet, though the things I have made are embarrassingly simple (yet highly functional). It is workable if you have an extremely solid grasp of mathematics, and you don't mind objects that ultimately retain the feel of the combination of a few CSG primitives. But I make 3D-printed things that for a variety of reasons are little more than rings, plates, discs, and helixes, and I've already very clearly run into situations where the face/vertex/wire model of a proper CAD package is more or less the only way to keep control over a design.
- Brian_K_White 2y agoYou CAN get things done, but there is no getting around the fundamental problems expressed here. All my models are about 50% variable declarations and 50% inscrutable equations to express the relationships between the values. Sometimes huge ternary stacks because the language doesn't allow variable changes, so you can't have simple if/else/case to have a simple concept like a default value that maybe gets replaced based on some other condition. And the lack of things like fillets is simply impossibl. The things you have to do to attain the end result of a fillet without an actual fillet function is ridiculous, and even after doing the ridiculous things, you still have a limited crap result where no matter what you simply can't actually have a fillet wherever you want, but you can compromise and get at least the ones you really need if you're willing to live with a simple design. That is not a good tool. A good tool gives you the means to express whatever you need to express. Openscad gives you the power to express cubes and spheres and hulls and intersections of those, and even that only in a bafflingly limited way thanks to the language limitations. It's not a great tool. It's a great proof of concept for a great idea for a great tool.
- prabhu-yu 2y agoThank you for explaining why the CadQuery and its successor Build123D are better. Thank you for explaining mesh Vs BREP.
- jcgrillo 2y agoThe main complaint I have with CadQuery et. al. is the API verbs are all coming from the point of view of describing bRep shapes instead of thinking about the design from the standpoint of "how would I make this?". I think there's an opportunity for a code-first CAD API to incorporate GD&T and manufacturability information directly as part of the modeling process. For example, if I'm making a shaft I want to describe that operation as it will actually be performed in the shop e.g.: (1) select round stock of nominal dimension X (2) cut to rough length (3) chuck in 3-jaw chuck and drill center (4) flip around in 3-jaw chuck and drill the other center (5) mount between centers (6) turn to rough outer dimension (8) turn down to add the various bosses, threads, chamfers, other details, etc... With this kind of a process I get all kinds of GD&T information for free--for example, the precision of my 3-jaw chuck determines how much larger my nominal dimension X needs to be than my target rough outer dimension to be able to reliably achieve it. So I think these APIs are coming at the problem from the wrong point of view--they're all about driving the CAD kernel and telling it how to draw abstract shapes in a computer. Instead what I want is to tell the computer how I intend to make the thing and get an estimate of what the result will look like.
- throwgfgfd25 2y ago> So I think these APIs are coming at the problem from the wrong point of view--they're all about driving the CAD kernel and telling it how to draw abstract shapes in a computer. Instead what I want is to tell the computer how I intend to make the thing and get an estimate of what the result will look like. I have certainly learned over time that when you're looking at an object that exists in the real world, one way to start to figure out how to model it is to figure out how it -- or its injection-mould positive -- was physically made. Can it be cut with a mill? Was it glued together in parts? It absolutely is fun to try to work out how to come up with a shape subtractively from some giant primitive as if it was a block of steel. I often find myself visualising in terms of a scroll saw. I watched a couple of great videos about three-dimensional scroll-saw work and it weirdly affected my understanding of CAD!
- WillAdams 2y agoIsn't that basically coding in G-code? The problem of course is that that limits one to straight lines and arc moves. Are there any really good G-code previewers for lathe work? For that matter, what is the best 3D G-code previewer which will allow one to see the surface of the cut part in 3D? I'm about to break down and buy tkcnc --- is there something better?
- deleted 2y ago[deleted]
- dotnet00 2y agoCADquery was a neat intro to using code for CAD, but it ended up being kind of a pain when it came down to designing stuff that I'd want to be able to come back to and understand months later (ie being able to tell what exactly each number is referring to), or stuff that might need curves and constraints. I also got into it in part because of the idea of using typical version control to tracks changes and of being able to get Copilot to help out. Perhaps I just wasn't fully understanding how to use it and it wasn't supposed to be mainly CSG focused, but it ended up being much more effective for me to spend a day just fiddling around in FreeCAD to learn how to use it.
- throwgfgfd25 2y agoYes -- despite my comment, I am in the same boat. Code-CAD is actually a backup/toolbox item alongside FreeCAD, for me. (The programmer in me would love to be able to leave comments in more places on FreeCAD designs. I have spent a lot of time trying to learn how to make the simplest, most self-documenting parametric flow.) But the reason I framed my comment above in terms of spending at least some time with CadQuery or Build123D etc. over OpenSCAD, is that CadQuery taught me additional CAD concepts that helped me make progress. I had tried to use FreeCAD before, about 18 months before I finally got my 3D printer, but I was absolutely bamboozled. So when I finally started with my 3D printer, I started with OpenSCAD. I got small stuff done and held it in my hands, but I immediately felt its limitations (partly because I struggle with co-ordinate spaces and maths). Was I really going to be stuck doing all the maths, over and over again, or using libraries of specific functions like BOSL? My maths skills are weaker than I'd like, and it felt like a dead-end. I stumbled on CadQuery, spent some time working on some key things in it, really immersed myself in the documentation, and this helped me grasp the bRep fundamental ideas of faces, vertexes and edges, normals, orientations, planes, etc. All the higher-order concepts in modern CAD above CSG. I then had two things I knew could work for me -- CadQuery or in a pinch OpenSCAD. And because as you know there are/were workbenches for both, the knowledge gave me the confidence to spend time with FreeCAD. Without stumbling on CadQuery I would have been stuck with OpenSCAD and it may have driven me away from trying to make my own things. There are elements of my designs I will be (re-)building in Build123D to get some code-CAD advantages (scripted customisation). But it's the time with CadQuery that helped me make the transition to CAD thinking.
- sheepscreek 2y agoI don’t understand the intricacies and much of what you said. I am sure those are legitimate concerns for a professional. But as a hobbyist, this is the tool I have turned to time and again for making simple parts or objects. I found this to be more intuitive and easier to onboard vs. learning different visual designing tools each with its own quirks. So it definitely has a place in my toolbox as is.
- throwgfgfd25 2y agoOh, I'm a hobbyist. (Well, at the moment. Some things I am making might soon get to the Tindie/Etsy/online sales level.) And you're right it has a place. I'm not totally advocating switching if it works for you. But for newer users who want to really use code-CAD, out there are tools that are not held back by OpenSCAD's limitations (and which scale less painfully with complexity), and learning about them might help see simpler solutions or even bridge the gap to GUI CAD. The most significant limitation I can see for a hobbyist maker is reaching the point where you can't make something yourself (or can't make it cost-effectively) and need to get it fabricated elsewhere. That is when you may very well find you would benefit from something OpenSCAD cannot (ever, I think) do: true, efficient STEP export. As my 3D printed designs get more complex I am pushing closer and closer to the point where I will need a part cut conventionally out of steel or aluminium, or -- most likely sooner -- where I will need custom fasteners. One of the advantages of a workflow that will produce STEP is being able to work with someone who has those specialisations (and/or import work into the software tools they use). So at the earliest point I could, I made sure I was in that world. As a side bonus, it means being able to potentially use home CNC, or even just extract vector faces from generated models for use with a laser cutter or a Silhouette-type machine. Out of completeness I should note that in that situation you're not totally out of options, as FreeCAD can interpret OpenSCAD in a bRep context with the exception of a few operations like minkowski() that get left as meshes. But it's a real limitation.