Hi, I have a small script that generates 2D Supershapes. I want to 3Dprint some of these shapes and that works fine until I add a cylinder (or a square) to the shape. When I render it I get: WARNING: Object may not be a valid 2manifold and may need repair! Is there a way to avoid this?
I added the script. To produce the warning uncomment the last line. a = 1; b = 1; m = 7/6 ; n1 = 0.3; n2 = 0.3; n3 = 0.3; radius = 30; range_multiplier = 6; function superformula(theta) = pow(pow(abs(1 / a * cos(m/4*theta)),n2)+ pow(abs(1 / a * sin(m/4*theta)),n3), 1 / n1); function supershape(range_multiplier) = [for (theta = [0:1:360 * range_multiplier]) [radius/superformula(theta) * cos(theta), radius/superformula(theta) * sin(theta)] ]; linear_extrude(3.2) polygon(supershape(range_multiplier)); //cylinder(r=radius,h=1); 
On 17. mai 2017 12:01, Eric Buijs wrote:
> Hi, I have a small script that generates 2D Supershapes. I want to 3Dprint > some of these shapes and that works fine until I add a cylinder (or a > square) to the shape. When I render it I get: WARNING: Object may not be a > valid 2manifold and may need repair! Is there a way to avoid this? Yes, do not create nonmanifold topology in the first place :) That is in fact what you are doing with those shapes. You have solids that share only single edges with neighbour objects. That is 1manifold and not 2manifold. You can tweak those shapes into creating 2 manifold intersections with each other simply by adding a small offset to the polygon: ======= a = 1; b = 1; m = 7/6 ; n1 = 0.3; n2 = 0.3; n3 = 0.3; radius = 30; range_multiplier = 6; function superformula(theta) = pow(pow(abs(1 / a * cos(m/4*theta)),n2)+ pow(abs(1 / a * sin(m/4*theta)),n3), 1 / n1); function supershape(range_multiplier) = [for (theta = [0:1:360 * range_multiplier]) [radius/superformula(theta) * cos(theta), radius/superformula(theta) * sin(theta)] ]; linear_extrude(3.2) offset(r=0.001) polygon(supershape(range_multiplier)); cylinder(r=radius,h=1); Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
On 17. mai 2017 13:09, Carsten Arnholm wrote:
> On 17. mai 2017 12:01, Eric Buijs wrote: >> Hi, I have a small script that generates 2D Supershapes. I want to >> 3Dprint >> some of these shapes and that works fine until I add a cylinder (or a >> square) to the shape. When I render it I get: WARNING: Object may not >> be a >> valid 2manifold and may need repair! Is there a way to avoid this? > > Yes, do not create nonmanifold topology in the first place :) That is By the way, after closer inspection it looks like you are creating a complex shape using a single highly selfintersecting polygon. That is something I would expect to cause failure either way. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by cacb
The addition of the offset appears to be working. With the stl file I was able to generate a valid gcode file in Cura. I will print it later today and will let you know the result.

This is a very interesting case. The polygonal line that defines the polygon is not a 1manifold due to selfintersections. The polygon is not simple. There are a few interpretation alternatives what is inside of a nonsimple polygon. The one OpenSCAD/CGAL seems to choose may result in a non2manifold when extruded. One example where the extrusion of nonsimple polygon is accepted as 2manifold by CGAL follows: It generates a 2manifold even if the reverse() is excluded in the polygon definition. However, if this last polygon is taking as an input shape for sweep.scad the resulting polyhedron will be refused as a 2manifold. function circle(r) = [for(a=[0:10:360]) r*[cos(a), sin(a)]]; function reverse(p) = [for(i=[len(p)1:1:0]) p[i]]; linear_extrude(2) polygon(concat(circle(20),reverse(circle(10)))); cube(30); 20170517 9:15 GMT03:00 Eric Buijs <[hidden email]>: The addition of the offset appears to be working. With the stl file I was _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
On 17. mai 2017 16:57, Ronaldo Persiano wrote:
> One example where the > extrusion of nonsimple polygon is accepted as 2manifold by CGAL follows: > > function circle(r) = [for(a=[0:10:360]) r*[cos(a), sin(a)]]; > function reverse(p) = [for(i=[len(p)1:1:0]) p[i]]; > > linear_extrude(2) > polygon(concat(circle(20),reverse(circle(10)))); > cube(30); This is a polygon with 74 edges in a single loop. Edge 37 runs from [20,0] (vertex37) to [10,0] (vertex38) and the final edge 74 runs from [10,0] (vertex74) to [20,0] (vertex01). There are coinciding vertices (37/01 and 38/74) and coinciding edges (37/74 , parallel and overlapping). It is a classic "2*PI problem". I would classify that as a self intersecting polygon. If the polygon had been defined with an inner and outer loop instead, it would be well defined. It ultimately falls into "undefined behaviour" category when you have a polygon with either intersecting nonparallel edges or overlapping parallel edges. The model by Eric Buijs that "worked" with an offset was in effect also relying on undefined behaviour for this reason. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
The polygon I have defined will have different nature if the reverse operation is removed. As is, the polygon is not simple but "well defined" in the sense that it has a well defined interior. Its regularization ( regularization(P) = closure(interior(P)) ) would be identical to the one with inner and outer loops. However, if the reverse operation is removed, it will have a boundary cross and then its interior is not well defined anymore and no regularization would be possible.
20170517 14:33 GMT03:00 Carsten Arnholm <[hidden email]>: There are coinciding vertices (37/01 and 38/74) and coinciding edges (37/74 , parallel and overlapping). It is a classic "2*PI problem". I would classify that as a self intersecting polygon. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by cacb
I will not pretend that I fully understand the discussion but the 3Dprint came out great.

ok thinking in my limited mathmatically way, I can see there might be an
issue with nearly parallel triangles.... but it kinda seems like I dunno am I missing something to do with the issues... On 17/05/17 21:03, Eric Buijs wrote: > I will not pretend that I fully understand the discussion but the 3Dprint > came out great. > > > >  > View this message in context: http://forum.openscad.org/Objectmaynotbeavalid2manifoldandmayneedrepairtp21489p21500.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > 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 
Chris, cube(10);Eric Buijs issue has not anything in common with nearly parallel triangles. It is a nonmanifold issue like the one where two cubes have one edge in common. 20170517 19:49 GMT03:00 Mr C Camacho <[hidden email]>: ok thinking in my limited mathmatically way, I can see there might be an issue with nearly parallel triangles.... _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Free forum by Nabble  Edit this page 