Hacker News new | ask | show | jobs
by oasisaimlessly 26 days ago
OpenSCAD has almost zero crossover with B-rep modelling ('true' CAD, what this apparently is), though.
3 comments

This isn't B-rep based modelling. Far from it. It builds up the feature tree and then uses geometry kernel to generate B-rep based representation. The final generator output script could probably be adjusted to generate openscad. It only supports 2d drawings containing lines, arcs and circles and extrude operation for making them 3d. Operations like fillets and chamfers which depend on intermediate B-rep model state are not supported.

I would even argue that for basic modelling majority of tools/features in CAD operate at the abstraction closer to CSG for describing what and B-rep is only treated as how. Just like good chunk of code based CAD use combination of CSG for what and triangle mesh based geometry engine for how. That's assuming you consider standard 2d->3d operations (extrude, revolve, sweep along arbitrary 2d profile) as valid primitives for CSG.

User comes into direct contact of B-rep in very specific situations: 1 doing operations like fillets/chamfers/draft/thickness based on intermediate geometry, 2 attaching sketches or other features to generated geometry or using generated edges (instead of new sketches) for guiding operations like complex sweeps, 3 surface based modelling workflows where you build up the the solid from individual faces typically including complex curved surfaces.

In case of 1 and 2 the the dependency on b-rep based representation is only marginal, in theory you could select edges in triangle mesh based underlying representation but the final result but quality of result wouldn't be as nice and TNP issues for parametric model editing would likely be even bigger than it is for existing CAD. That's not really CSG territory anymore but isn't exclusive to B-rep either, and involves a bunch of work that's outside the scope of B-rep. In non parametric mesh modellers with more destructive editing workflows like blender chamfers and fillets work fine. And if anything for reliable parametric models you often want to limit dependencies on intermediate geometry as that depends on CAD keeping track of where each edge/face originated from outside the b-rep and increases the chance of TNP issues.

3 is critical for industrial design containing large amount of complex curved surfaces like cars and other consumer products, but there are also many more technical parts where it can be completely ignored. Cad tutorials for beginner tutorials almost completely ignore this category of cad modelling. The part about not being exclusive to b-rep also applies for surface modelling part.

how hard it is ? with AI prevalent, how long ? any pointers to start from ?
If you want something based on B-Rep, look at projects that use opencascade under the hood, as that is one of the only B-Rep CAD kernels available which is free and open source. Some examples would be CADQuery, CascadeStudio, or RepliCAD.
OpenSCAD uses CSG which is generally better. Easy to convert CSG to BREP. Cant generally do the opposite
It's easy to convert because CSG is a small subset of what BREP can do.

It's analogous to "all squares are rectangles, but not all rectangles are squares" (squares=CSG, rectangles=BREP)

CSG by itself isn't suitable for most CAD use-cases.

How can I convert openSCAD models to true STEP files? As in no meshes. I Literally have wanted that for years.
You need to use https://github.com/smurfix/buildscad which can convert OpenSCAD to Build123d, then you can export a STEP file. It has a few limitations, but for simple OpenSCAD files it can generate an equivalent representation in OpenCASCADE.
Yeah, that fails for even moderately complex models...