This does not match the drawing. In addition it only took 4 minutes to do it correctly in a normal CAD package [1]. OpenSCAD is cool, but it's not at all a replacement for traditional 3D CAD and I wish people would try to sell it on its strengths instead of selling it as a replacement for traditional CAD.
OpenSCAD is really neat! It comes at the model representation process in a very different way.
In it's current form, it will never replace CAD as we know it today.
People have a hard enough time breaking an object they can see into features they can draw and combine, or modify as is done today. Add in the need to work with 2D drawings, sketches, photos, and it gets a bit harder for them still.
I have been training people to use CAD since the days of serious transition away from drafting boards. Very few of them would be able to author the descriptive text examples up thread.
And to be fair, parametric CAD, with or without history is powerful, but hard enough for plenty of people to really struggle, but that difficulty seems a couple orders below what we are discussing here.
Frankly, a better developed OpenSCAD could become a very powerful tool to be used in tandem with traditional CAD. It could even make use of the mature geometry kernels that way too. Those make more complex object and feature create actually work well because they have solutions for the almost innumerable corner and edge cases which always come up.
It is possible to create things largely OpenSCAD style in some CAD programs too. NX has a variety of programming interfaces, one being essentially Visual Basic with CAD appropriate functions.[2] (NX SNAP, as I recall)
You get entity create, query, rename, transform (full transform, scale, translate, rotate), modify like adding a fillet to an edge, boolean cut, join, intersect, split, add, partition... and a whole lot more! (It may not support partition, but it is supposed to for SDRC compatability, and that isn't the point anyway, so... yeah)
And there is the general purpose programming environment. Useful in all the obvious ways we here know well.
The main point is one can take an entirely analytical approach to model create, while also having the robust 3D and on NX 3D stereo[1] even, GUI to evaluate, debug, and all the other good CAD stuff!
To me, that is the OpenSCAD strength. The team can take a peek at the tools I just mentioned, add features and Open Cascade will do way more geometry cases than people think, and now you have model and entity create that can really work for some tough use cases:
--catalog parts with conditional features
--simulation and or analytically driven model shapes, many of which could be used as base features to be finished into manufacturable things
--coupled with an LLM trained on geometry, could result in Star Trek like plain language model create
There is more.
But the actual engineering, product design and manufacturing use cases are not going this way at all. It is too obtuse. People need to see, and I would argue benefit from haptics for interrogation, assembly and more.
Don't get me wrong here. All the open CAD tools are awesome. Open CAD is important and we just don't have much yet, and more is better. We do not have much yet because CAD is really hard, and the robust, mature geometry kernels out there have gazillions of man dev hours in them. Open Cascade is actually quite impressive to be for how well it really does work Given the tiny fraction of dev hours it has by comparison.
And what this means is CAD inertia is a problem likely an order harder than say the replace C code inertial some feel is worth doing.
Best bang for the dev hour investment us to augment and compliment traditional CAD, IMHO of course!
[1] All you need is a stereo capable GPU and display. I used my laptop with nVidia Quadro series and a fast Samsung 3D plasma TV for huge stereo modeling. Frankly, it was crazy good for evaluating technical surfaces and complex, think airplane internals, assembly was down right fun! Recommended and I am unsure why this is not more widely done.
[2] I used SNAP to convert bitmaps into voxel objects, where each voxel was a cube, and from those, combine them into larger voxel objects that were the basis for tooling models to make the desired shape. The retro pixel look you are picturing was desired and I wish I could show the finished project. Neat!
Have also used it to make plenum and manifolds driven by simulation output or area / flow equations.
Both cases would be torture using the traditional CAD model create UX. OpenSCAD is aligned well here if you ask me.
r1, r2 = 55/2, 30/2
cd = 125
# construct rib profile, start with slope and oversized arc
# reposition line to be constrained on arc center height and Y axis
l = build_line(O, op_line(-8, 30, name='l1'), op_arc(30, -90, name='a1'))
l.move(Vector(77-r1*2, 0) - l.a1.center_point)
ip, = intersections(l.l1, Axis.Y)
l.move(Y(50 - ip.Y))
# Now we know first arc center and could project it on a second arc center
# axis with known distance and get tangent point. Use point to trim oversized fist arc
# and create second tangent arc.
a2c = point_on_axis_with_dist(l.a1.center_point, Axis.X.offset((0, 66+32)), 66+30)
ip, = intersections(l.a1, axis_from_points(l.a1.center_point, a2c))
l.append(op_trim(ip), op_arc(to=(a2c.X, 32)), XA(cd-r1), YA(0), (l.s.X, 0)).close()
# Convex hull of base cylinders would have correct tangents
base_sk = make_hull((X(cd) * Circle(r2) + Circle(r1)).edges())
# Contruct final part
obj = extrude(X(r1) * RX(90) * l.face(), 11/2, both=True) + extrude(base_sk, 11)
obj += Cylinder(r1, 60, align=A.d)
obj += X(cd) * Cylinder(r2, 32, align=A.d)
obj -= Cylinder(35/2, 60, align=A.d)
obj -= X(cd) * Cylinder(20/2, 32, align=A.d)
It took 15 minutes and I used my helpers to aid rib profile construction. With stock build123d it's quite a chore.
This was my impression with build123d and Cadquery.
On paper they have a better abstraction than OpenScad. Yet, the code to express the same output is more bloated.
I was never able to get over the yak shaving learning curve to be proficient. Openscad mental model is a lot simpler to sustain momentum to go build something.
How did you get around to prefer Cadquery/build123d?
> Yet, the code to express the same output is more bloated.
But it's trivially ready to be parameterized and reused. Model is easy to change, you could think about relations between features not absolute entities.
It's my 3rd attempt to use code-CAD to be honest. OpenSCAD -> CadQuery -> Build123d. I have past experience with SolveSpace and OnShape. GUI CAD approach with drafting in 2D and making solids as late as possible works perfectly well and you could transfer spatial thinking as-is to model coding.
I have somewhat frustrating experience with OpenSCAD and CadQuery. OpenSCAD is perfect for simple things but gap to complex parameterized models was to big for me. CadQuery looks great in examples, but I could not grasp how to use it for my tasks. State tracking is crazy hard.
There are three major factors it clicked for me with build123d.
First is explicit algebra mode. My little coder brain could not comprehend large object trees from OpenSCAD or hardcore chain dance of cadquery. But I know what an object and mutability are. Build123d is amazingly intuitive and has tight primitive set large enough for complex things and small enough to be memorized by heart. Also Build123d has nice docstrings and type hints. I mainly use IDE help instead of online docs.
Second is a good interactive visualizer. I use yet-another-cad-viewer[1]. It allows to quickly debug issues and use my favorite editor. It's crucial to have visual representation and ability to know object bindings to variable name in source code. Killer features for me are on-hand access to per-object transparency setting and selection tool to measure distances between features. It really helps during learning.
Third is I actually sat down and spent around 10h with TTT practice models[2] :))
I believe I'm already effective with Build123d on the same level as with OnShape.
There is a major weak thing with code-CADs though. It's edge selection for fillets. I think about custom filters to narrow edge location. But now it's largely a guess work with edge visualization on fail.
Looking back at your build123d code, it looks like the biggest differentiator compare to OpenSCAD and CadQuery is the expressiveness to assign shapes to variables, right?
I was able to check that box with PythonSCAD thus far, so that's "solved" for me.
Otherwise, I see a lot of vector/coordinate manipulation that isn't too different from OpenSCAD/PythonSCAD.
However, I can see there's some additional abstraction primitives with arc and tangents that looks nice. That doesn't quite exist in any OpenSCAD based or similar engine since there's no built-in way to get info out of the shapes in a reflection-like way.
Maybe I will give Build123d another go and see if I can sustain some sort of momentum.
I appreciate your attempt and time spent. It's an amazing showcase how simple things could be easily expressed in OpenSCAD. But the part in question sadly is not that simple. All tangents are wrong.
Erh? Are you complaining about some minor adjustment, so that lines are not meeting the curves smoothly? I did not even understand what TANGENT means, cause I know much nothing about CAD.
I've overlaid your part on the correct part (as best I can when working with the mesh files that come out of OpenSCAD). Your part is drawn in red: https://i.imgur.com/12y5q1t.png
Yes. Lines should touch circles in a smooth way. There could be many arguments why it's kinda important. Like fit to other parts in a final assembly or production complexity. But even for DIY purposes this minor adjustments would suck a lot of blood in prototype phase, it's a way more simpler to constraint it to be smooth (tangent) and forget about all tweaks needed after dimension changes.
You absolutely don't need to get into the maths to get value from this idea. The maths terrifies me. Just know this core concept: a tangent line meets a circle only once and is at right angles to the radius when it does.
Here's why this is valuable in CAD environments that properly support it: once you know how a tangent line works, and see how a constraint-based modeller represents them, it is possible to understand how to model a whole set of smoothly rounded features that the CAD package can automatically adjust to changes made to core measurements, retaining this perfect "join". Rounded slots, curved rounded slots, fillets, all sorts of interesting motion components, etc.
This is good -- but they aren't quite the same? [0]
And the way they are not the same is (as the GP is saying) rather telling about the challenge of getting really precise things working in OpenSCAD without a pretty solid grasp of maths.
[0] they might be functionally equivalent in application, which is not nothing, of course
Couldn't let it go, but got everything except for the positioning of the small radius and maybe the height of the web slope is off (had to increase 2 to 2.05 to keep a gap from appearing).
I think if one laid out the radius stuff flat and then rotated it things would be easier to visualize.
The best thing about the challenges from 3d CAD Speedmodelling is that they needed a quick way to validate submissions, so they do it by validating the mass of the design. The density to use is included in the problem. The answer is on this page: https://build123d.readthedocs.io/en/latest/tttt.html#t-24-cu...