Hacker News new | ask | show | jobs
by wakeupcall 1401 days ago
Isn't Pro/E a b-rep cad?

BRL-CAD is one of the few "full-fledged" CAD systems that I know of which is explicitly CSG, while most (all?) commercial CAD programs are B-REP in nature.

CSG and B-REP are two worlds apart. I'm not sure why in the comments we're suggesting alternatives in the two categories interchangeably. They're not [*].

An alternative to BRL-CAD would be OpenSCAD or libfive studio + other tools (since BRL-CAD does a ton more) and more recently CadQuery. Maaaaybe Tinkercad could be classified as CSG?

CSG makes some operations easy at the expense of other things that become incredibly hard. The same is true for B-REP. Doing gears, highly procedural or FEM-directed models via CSG? Easy-peasy. But try to add a filled between two edges. Step it up 50 notches to fillet one edge and do the equivalent of "tangent propagation". Now the same, but also try projecting a structure on that round face.

CSG's speed is also wildly overblown. While B-REP is not exactly lightweight, computation complexity scales with the complexity of the model but can be sped up by caching intermediate representations.

In CSG this is not always true, since caching the intermediate representation can destroy the accuracy of the final mesh in ways which are very difficult to compute. So even for apparently easy models, times spend walking the space to remesh your model can grow _very_ quickly, hampering the ability to iterate quickly and experiment.

Not to mention, "measuring things" in CSG is hard. This is never mentioned, but none of the tools I've worked with so far offers convenient ways to examine and measure the objects you're working on. For a parametric model this is vital!

[*] Not saying there's no overlap. I'm using both systems. B-REP generally wins on a model which is feature-directed, which is why it's more popular. But I can relate to people that think that BRL-CAD is "hard".

1 comments

Just a point of clarity, BRL-CAD now also supports BREP and is technically a hybrid modeling system.

CSG and hierarchical relationships still underpin, but a lot of effort was invested in BREP support over many years. There was already extensive support for polygonal BREP, but NURBS BREP was added to support seamless conversion of commercial CAD. BREP NURBS can be imported, ray traced, and facetized. BRL-CAD still needs direct surface editing, but you can mix implicit geometry with NURBS (e.g., subtract a hole) without issue. CSG entities can also be converted to BREP and work is ongoing to improve Boolean evaluation of BREP-on-BREP entities.

As for performance, implicit geometry with Booleans (i.e., "CSG") is typically an order of magnitude faster to evaluate (and an order of magnitude less memory than BREP/NURBS which is in turn an order of magnitude less memory than BREP/Poly). BREP/NURBS easily offer the most editing flexibility. CSG offers the most compression and programmability. BREP/Poly offers the most interop at the expense of representation fidelity, memory, and (sometimes) validity. All three can be "fast enough", but evaluation performance is still an important consideration on real/big models, e.g., fully detailed vehicles.

Note that generating an intermediate representation off CSG is not intrinsically necessary. When you have really fast+good solid ray tracing and analytic routines (and measuring tools) built around it, you don't need an intermediate rep. You just directly evaluate shotlines and get mathematically precise answers. That can be used for real-time geometry display, for measuring things, for identifying interferences, for computing properties, etc. That's BRL-CAD's primary niche specialty.

Thanks for the very detailed reply. Evaluating NURBS is useful, but you piqued my interested in the reverse operation. For a moment I almost had the impression we could specify CSG operations based on features extracted from the BREP reconstruction (that would be a game-changer!).

I was looking up at the current docs for the csg->brep conversion, but I don't really see much. Does brlcad actually allow to fit/reconstruct NURBS over the constructed geometry? The export docs still mention IGES export is just faceted.

I'm mostly using openscad and cgal directly, and my experience with both is that model regeneration takes a nosedive for anything non trivial. openscad for example doesn't offer any tool to shoot/analyze rays. The realtime preview also suffers for coplanar z-fighting issues, often making exact CSG operation really hard to debug. However the ergonomics are pretty decent when iterating and constructing geometry on the fly.

Can I ask your role in brl-cad? All your posts are extremely detailed. Are you a contributor? I wonder if I should reinvest time in brl-cad once again.