Live data from Hacker News

Getting the best out of OpenSCAD

calbryant.uk

21–30 of 60 posts

Re: Getting the best out of OpenSCAD

#21
post #19

Is there a good parametric / code based CAD that's good for (amateur) house or garden design, and which runs on linux? I've used openscad in the past for simple parts prototyping, but haven't tried it for 2d work. I always found its preview kind of awkward, so I can't see it exporting or printing particularly well. I've been learning qcad recently, which is OK, but it really wants you to make extensive use of the mou…

Yes, CadQuery: https://cadquery.readthedocs.io/en/latest/intro.html Think OpenSCAD but based on a proper BREP kernel, so you can express something closer to actual curved surfaces instead of just rasterized approximations.

Something about CadQuery still feels a little off, but it's the only CAD tool I've found that really ticks all the boxes that I want, so I will nonetheless happily give it the prestigious "Least Bad According To Me" award.

Re: Getting the best out of OpenSCAD

#23
post #21
post #19

Earlier quoted context omitted.

Yes, CadQuery: https://cadquery.readthedocs.io/en/latest/intro.html Think OpenSCAD but based on a proper BREP kernel, so you can express something closer to actual curved surfaces instead of just rasterized approximations.

Something about CadQuery still feels a little off, but it's the only CAD tool I've found that really ticks all the boxes that I want, so I will nonetheless happily give it the prestigious "Least Bad According To Me" award.

My go-to for getting work done has been (and for the foreseeable future will still be) Fusion 360. I can't find a free alternative that is simultaneously batteries included, but also gets out of your way.

It makes me feel like a shill saying something so positive about expensive, proprietary software, but it works _really_ well for my usecases (3D printing, 2.5D and 3D woodcraft carving). Having CAD and CAM in the same package is absolutely killer for me.

In open-source land, though CadQuery is, like you say, the least worst of all the options. I just wish it had a CAM package integrated in there.

Re: Getting the best out of OpenSCAD

#24

I was under the impression that CadQuery sort of obsoletes OpenSCAD. CadQuery uses an more capable geometry kernel: https://github.com/CadQuery/cadquery

The article does mention CadQuery at the end:

"Right now, I’m learning CadQuery which promises to address the shortcomings; it uses a more powerful BREP based CAD engine (OpenCASCADE) combined with the power of Python and inspiration of JQuery, of all things.

"CadQuery is still in semi-early development – it started as a FreeCAD plug-in before becoming independent for the recent 2.0 release.

"Most importantly, the output capability of CADQuery allows for proper STEP, SVG and DXF export, eliminating most of the problems discussed in this article.

Re: Getting the best out of OpenSCAD

#25
post #20
post #16

http://www.implicitcad.org/ is an interesting option if you're frustrated by OpenSCAD's limitations.

It seems to inherit OpenSCAD's biggest limitations, which is that curved surfaces are "rasterized". To make one without perceptible facets, you need to turn the resolution up (which then tanks performance).

They are based on two different algorithms, but both should guarantee a topologically correct solid if implemented correctly.

OpenSCAD is based on constructive geometry, which means the compute complexity scales up mainly along the complexity of the CSG tree which can get very big, but the number of triangles is quite low and independent of the resolution. This is not rasterized but the operation on CSG trees partition the space and the number of regions to consider may grow very quickly and this algorithm is very prone to numerical instabilities, like z-fighting between regions.

ImplicitCAD on the other hand is based on signed distance fields rendered with an pruned octtree marching cube. The algorithm is simpler and more stable numerically. The internal representation is of perfect resolution, but to get a triangulated output you need a number of triangles which grows proportionally to the surface of your object expressed in precision required units. But if you skip this triangulation process, using a custom slicer to generate the toolpaths or a ray tracing renderer to visualize it, you can have perfect resolution for very cheap.

The alternative is BRep, but this is a surface representation which don't bring the same topological guarantees, (like non-self intersection).

Re: Getting the best out of OpenSCAD

#26

I was under the impression that CadQuery sort of obsoletes OpenSCAD. CadQuery uses an more capable geometry kernel: https://github.com/CadQuery/cadquery

>I was under the impression that CadQuery sort of obsoletes OpenSCAD.

I've started to switch to Cadquery from OpenSCAD because it lacks proper fillets and chamfers.

I usually prefer the CSG (arithmetic tree of union/difference/intersection + transforms + base shape leaves) to model 3D objects, as opposed to Cadquery's "draw on 2D surfaces and extrude" approach, but OpenSCAD's lack of fillets / chamfers combined with the "everything is a polygonal mesh" approach of the rendering engine is just too limiting.

Cadquery has a lot of potential (the underlying engine uses a traditional hierarchical NURBS BREP, IIUC), but it also has a lot of shortcomings:

Here are some I've bumped into:

     . very strange "stack-based" model. For complex objects, it's hard to wrap your head around it, and the workflow it forces on you as a user does not always fit your mental model of the object.

     . the underlying hierarchical nature of the object (the BREP) is forcibly hidden from the user, which leads to kafka-esque situations when one wants to e.g. select parts of an object.

     . selecting parts (faces and edges) in a object is a nightmare. cadquery has "selectors", which are a) its own weird little DSL b) very difficult to use on complex shapes c) does not support name-based retrieval: can't label things and get to them later by name.
See this github issue for example: https://github.com/dcowden/cadquery/issues/29

     - the UI (cq-editor) is unusable for real-world work: no perspective rendering, no graduations in ortho views, no way to measure things on the object, no way to examine the BREP, etc ... Generally speaking, the UI is only a visualizer, and does not let you query / inspect the model in any detailed way.

     - fine-grain control over tessellation (conversion to mesh) is lacking.

     - good for modeling mechanical parts / lousy for modeling anything organic-looking

     - importing external models that don't fit the cadquery BREP-based represention is basically impossible.
TL;DR: a nice tool to add to your belt, but not a very mature environment yet, and certainly can't replace OpenSCAD yet.

Re: Getting the best out of OpenSCAD

#28
post #20

Earlier quoted context omitted.

It seems to inherit OpenSCAD's biggest limitations, which is that curved surfaces are "rasterized". To make one without perceptible facets, you need to turn the resolution up (which then tanks performance).

They are based on two different algorithms, but both should guarantee a topologically correct solid if implemented correctly. OpenSCAD is based on constructive geometry, which means the compute complexity scales up mainly along the complexity of the CSG tree which can get very big, but the number of triangles is quite low and independent of the resolution. This is not rasterized but the operation on CSG trees partiti…

That's very cool, thank you for explaining it to me. I'm curious if there's any downsides to such a scheme for representing solids compared to BREP, and the kinds of primitives it supports. E.g how easily can it represent a loft between two arbitrary faces - it's not immediately clear how to represent that with a SDF (but my SDF-foo is admittedly not very strong).

These are questions that I'm sure will be answered by me reading the documentation more closely.

Re: Getting the best out of OpenSCAD

#29
post #23
post #21

Earlier quoted context omitted.

Something about CadQuery still feels a little off, but it's the only CAD tool I've found that really ticks all the boxes that I want, so I will nonetheless happily give it the prestigious "Least Bad According To Me" award.

My go-to for getting work done has been (and for the foreseeable future will still be) Fusion 360. I can't find a free alternative that is simultaneously batteries included, but also gets out of your way. It makes me feel like a shill saying something so positive about expensive, proprietary software, but it works _really_ well for my usecases (3D printing, 2.5D and 3D woodcraft carving). Having CAD and CAM in the sa…

It's such a pity they never released a linux version. It appears to work well in a VM though.

Re: Getting the best out of OpenSCAD

#30
post #6

When I first got into 3D printing, I used OpenSCAD for my designs. The fact that objects are described with code made me feel right at home. It made it incredibly easy to make parametric designs. But later, I did start to feel the limitations. Not having automatic fillet/chamfer was huge. And sometimes, I wanted the ability to measure the distance between two points selected visually to make sure all my math involvin…

The trick with holes is to make your negative geometry penetrate past the surface. Meeting exactly on the surface will be too glitchey otherwise with the fast floating-point approximation. Fillets and chamfers though, yeah. The lack of those drives me away. As Quinn (Blondihacks) says: "Chamfers are what separate us from the animals.", and as This Old Tony says: "When it comes to chamfers, you don't want to cut corne…

As a mechanical designer who has quite a bit of machining experience, I'm the person sounding like a broken record about chamfers when doing design reviews. Blondihacks quote will be going straight into my repertoire of quotes.
Post reply on HN