Nabble has removed Mailing-list integration.
Posts created here DO NOT GET SENT TO THE MAILING LIST.
Mailing-list emails DO NOT GET POSTED TO THE FORUM.
So basically the Forum is now out of date, we are looking into migrating the history.

# How to get an outline of a 2D object?

35 messages
12
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 On 18.11.2020 12:53, Parkinbot wrote: > A boundingbox function would probably return me the coordinates of the > diagonal and I could calculate the center and a translation, just like you > do it. > The center of a boundingbox is not guaranteed to be located within its 2d shape, although it will in most cases. A general solution would be to find the different edge loops and discard all but the one covering the largest area. Carsten Arnholm > _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 In reply to this post by Parkinbot For convex outlines, hull() would be enough to get the outline.It is not difficult to get an approximation of the bounding box center as a very small square. But the hard issue is that the bounding box center will not be a "visual center" in general (non-convex-cases). In some cases, the outline has no visual center. Consider the following polygon for instance:module polyg()   difference() {    square(20,center=true);    for(x=7*[-1,1], y=7*[-1,1])       translate([x,y])         circle(5);       circle(3);}projection()linear_extrude(height = 1, scale =0)polyg();We can relax the "visual center" condition. If P is a list of points such that all vertices of the outline are visible by at least one point in P, then fill_holes(P) will compute the correct outline:module fill_holes2(P)   intersection_for(p=P)    translate(p) {      projection()        linear_extrude(1, scale=0.0001)          translate( -p) children();    scale(.01) hull() children();  }For example:P = [ [10,0], [-10,0], [0,10], [0,-10], [0,0] ];fill_holes2(P) polyg();However, I can't see a simple way to find a list P like that.Btw, linear_extrude with scale=0 will produce a non-manifold when the polygon has holes.Em qua., 18 de nov. de 2020 às 11:54, Parkinbot <[hidden email]> escreveu:A boundingbox function would probably return me the coordinates of the diagonal and I could calculate the center and a translation, just like you do it. Of course a boundingbox function can also be implemented to just return the [dx, dy, dz] extents according to the three axes. But this would be the worst way to implement it. Usually it is implemented to return a pair of 3D-points or a box object with an origin and the [dx, dy, dz] extents. -- Sent from: http://forum.openscad.org/ _______________________________________________ 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
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 In reply to this post by Ronaldo Ronaldo wrote > Nice designs, > > I guess that if you could collect all arc and circle center points in a > list P, fill_holes2(P) would give you the outline you want. Thanks! Well, I do the arcs by using offset() to get the rounded shapes, and I do it in layers (small radius for outside corners, large for inside corners, then I add some elements (such as the hinges) and put a small radius on the new inside corners. All this on parametric designs. While I suppose I could track all this, it's not a task I would enjoy... -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 In reply to this post by cacb cacb wrote > The center of a boundingbox is not guaranteed to be located within its > 2d shape, although it will in most cases. Ups, yeah, of course you are right. Non-convexity is a mess. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 In reply to this post by Troberg Another example where this would be nice, and where the inside geometry isn't defined by me, so I can't "reverse engineer" my code to remove the holes. A very typical laser cutter example: Say that you are making a sign, with some text, and a baseline to hold the characters together. So, basically, a union of a square and some text. Very common laser cutting task. You want to engrave the letters, but cut the outline of the object (with a slight offset), but you don't want any holes in it. I can't reverse engineer the font, a hull() would just make a mess of everything, using offset to remove holes would destroy the outline as well. The only way I can figure out to make it work is if there were some kind of built-in outline() module. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 Can't you just use Ronaldo's  fill_holes2(P) solution? All you have to do is nominate some positions on the object that together can see all the vertices of the perimeter. For the item you describe, that would seem not to be many and they don't need great precision.On Mon, 23 Nov 2020 at 11:13, Troberg <[hidden email]> wrote:Another example where this would be nice, and where the inside geometry isn't defined by me, so I can't "reverse engineer" my code to remove the holes. A very typical laser cutter example: Say that you are making a sign, with some text, and a baseline to hold the characters together. So, basically, a union of a square and some text. Very common laser cutting task. You want to engrave the letters, but cut the outline of the object (with a slight offset), but you don't want any holes in it. I can't reverse engineer the font, a hull() would just make a mess of everything, using offset to remove holes would destroy the outline as well. The only way I can figure out to make it work is if there were some kind of built-in outline() module. -- Sent from: http://forum.openscad.org/ _______________________________________________ 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
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 I'm thinking more like this: module sign(){         text("Boobies!",100);         square([520,5]); } //engrave color([0,0,0]) translate([0,0,1]) sign(); //cut, but without the holes offset(10) sign(); -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 On 23.11.2020 14:47, Troberg wrote: > I'm thinking more like this: > > module sign(){ > text("Boobies!",100); > square([520,5]); > } > > //engrave > color([0,0,0]) > translate([0,0,1]) > sign(); > > //cut, but without the holes > offset(10) > sign(); Sure, no problem. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org outline.dxf (9K) Download Attachment outline.scad (32 bytes) Download Attachment
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 In reply to this post by Troberg Close enough? Maybe the curves (vs corners) added by the negative offset are unwanted? Might be suited to a milling machine or router but maybe sharp corners are wanted to show off very narrow kerf cutter. module sign(){     text("Boobies!",100);     square([520,5]); } //engrave color([0,0,0]) translate([0,0,1]) sign(); //Fill the holes module fill(){   offset(20)   sign(); } //Cut offset(-10) fill(); -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 If this is close enough, now the problem is finding the minimum offset for fill(). Setting os=9.5 below does not work. os=10; module sign(){     text("Boobies!",100);     square([520,5]); } //engrave color([0,0,0]) translate([0,0,1]) sign(); //Fill the holes module fill(){   offset(10 + os)   sign(); } //Cut offset(-os) fill(); -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: How to get an outline of a 2D object?

 In reply to this post by Ronaldo On 23.11.20 13:37, Ronaldo Persiano wrote: > The char "@" for instance cannot be correctly processed That's a good example. What would a built-in outline() function do exactly? Using just the outer most polygon would fill only the inner hole but still leave the tail. ciao,   Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Torsten
Open this post in threaded view
|