Object may not be a valid 2-manifold and may need repair!

10 messages
Open this post in threaded view
|

Object may not be a valid 2-manifold and may need repair!

 Hi, I have a small script that generates 2D Supershapes. I want to 3D-print 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 2-manifold 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);
Open this post in threaded view
|

Re: Object may not be a valid 2-manifold and may need repair!

 On 17. mai 2017 12:01, Eric Buijs wrote: > Hi, I have a small script that generates 2D Supershapes. I want to 3D-print > 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 2-manifold and may need repair! Is there a way to avoid this? Yes, do not create non-manifold 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 1-manifold and not 2-manifold. 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
Open this post in threaded view
|

Re: Object may not be a valid 2-manifold and may need repair!

 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 >> 3D-print >> 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 2-manifold and may need repair! Is there a way to avoid this? > > Yes, do not create non-manifold 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 self-intersecting 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
Open this post in threaded view
|

Re: Object may not be a valid 2-manifold and may need repair!

 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.
Open this post in threaded view
|

Re: Object may not be a valid 2-manifold and may need repair!

Open this post in threaded view
|

Re: Object may not be a valid 2-manifold and may need repair!

 On 17. mai 2017 16:57, Ronaldo Persiano wrote: > One example where the > extrusion of non-simple polygon is accepted as 2-manifold 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 non-parallel 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
Open this post in threaded view
|

Re: Object may not be a valid 2-manifold and may need repair!

 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.2017-05-17 14:33 GMT-03:00 Carsten Arnholm :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 non-parallel 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. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

Re: Object may not be a valid 2-manifold and may need repair!

 In reply to this post by cacb I will not pretend that I fully understand the discussion but the 3D-print came out great.