News for hackers. Stuff that matters.
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by steveklabnik on Sunday November 11, 2018 @07:26PM (#18429683)
Fun story: why I got into hacker news in the first place was that I had a 3D printing startup way back in the day. I wrote a C extension to our rails app to slice up geometry to determine pricing. In some ways, this was a precursor to both my Rails and Rust work.

We were far, far too early...

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by jepler on Sunday November 11, 2018 @05:51PM (#18429215)
This looks real cool, and the logic behind treating OpenSCAD files this way in a 3d printing workflow is impeccable.

I stumbled at first because all my scad files use language features not supported in hob3l. It might help to call more attention to the .scad → (openscad) → .csg → (hob3l) workflow.

Blew right past my notebook's 8GB RAM trying to slice a complex fractal model at 6 levels of recursion. This is a "favorite" model of mine because I've never gotten openscad to slice it right: https://emergent.unpythonic.net/files/sandbox/flake6.csg.gz

Slicing level 5 only took about 4GB RAM so maybe level 6 needs around 24? https://emergent.unpythonic.net/files/sandbox/flake5.csg.gz

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by tinkersleep on Monday November 12, 2018 @05:50AM (#18431786)
Author here. Thank you for providing the file, I will debug it. I must admit that I spent almost no time to think about memory management, and my test files are way smaller. I guess this will be a debugging session. :-)
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by all2 on Sunday November 11, 2018 @07:37PM (#18429733)
For anyone familiar with reducing computational complexity in linear algebra, this is a direct corollary to reducing matrix multiplication to vector multiplication.

A reduction in problem dimension leads to an order of magnitude reduction in complexity.

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by salamanderman on Sunday November 11, 2018 @06:39PM (#18429445)
Since you're going for 3d print level accuracy, and appear to be targeting PLA or ABS, I wonder if approximation of the Booleans by tessellation and then using a BSP tree wouldn't be even faster and use much less memory.
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by repsilat on Monday November 12, 2018 @01:34PM (#18434546)
RLE is probably fine too. Easy to do set operations on RLE data structures without "decompressing" them too. Quite a bit simpler than BSP trees for most people I think :-).
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by MBCook on Sunday November 11, 2018 @05:51PM (#18429220)
What a good idea. Seems like one of those ‘why hasn’t anyone thought of this’ kind of ideas.

Of course it only works for CSG, so it’s not a panacea for any file you want to print. But when it does apply it’s great.

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by remcob on Monday November 12, 2018 @05:20AM (#18431671)
What are the limitations? The blog mentions that transformations are pushed to the leaves of the tree. Is this always possible? Are there operations that can not be implemented using slices?
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by tinkersleep on Monday November 12, 2018 @05:56AM (#18431806)
Author here. All the common stuff (that is based on 3D CSG without extensions) works fine, and most for 3D construction operators just produce a polyhedron with a simple algorithm (e.g., linear_extrude), so that's fine, too.

But some of the more advanced CGAL based operations for constructing 3D objects will not work in 2D, because they are inherently 3D and complex, e.g. 'hull', 'minkowski'.

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by mdonahoe on Sunday November 11, 2018 @06:09PM (#18429305)
How does it work if you have 3d rotations in your design?

Say I create a 3d shape and then make 30 copies rotated at different angles, like in gear or a bracelet?

Wouldn’t the slices end up getting rotated out of plane?

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by bayesian_horse on Sunday November 11, 2018 @11:27PM (#18430581)
Nope. All slicers work by intersecting a plane with a 3D volume. In this case a CSG tree. At the bare minimum you need a way to tell if an x,y,z point is inside the volume or outside. In the case of a rotated cube shape, the x,y,z vector is just rotated/transformed the other way (inversely) than the cube, and the test still works. Most slicers will have more sophisticated methods of intersecting a plane with a volume...
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by sebastos on Sunday November 11, 2018 @09:26PM (#18430181)
You can probably get the model to a place where the actual orientation / position of each component is completely resolved into the final world coordinate sit will have, then do the slicing after that but before any intersections / unions.
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by foxylad on Sunday November 11, 2018 @07:42PM (#18429758)
I love OpenSCAD, but can't understand why it's so slow rendering. The viewer does it's own perfect render fast enough to pan/zoom/rotate, but rendering to STL is painfully slow.

It would be great to be able to switch to a slicing mode for rendering.

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by kevin_thibedeau on Sunday November 11, 2018 @09:53PM (#18430264)
It uses a different library for the final render and the OpenGL preview is often not perfect for complex geometry. The former is creating an actual watertight 3d model, the latter is just using z-order to simulate one.
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by letstrynvm on Monday November 12, 2018 @04:29AM (#18431498)
Right... and also, as you increase the model complexity rendering correctness and speed take a dive to the point the preview render is unusable.
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by bayesian_horse on Sunday November 11, 2018 @11:22PM (#18430560)
I've thought for a while that STL meshes in 3D printing workflows may be a detour in many circumstances.

CSG is one example, volumetric models (from CT/MRI scanners or simulations) are another.

Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by StavrosK on Monday November 12, 2018 @03:44AM (#18431350)
So this basically slices the object up in layers before exporting? What if the layer height is different between the export and the slicer? What about variable layer heights?
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by tinkersleep on Monday November 12, 2018 @05:59AM (#18431819)
Well, yes and no. If your slice at 0.1mm with Hob3l, then slic3r can still decide that it uses 0.2mm or 0.3mm or 0.4mm slices -- it would just skip a few slices from Hob3l. I don't think there is a problem with that. It will get weird if you use Hob3l with 0.2mm slices and then slic3r with 0.35mm slices -- this will cause Moire effects. It is not wrong, but may look interesting...
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by StavrosK on Monday November 12, 2018 @06:07AM (#18431857)
Unless you have 0.1mm detail, in which case it will just disappear completely.
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by Doxin on Monday November 12, 2018 @04:22AM (#18431478)
I think the eventual idea here is to have your slicer support .scad files as well as .stl files.
Re:Show HN: 100x Faster Slicing of SCAD Files for 3D Printing by StavrosK on Monday November 12, 2018 @04:50AM (#18431571)
Yes, but it looks like it would still be impossible for the slicer to slice different height layers with this.