News for hackers. Stuff that matters.
Re:CADmium: A Local-First CAD Program Built for the Browser by hathawsh on Tuesday May 21, 2024 @04:08PM (#40433228)
I really hope CADmium can wean me off of OpenSCAD. With OpenSCAD, I don't really have to think at first; I use a simple language to write modules that build on other modules. The problem with OpenSCAD is there's no solver: I have variables, but no constraints. As I make changes, suddenly I have to think hard and solve the constraints manually and it's easy to introduce errors. However, the problem isn't severe enough to get me to use something else, because starting a model with OpenSCAD is IMHO far easier that anything else I've tried.
Re:CADmium: A Local-First CAD Program Built for the Browser by bilsbie on Tuesday May 21, 2024 @04:42PM (#40433626)
Can you explain the problem with openscad a little more? I’m not quite following.
Re:CADmium: A Local-First CAD Program Built for the Browser by hathawsh on Tuesday May 21, 2024 @05:34PM (#40434280)
As the complexity of a model increases, so does the complexity of determining correct dimensions and object placement. At some point the work becomes complex enough that I spend most of my modeling time cleaning up equations rather than finishing the model. A solver would theoretically replace many of the equations.

As a trivial example, let's say I want a square and a diamond and I want the diamond's corner to touch the square on the side. It would look something like this:

square([10, 10], center=true); dx = 5 + 5 * sqrt(2); translate([dx, 0, 0]) rotate([0, 0, 45]) square([10, 10], center=true);

This is a simple case, but what if either shape is replaced with a hexagon, a gear, or a duck? What if I decide there should be some other shapes between them? What about...?

Ideally, it seems like I should be able to tell OpenSCAD that the square contains a reference point on one side, and one of the corners of the diamond is also a reference point, and OpenSCAD should translate the diamond however is needed to make those two reference points match.

Alternatively, I should use some other software that lets me do something like that.

Re:CADmium: A Local-First CAD Program Built for the Browser by sornen on Tuesday May 21, 2024 @09:22PM (#40436353)
To illustrate what can be done with the BOSL2 library for openscad this can add 3 "diamonds" to the RIGHT, FWD, and TOP direction of a square, with the RIGHT and FWD diamond's corner touching the square on the side and the TOP diamond sitting atop the square:

cuboid([8,8,2]) align([RIGHT, FWD, TOP]) cuboid([5,5,2], spin=45);

Re:CADmium: A Local-First CAD Program Built for the Browser by RobotToaster on Tuesday May 21, 2024 @05:04PM (#40433909)
Different person but I've had the same experience.

You can't just write code to, for example, "put this line at a 56.7 degree angle and have it end 0.22mm from this surface". You have to break out the trigonometry to calculate how long that line needs to be.

Re:CADmium: A Local-First CAD Program Built for the Browser by ecjhdnc2025 on Tuesday May 21, 2024 @05:43PM (#40434407)
Have you looked at Build123D?
Re:CADmium: A Local-First CAD Program Built for the Browser by hathawsh on Tuesday May 21, 2024 @05:46PM (#40434449)
I haven't. Thanks for the pointer!
Re:CADmium: A Local-First CAD Program Built for the Browser by ecjhdnc2025 on Tuesday May 21, 2024 @05:55PM (#40434542)
https://build123d.readthedocs.io/

Many interesting features, and as it is bRep you have faces and edges, some access to constraints, the ability to import STEP etc. (oh and fillets/chamfers, with the usual OpenCascade caveats)

I have not got into it yet (mostly I am a happy FreeCADder) but your feelings about OpenSCAD resonate with me and this looks like it addresses many of them.

On the one hand OpenSCAD was the first thing that ever gave me any confidence that I would be able to make my own designs to print, and on the other the fact that it is wholly declarative is exasperating.

People make such amazing things in OpenSCAD (like Edgar Kech’s scalable large format field camera) but I do not have the tenacity to keep up with all the maths, or keep consistently avoiding coplanar issues in the preview.

Re:CADmium: A Local-First CAD Program Built for the Browser by bvrmn on Wednesday May 22, 2024 @03:05AM (#40438128)
Just wow. I've tried CadQuery and I'm too dumb to use its fluent syntax. But Build123D has amazing DSL, it was an instant understanding what code actually does and it's easy to write also. Thank you for recommendation!
Re:CADmium: A Local-First CAD Program Built for the Browser by ecjhdnc2025 on Wednesday May 22, 2024 @06:31AM (#40439368)
Impressively it’s even the same underlying object system so the two can coexist, use the same previewer etc., and I think there’s even Jupyter support.

But yes, the syntax is IMO much better because it isn’t trying to be so clever.

Re:CADmium: A Local-First CAD Program Built for the Browser by oehpr on Tuesday May 21, 2024 @06:03PM (#40434624)
I wish Solvespace and OpenSCAD would have a baby so I could have the best of both worlds.
Re:CADmium: A Local-First CAD Program Built for the Browser by sornen on Tuesday May 21, 2024 @06:59PM (#40435143)
Another option is the BOSL2 library for openscad which has align, attach and anchor operations and many other useful operations and parts.
Re:CADmium: A Local-First CAD Program Built for the Browser by aiksiongkoh on Tuesday May 21, 2024 @07:25PM (#40435470)
Ondsel has developed an LGPL 3D assembly solver at https://github.com/Ondsel-Development/OndselSolver It is being used in FreeCAD and Ondsel ES.
Re:CADmium: A Local-First CAD Program Built for the Browser by btreecat on Wednesday May 22, 2024 @08:13AM (#40440011)
FreeCAD has a built in OpenSCAD engine.

I started with OpenSCAD but found FreeCAD to be way more productive for me when it came to actually producing 3d objects. Sometimes I want to start with a square, then delete a line, and add a semi circle. But I don't always know that until I start sketching. With OpenSCAD I feel you have to know the shape primitive you need, then the exact way to modify it, and the fact that it encourages 3D primitives over 2d w/ extrusion and rotating was kinda annoying imo.

Re:CADmium: A Local-First CAD Program Built for the Browser by ecjhdnc2025 on Sunday May 26, 2024 @05:02PM (#40485367)
Belatedly: this engine has one absolutely fantastic advantage, too.

Because it interprets the file as a sequence of Part object manipulations, it's a very useful way of getting a bRep representation of an OpenSCAD document, so you get the opportunity to generate a clean, minimal STEP file.

OpenSCAD cannot do this itself, and the other conversion approaches just get you a triangle mesh packaged in a STEP file.

It's not perfect -- you get a mesh if you use Minkowski or hull operations. But it's good.

Re:CADmium: A Local-First CAD Program Built for the Browser by ipsod on Wednesday May 22, 2024 @02:08PM (#40444084)
I'd add PyMadCAD, to those already mentioned.