1
$\begingroup$

I've tried to remix this model: https://www.thingiverse.com/thing:90933 (Bauhaus chess set) by scaling it down and inserting little magnet holes into the pieces' underside. My SCAD file looks as follows:

difference() { 

    scale([0.5,0.5,0.5]) import("Bauhaus2Set.stl");

    translate([ 6, 11  ,0]) cylinder(h=20.5,r=2.5,center=true,$fn=20); // WTH?

    // King/Queen
    translate([ 6, 11  ,0]) cylinder(h=3.5,r=2.5,center=true,$fn=20);
    translate([-6, 11  ,0]) cylinder(h=3.5,r=2.5,center=true,$fn=20);

    // Rooks
    translate([ 6,-11.5,0]) cylinder(h=3.5,r=2.5,center=true,$fn=20);
    translate([-6,-11.5,0]) cylinder(h=3.5,r=2.5,center=true,$fn=20);

[...]

Note the third line with "WTH?" - I've done quite some trial-and-error, and if I remove that line, then I don't get any subtracted holes anymore when I render the whole thing (F6). In preview (F5), the holes are always present, but in the final render, I need to include the larger subtracted cylinder or it won't work.

The STL file seems to be fine in itself, what's going on here?

$\endgroup$
  • $\begingroup$ What are the z extents of the original model? $\endgroup$ – R.. GitHub STOP HELPING ICE Aug 19 '19 at 12:39
  • 1
    $\begingroup$ OK, I confirmed that the original model doesn't extend below z=0, so I think this is either a bug in openscad or (probably more likely) an error in the mesh. $\endgroup$ – R.. GitHub STOP HELPING ICE Aug 19 '19 at 16:33
1
$\begingroup$

It is interesting that the WTH line and the next line both should remove a cylinder of the same diameter from the same location. Only the height is different.

It could be interesting to remove the first King/Queen line and see if there is a change.

Have you checked the STL file with another tool, other than OpenSCAD? There may be a kink in the STL that confuses the geometry engine in OpenSCAD. The first difference could be catching the kink, and the second one carving out the magnet body in the bottom.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Also maybe try intersection instead of difference to see what happens. $\endgroup$ – R.. GitHub STOP HELPING ICE Aug 19 '19 at 16:33
  • $\begingroup$ Excellent explanation, thanks. The "WTH" cylinder is centered on the queen piece, and that has a sphere with lots of faces on top. So it looks like the "kink" is inside the queen where the sphere and the base cube overlap, and by accident, my trial-and-error removing of cylinders also removed just the right spot. $\endgroup$ – Florian Echtler Aug 19 '19 at 20:20
4
$\begingroup$

I see you've accepted cmm's answer, but I'd still like to take a stab at the mechanism of the failure based on your comment on it:

Excellent explanation, thanks. The "WTH" cylinder is centered on the queen piece, and that has a sphere with lots of faces on top. So it looks like the "kink" is inside the queen where the sphere and the base cube overlap, and by accident, my trial-and-error removing of cylinders also removed just the right spot.

My guess is that if you look at the triangle set of the STL file, you'll find the interior of the queen contains the parts of the cube that are inside the sphere and the parts of the sphere that are inside the cube; they may not even be clipped to meet each other properly where they cross each other's surfaces. Sadly there are lots of tools producing invalid STL files like this. The longer cylinder is probaly sufficient to overlap with where the cube and sphere cross, forcing OpenSCAD to break down the model in that region and recompute the mesh where the components overlap. Without that recomputation, the differences likely end up interacting with just the "sphere part" of the STL mesh.

This explanation also seems to be consistent with the description of the thing on thingiverse:

I much preferred the style of Bauhaus set that TeamTeaUSA's designed, but there was a lot of fiddling with the queen and the knight wouldn't print without supports. So I nestled the queen's sphere further into the body so it would print standing up, added supports for the knight and plated the whole thing.

where it looks like the creator took someone else's STL files and moved parts around to create an overlap, likely without proper tooling that could regenerate a valid mesh.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Thank you for the detailed explanation! $\endgroup$ – Florian Echtler Aug 20 '19 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.