I’m facing a uncommon behaviour regarding Sketchup when using the Ruby API.
When I’m generating geometry (more precisely faces) some face parts are overlapped and I really gets overlapped faces and dirty topology instead of having splited faces as if I was drawing it manually.
It seems that’s Sketchup use a post process when drawing manually that isn’t applied when when drawing using the Ruby API. Is there any way to call that kind of post process using the API or do I have to be more accurate when drawing and explicitly drawing each splited edges/faces ?
If you draw you various touching/overlapping faces inside a group and then explode the group the explosion returns an array of the various entities relating to the explosion.
Because overlapping faces will merge with the explosion it has the same affect as if you drew the overlaps manually: you can filter the results to get faces with more that two faces and erase them ?
# explode and collect overlaps
olaps = explode.group.grep(Sketchup::Edge).find_all{|e| e.faces.length != 1 }
# optional delete
olaps[0].parent.entities,erase_entities(olaps) if olaps[0]