Hacker News new | ask | show | jobs
by ozmaverick72 67 days ago
Interesting. I have played with OpenScad a bit. This looks similar - i guess the difference is the syntax is python - any other major differences
3 comments

OpenSCAD is all triangles and vertices. Fillets are difficult to do. Outputting circles/spheres generally requires you to for-loop over vertices a lot.

Libraries like build123d and cadquery use OpenCASCADE, a boundary representation kernel. You think in terms of the enclosed solid and perform operations - boolean add/subtract, fillet/chamfer, stamp text, etc - that return a new solid.

I'm not sure I understand your comment; OpenSCAD has functions like sphere(), cylinder(), etc. Most OpenSCAD models I have seen are built up primarily from solid primitives combined using boolean operations, just as you describe for the other tools.

https://en.wikibooks.org/w/index.php?title=OpenSCAD_User_Man...

OpenSCAD works natively with triangle meshes. sphere() will create a spherical triangle mesh.

These libraries on the other hand can natively represent a sphere for instance. This means that during CAD-ing you don't need to worry about resolution, that's a consideration for export only.

Do you mean that OpenScad performs boolean/other operations on triangle meshes, but these libraries don't until output? So they might instead use curved surfaces/edges etc as outputs for operations and only convert to triangles for output or export at the very end?
It isn't even necessary to create triangle meshes during export. You can export as step files. It is a commonly used brep based file format supported by almost any "proper" CAD software. Triangle mesh based modelers can't easily export good step files because they don't operate at that level of abstraction.
In professional CAD systems, geometry is not stored as triangle meshes but as mathematically defined surfaces (such as parametric and NURBS surfaces). Triangle meshes are only generated as approximations for rendering. This is analogous to vector graphics (SVG/EPS) versus raster images (PNG/JPG).

Any serious manufacturing will work require a STEP (or something equivalent) which stores these parametric surfaces rather than a mesh.

yes, exactly.
Theres a better description of the differences here: https://build123d.readthedocs.io/en/latest/OpenSCAD.html#tra...

Some of the differences may be in when you are trying to reference a face/edge to build off of, not just about the primitive function being used.

> I'm not sure I understand your comment

Try to do the following with OpenSCAD:

    1. put a sphere and a torus somewhat close to each other
    2. find the shortest segment between the two surfaces
    3. place an infinite cylinder whose axis is aligned with the segment you just found
    4. fillet the cylinder with both the torus and the sphere along its intersection curve with each surface
This is very, very hard to do with OpenSCAD.
While true your argument is weak, for example in pov-ray the shapes are pure exact mathematical concepts. But nobody is saying how great this is for 3d printing or general cad work because it's not. The real key benefit from these programs is the interchange format they can generate, something you can feed to a machine, this prevents it from ending up like pov-ray, a terminal process only fit for generating pictures. Fillets are difficult to do in openscsd because fillets are difficult to do in general. What your argument probably should have been is that if openscad had chosen a geometry kernel where fillets were already solved it could then do fillets. Which is the sort of obvious tautology that helps no one.

Now I am off to see if anyone has ever built an export plugin for pov-sdl, either a 3d rasterizer(g-code slicer) for 3d printing, or a boundary layer mesh generator for import into another program. language wise it is probably equivalent to or better than the openscad sdl,

One subtle advantage to using python as the sdl is that it gets access to the vast corpus of python modules out there. Most of which are probably useless. but one thing I want to try is to see if I can use sympy to define a more declarative style of constraint.

Not perfectly relevant but build123d docs have an example using sympy as part of solving constraints for a design. https://build123d.readthedocs.io/en/latest/tttt.html#t-24-cu...
Oh boy. The major difference is coordinate transformations, global/local/face. OpenScad basically leaves you alone with math you should figure out on your own. Also it's math heavy for all other stuff, for example tangents, smooth connections, intersection coordinates, etc.
CadQuery can export STEP files, and is overall much nicer to use in my opinion.
Openscad can export to CSG, which can be imported by free cad or converted to STEP https://github.com/gega/csg2stp
Whether or no that will be useful/editable will be determined by what sort of objects and modeling approaches were used --- it's pretty easy to make a file which results in a nightmarish triangle mesh representation which is a nightmare to edit.
I've been using Gemini to generate openscad programs for use with my 3d printer. Is cadquery a better option I wonder?

Why do you say it is better than openscad?

After reading some of the docs it does look fun.

Python, so leverage your Python skills and existing libraries.

A nice GUI so you can build, view, tweak, review, iterate.

Will be a nice new toy...