Friday, August 8, 2014

Day 347 - Friday Fail: Self-Intersecting Faces Edition

It seems that the MakerBot Desktop software has an upper bound on the number of "self-intersecting faces" that can be in a model. When I had just a couple of squares hinged together, I didn't have any problems. But with six square faces all with hinges and snaps, there were over 500 of these bad faces (according to MeshLab), caused by triangles that end up somehow sharing parts in the OpenSCAD code. Desktop can't open a file with that much badness, and for a long time I went through a crash/restart/crash/turn-it-off-and-on-again/restart/crash/uninstall/reinstall/forever cycle until I finally figured out that I should maybe go repair the mesh of my file. When I got the number of self-intersecting faces down under 50 by adding additional "fudges" to my OpenSCAD code, MakerBot Desktop could finally open it.

Here's what the remaining 41 self-intersecting faces look like in MeshLab, after selecting Cleaning and Repairing and applying Select Self Intersecting Faces. I could get rid of these also but at this point thing were working so I left well enough alone.

With fudge set to a teeny 0.1, we can sneak in fudges all over the OpenSCAD code with no effect on the printed size of the model, like this:

The trick is to make sure that none of your fudges intersect exactly with any of your other fudges. To avoid having two triangles that share the same face you need to keep track of how you've nudged everything - or change the value of fudge - so that you don't fudge-nudge other things into the same place.