Hi -
I was making a complex polyhedron, and keep encountering the "UI-WARNING: Object may not be a valid 2-manifold and may need repair!" message upon rendering. I was pretty sure that my polyhedron was valid, so I kept simplifying and simplifying until I got to a trivial repro case. See the below program. The fascinating thing (to me) is that when I just include the polyhedron, it renders without error. But when I also add the (non-touching) red cube off the positive x side, then the render step shows an error. I cannot help but think this is a bug somewhere? I can't see why two non-intersecting objects would render individually without errors, but when both are in the same file, there would be an error. Just in case it's relevant, I'm on OpenSCAD version 2019.05 running on OSX 10.14.6. color(c = "green") { points = [ [0, 0, 1], // Lower left front #1 [0, 20, 0], // Lower left back [10, 20, 0], // Lower right back [10, 0, 1], // Lower right front #1 [0, 0, 30], // Upper left front [0, 20, 30], // Upper left back [10, 20, 30], // Upper right back [10, 0, 30], // Upper right front [0, 1, 0], // Lower left front #2 [10, 1, 0] // Lower right front #2 ]; faces = [ [9, 2, 1, 8], // Bottom [4, 5, 6, 7], // Top [2, 3, 7, 6], // Right top [3, 2, 9], // Right bottom [5, 4, 0, 1], // Left top [1, 8, 0], // Left bottom [4, 7, 3, 0], // Front [6, 5, 1, 2], // Back [0, 3, 9, 8] // Angled front-bottom ]; polyhedron(points=points, faces=faces); } translate(v = [15, 0, 0]) { color(c = "red") { cube(size = [10, 20, 30]); } } -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
The keyword is winding order, this face is looking
in the wrong direction (which you can see as pink-ish color when using F12): [1, 8, 0], // Left bottom If you flip it, e.g. by using: [1, 0, 8], // Left bottom the union works fine. ciao, Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
|
That was the hardest concept for me to 'grok' in GL classes. Still not
sure I got it completely. On 11/27/20 7:05 PM, Torsten Paul wrote: > The keyword is winding order, this face is looking > in the wrong direction (which you can see as pink-ish > color when using F12): > > [1, 8, 0], // Left bottom > > If you flip it, e.g. by using: > > [1, 0, 8], // Left bottom > > the union works fine. > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by ssuchter
It looks like some people have identified your problem (faces in wrong
orientation), but not explained this fact: if you make a bogus polyhedron by itself in your model it doesn't get processed by CGAL. A single polyhedron will always appear valid. Only when you add a second object and force a union computation, for example, does your polyhedron get checked for validity. Call it a quirk rather than a bug. Depending on what you're trying to do you might find the VNF (vertices 'n faces) code in the BOSL2 library helpful for constructing your polyhedron. It can make this task easier to get right, with everything valid. https://github.com/revarbat/BOSL2/wiki/vnf.scad ssuchter wrote > Hi - > > I was making a complex polyhedron, and keep encountering the "UI-WARNING: > Object may not be a valid 2-manifold and may need repair!" message upon > rendering. I was pretty sure that my polyhedron was valid, so I kept > simplifying and simplifying until I got to a trivial repro case. See the > below program. The fascinating thing (to me) is that when I just include > the > polyhedron, it renders without error. But when I also add the > (non-touching) > red cube off the positive x side, then the render step shows an error. > > I cannot help but think this is a bug somewhere? I can't see why two > non-intersecting objects would render individually without errors, but > when > both are in the same file, there would be an error. Just in case it's > relevant, I'm on OpenSCAD version 2019.05 running on OSX 10.14.6. > > color(c = "green") { > points = [ > [0, 0, 1], // Lower left front #1 > [0, 20, 0], // Lower left back > [10, 20, 0], // Lower right back > [10, 0, 1], // Lower right front #1 > [0, 0, 30], // Upper left front > [0, 20, 30], // Upper left back > [10, 20, 30], // Upper right back > [10, 0, 30], // Upper right front > [0, 1, 0], // Lower left front #2 > [10, 1, 0] // Lower right front #2 > ]; > faces = [ > [9, 2, 1, 8], // Bottom > [4, 5, 6, 7], // Top > [2, 3, 7, 6], // Right top > [3, 2, 9], // Right bottom > [5, 4, 0, 1], // Left top > [1, 8, 0], // Left bottom > [4, 7, 3, 0], // Front > [6, 5, 1, 2], // Back > [0, 3, 9, 8] // Angled front-bottom > ]; > polyhedron(points=points, faces=faces); > } > > translate(v = [15, 0, 0]) { > color(c = "red") { > cube(size = [10, 20, 30]); > } > } > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Thanks everyone for the help. I'm annoyed that I got that face backwards - I
thought I double checked everything. I understand the quirk about the union bit now. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |