Open bebbi opened 9 years ago
I haven't been able to get to the bottom of this but it looks like it's caused by nasty rounding errors. I guess these might leave small holes in the CSG so it's no longer watertight. At least that's what !sidemapisempty means: some sides have not been matched with a companion side in opposite direction.
I'd suggest (for now) just to comment out the 'throw new Error("!sidemapisempty");' line. The resulting solid is not watertight but many slicers will be able to handle this.
For completeness, here's another one. It's a very different path to csg, so it may help (or distract..)
function main() {
var res = CSG.sphere({
radius: 1,
resolution: 50
});
var stretchradius = [10, 4];
var roundradius = [2, 3.5, 0.001];
res = res.scale(roundradius);
res = res.stretchAtPlane([1, 0, 0], [0, 0, 0], stretchradius[0]);
res = res.stretchAtPlane([0, 1, 0], [0, 0, 0], stretchradius[1]);
return res;
}
Meshmixer shows holes (blue pin) and non-manifold areas (red pin):
FYI, I've found that fixTJunctions() after a simple CSG operation leaves one T-junction untouched:
function main() {
return CSG.cube({radius: 1.0, center: [0, 0, 0]})
.subtract(CSG.cube({radius: 0.6, center: [0, 0, 0.5]}))
.scale(10)
.fixTJunctions();
}
Here is a screenshot of the output geometry opened in MeshLab:
@sergerusso has an open pull request at @spiritdude OpenJSCAD.org, which addresses this issue as well. Please review.
See also #60 . This issue here is about fixing fixTJunctions.. While I think #60 is more important, here is another example that trigger either assertionFailed or sidemapIsEmpty depending on very minor changes in numbers. Possibly helps narrow down the issue.