Skip to content

Instantly share code, notes, and snippets.

@tinkerology
Created June 6, 2016 04:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tinkerology/ea6268d41bc31d676cd819a9b5459dc4 to your computer and use it in GitHub Desktop.
Save tinkerology/ea6268d41bc31d676cd819a9b5459dc4 to your computer and use it in GitHub Desktop.
Issue with not pre-rendering difference
DETAIL=120;
module hullBetween()
{
// Combine the hull between and the original objects
difference()
{
hull()
{
children();
}
for (childIndex = [0 : $children-1] )
{
difference()
{
hull()
{
children(childIndex);
}
children(childIndex);
}
}
}
}
module testHullBetweenShape()
{
render()
difference()
{
cylinder(5, 20, 20, $fn=DETAIL);
translate([0,0,-1])
cylinder(6, 17.5, 17.5, $fn=DETAIL);
translate([16,0,-1])
cube([10,10,12],center=true);
}
}
module testHullBetween()
{
hullBetween()
{
testHullBetweenShape();
translate([-100,-100,0])
rotate([0,0,-90])
testHullBetweenShape();
translate([-10,-100,0])
rotate([0,0,-90])
testHullBetweenShape();
}
}
testHullBetween();
@nophead
Copy link

nophead commented Jun 6, 2016

It is not too surprising that when you subtract an object from its own hull you get lots of thin slivers. I suspect this is due to hull and difference using different number representations.

Inflating the object by a small amount before subtracting it from its hull by using minkowski with a sphere fixes it but it very slow of course.

@tinkerology
Copy link
Author

Right, I'm not surprised by that. I'm surprised that the render() on on line 30 fixes the issue in all the cases that I have. I tried adding render() all over the place in hullBetween() to no effect.

Note also that without the render(), there are artifacts far outside of the boundary of the hull of the object that make the resulting STL non-manifold. That was the even more frustrating part of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment