discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

converting 2d paths to simple 3d shapes within BOSL2

JG
Jonathan Gilbert
Mon, Jul 24, 2023 2:28 PM

Is there a general procedure to convert a 2D path into a 3D shape?

I'm currently taking the path produced by arc(), duplicating the points to
an offset, reversing the duplication into a new path, and concat()ing the
two paths into a single 2D shape, and using that to extrude or sweep or
whatnot.

include <BOSL2/std.scad>

module _arc_arm(d, h=1, w=0) {
    width = (w==0) ? d * 0.05 : w;

    c1 = arc(36, d=d, angle=90);

    c2 = reverse(
        arc(36, d=d, angle=90,
            cp=apply(move([-width/2, -width/2]), [0, 0])
        ));

    c = concat(c1, c2);

     attachable(CENTER, 0, UP, d=d, h=h) {
        down(h/2)
            linear_sweep(c, h=h);
        children();
    }
}

_arc_arm(30, 2);

I'm using arc() in this example, but this is essentially what I'm doing for
any arbitrary 2D path that I need to convert into a simple shape with a
height dimension.

I'm not sure I'm doing this the most easiest or efficiently possible, and
I'm looking for guidance. Is there a better way to take a simple, convex
path and convert it to a 2D shape somewhere within BOSL2 somewhere?

--

Is there a general procedure to convert a 2D path into a 3D shape? I'm currently taking the path produced by arc(), duplicating the points to an offset, reversing the duplication into a new path, and concat()ing the two paths into a single 2D shape, and using that to extrude or sweep or whatnot. ``` include <BOSL2/std.scad> module _arc_arm(d, h=1, w=0) { width = (w==0) ? d * 0.05 : w; c1 = arc(36, d=d, angle=90); c2 = reverse( arc(36, d=d, angle=90, cp=apply(move([-width/2, -width/2]), [0, 0]) )); c = concat(c1, c2); attachable(CENTER, 0, UP, d=d, h=h) { down(h/2) linear_sweep(c, h=h); children(); } } _arc_arm(30, 2); ``` I'm using arc() in this example, but this is essentially what I'm doing for any arbitrary 2D path that I need to convert into a simple shape with a height dimension. I'm not sure I'm doing this the most easiest or efficiently possible, and I'm looking for guidance. Is there a better way to take a simple, convex path and convert it to a 2D shape somewhere within BOSL2 somewhere? -- - Jon Gilbert jong@jong.org / jgilbertsjc@gmail.com
AM
Adrian Mariano
Mon, Jul 24, 2023 5:34 PM

Maybe stroke or path_sweep will do what you want working directly on the
path.  You might need to use path3d to promote a 2d path to 3d.

On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert jong@jong.org wrote:

Is there a general procedure to convert a 2D path into a 3D shape?

I'm currently taking the path produced by arc(), duplicating the points to
an offset, reversing the duplication into a new path, and concat()ing the
two paths into a single 2D shape, and using that to extrude or sweep or
whatnot.

include <BOSL2/std.scad>

module _arc_arm(d, h=1, w=0) {
    width = (w==0) ? d * 0.05 : w;

    c1 = arc(36, d=d, angle=90);

    c2 = reverse(
        arc(36, d=d, angle=90,
            cp=apply(move([-width/2, -width/2]), [0, 0])
        ));

    c = concat(c1, c2);

     attachable(CENTER, 0, UP, d=d, h=h) {
        down(h/2)
            linear_sweep(c, h=h);
        children();
    }
}

_arc_arm(30, 2);

I'm using arc() in this example, but this is essentially what I'm doing
for any arbitrary 2D path that I need to convert into a simple shape with a
height dimension.

I'm not sure I'm doing this the most easiest or efficiently possible, and
I'm looking for guidance. Is there a better way to take a simple, convex
path and convert it to a 2D shape somewhere within BOSL2 somewhere?

--


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Maybe stroke or path_sweep will do what you want working directly on the path. You might need to use path3d to promote a 2d path to 3d. On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert <jong@jong.org> wrote: > Is there a general procedure to convert a 2D path into a 3D shape? > > I'm currently taking the path produced by arc(), duplicating the points to > an offset, reversing the duplication into a new path, and concat()ing the > two paths into a single 2D shape, and using that to extrude or sweep or > whatnot. > > ``` > include <BOSL2/std.scad> > > module _arc_arm(d, h=1, w=0) { > width = (w==0) ? d * 0.05 : w; > > c1 = arc(36, d=d, angle=90); > > c2 = reverse( > arc(36, d=d, angle=90, > cp=apply(move([-width/2, -width/2]), [0, 0]) > )); > > c = concat(c1, c2); > > attachable(CENTER, 0, UP, d=d, h=h) { > down(h/2) > linear_sweep(c, h=h); > children(); > } > } > > _arc_arm(30, 2); > ``` > > I'm using arc() in this example, but this is essentially what I'm doing > for any arbitrary 2D path that I need to convert into a simple shape with a > height dimension. > > I'm not sure I'm doing this the most easiest or efficiently possible, and > I'm looking for guidance. Is there a better way to take a simple, convex > path and convert it to a 2D shape somewhere within BOSL2 somewhere? > > -- > - Jon Gilbert > jong@jong.org / jgilbertsjc@gmail.com > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
DP
Dan Perry
Mon, Jul 24, 2023 5:57 PM

Here is some code that uses stroke(arc()) that may be helpful -- used for
the slotting on the bottom of the utensil dryer.  stroke() comes from the
BOSL2 library.
https://www.printables.com/model/527730-utensil-drying-rack-openscad-parametric/files

Dan

On Mon, Jul 24, 2023 at 6:35 PM Adrian Mariano avm4@cornell.edu wrote:

Maybe stroke or path_sweep will do what you want working directly on the
path.  You might need to use path3d to promote a 2d path to 3d.

On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert jong@jong.org wrote:

Is there a general procedure to convert a 2D path into a 3D shape?

I'm currently taking the path produced by arc(), duplicating the points
to an offset, reversing the duplication into a new path, and concat()ing
the two paths into a single 2D shape, and using that to extrude or sweep or
whatnot.

include <BOSL2/std.scad>

module _arc_arm(d, h=1, w=0) {
    width = (w==0) ? d * 0.05 : w;

    c1 = arc(36, d=d, angle=90);

    c2 = reverse(
        arc(36, d=d, angle=90,
            cp=apply(move([-width/2, -width/2]), [0, 0])
        ));

    c = concat(c1, c2);

     attachable(CENTER, 0, UP, d=d, h=h) {
        down(h/2)
            linear_sweep(c, h=h);
        children();
    }
}

_arc_arm(30, 2);

I'm using arc() in this example, but this is essentially what I'm doing
for any arbitrary 2D path that I need to convert into a simple shape with a
height dimension.

I'm not sure I'm doing this the most easiest or efficiently possible, and
I'm looking for guidance. Is there a better way to take a simple, convex
path and convert it to a 2D shape somewhere within BOSL2 somewhere?

--


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Here is some code that uses stroke(arc()) that may be helpful -- used for the slotting on the bottom of the utensil dryer. stroke() comes from the BOSL2 library. https://www.printables.com/model/527730-utensil-drying-rack-openscad-parametric/files Dan On Mon, Jul 24, 2023 at 6:35 PM Adrian Mariano <avm4@cornell.edu> wrote: > Maybe stroke or path_sweep will do what you want working directly on the > path. You might need to use path3d to promote a 2d path to 3d. > > On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert <jong@jong.org> wrote: > >> Is there a general procedure to convert a 2D path into a 3D shape? >> >> I'm currently taking the path produced by arc(), duplicating the points >> to an offset, reversing the duplication into a new path, and concat()ing >> the two paths into a single 2D shape, and using that to extrude or sweep or >> whatnot. >> >> ``` >> include <BOSL2/std.scad> >> >> module _arc_arm(d, h=1, w=0) { >> width = (w==0) ? d * 0.05 : w; >> >> c1 = arc(36, d=d, angle=90); >> >> c2 = reverse( >> arc(36, d=d, angle=90, >> cp=apply(move([-width/2, -width/2]), [0, 0]) >> )); >> >> c = concat(c1, c2); >> >> attachable(CENTER, 0, UP, d=d, h=h) { >> down(h/2) >> linear_sweep(c, h=h); >> children(); >> } >> } >> >> _arc_arm(30, 2); >> ``` >> >> I'm using arc() in this example, but this is essentially what I'm doing >> for any arbitrary 2D path that I need to convert into a simple shape with a >> height dimension. >> >> I'm not sure I'm doing this the most easiest or efficiently possible, and >> I'm looking for guidance. Is there a better way to take a simple, convex >> path and convert it to a 2D shape somewhere within BOSL2 somewhere? >> >> -- >> - Jon Gilbert >> jong@jong.org / jgilbertsjc@gmail.com >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JG
Jonathan Gilbert
Mon, Jul 24, 2023 6:15 PM

soooort of, but not really: path_sweep() gets me a shape passed along the
path, which I use elsewhere and is quite nifty, but in this case I'm
looking to take a path and convert it to a polygon which has a width, which
I then extrude into a height.

path -> path_sweep() (with a shape of the desired height, say a circle())
gets me a tubular shape that follows the path. It works so long as the
height and the width of the final shape is the same, but not so much if I
want a shape that is much taller than it is thick.

path -> stroke() (with a width) -> linear_extrude() (to the desired height)  kind of gets me where I want to be, but there's no attachment
points (which I need) or VNF (which I don't need today but would probably
like to have in the future).

path -> [something] -> linear_sweep() (to the desired height)  would give
me fully what I'm looking for.

I guess the question rephrased is: given a path and a "width" or
"thickness", how do I create a 2d polygon that follows that path, suitable
for extruding with linear_sweep()?

On Mon, Jul 24, 2023 at 10:35 AM Adrian Mariano avm4@cornell.edu wrote:

Maybe stroke or path_sweep will do what you want working directly on the
path.  You might need to use path3d to promote a 2d path to 3d.

On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert jong@jong.org wrote:

Is there a general procedure to convert a 2D path into a 3D shape?

I'm currently taking the path produced by arc(), duplicating the points
to an offset, reversing the duplication into a new path, and concat()ing
the two paths into a single 2D shape, and using that to extrude or sweep or
whatnot.

include <BOSL2/std.scad>

module _arc_arm(d, h=1, w=0) {
    width = (w==0) ? d * 0.05 : w;

    c1 = arc(36, d=d, angle=90);

    c2 = reverse(
        arc(36, d=d, angle=90,
            cp=apply(move([-width/2, -width/2]), [0, 0])
        ));

    c = concat(c1, c2);

     attachable(CENTER, 0, UP, d=d, h=h) {
        down(h/2)
            linear_sweep(c, h=h);
        children();
    }
}

_arc_arm(30, 2);

I'm using arc() in this example, but this is essentially what I'm doing
for any arbitrary 2D path that I need to convert into a simple shape with a
height dimension.

I'm not sure I'm doing this the most easiest or efficiently possible, and
I'm looking for guidance. Is there a better way to take a simple, convex
path and convert it to a 2D shape somewhere within BOSL2 somewhere?

--


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

soooort of, but not really: path_sweep() gets me a shape passed along the path, which I use elsewhere and is quite nifty, but in this case I'm looking to take a path and convert it to a polygon which has a width, which I then extrude into a height. `path -> path_sweep() (with a shape of the desired height, say a circle())` gets me a tubular shape that follows the path. It works so long as the height and the width of the final shape is the same, but not so much if I want a shape that is much taller than it is thick. `path -> stroke() (with a width) -> linear_extrude() (to the desired height)` kind of gets me where I want to be, but there's no attachment points (which I need) or VNF (which I don't need today but would probably like to have in the future). `path -> [something] -> linear_sweep() (to the desired height)` would give me fully what I'm looking for. I guess the question rephrased is: given a path and a "width" or "thickness", how do I create a 2d polygon that follows that path, suitable for extruding with linear_sweep()? On Mon, Jul 24, 2023 at 10:35 AM Adrian Mariano <avm4@cornell.edu> wrote: > Maybe stroke or path_sweep will do what you want working directly on the > path. You might need to use path3d to promote a 2d path to 3d. > > On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert <jong@jong.org> wrote: > >> Is there a general procedure to convert a 2D path into a 3D shape? >> >> I'm currently taking the path produced by arc(), duplicating the points >> to an offset, reversing the duplication into a new path, and concat()ing >> the two paths into a single 2D shape, and using that to extrude or sweep or >> whatnot. >> >> ``` >> include <BOSL2/std.scad> >> >> module _arc_arm(d, h=1, w=0) { >> width = (w==0) ? d * 0.05 : w; >> >> c1 = arc(36, d=d, angle=90); >> >> c2 = reverse( >> arc(36, d=d, angle=90, >> cp=apply(move([-width/2, -width/2]), [0, 0]) >> )); >> >> c = concat(c1, c2); >> >> attachable(CENTER, 0, UP, d=d, h=h) { >> down(h/2) >> linear_sweep(c, h=h); >> children(); >> } >> } >> >> _arc_arm(30, 2); >> ``` >> >> I'm using arc() in this example, but this is essentially what I'm doing >> for any arbitrary 2D path that I need to convert into a simple shape with a >> height dimension. >> >> I'm not sure I'm doing this the most easiest or efficiently possible, and >> I'm looking for guidance. Is there a better way to take a simple, convex >> path and convert it to a 2D shape somewhere within BOSL2 somewhere? >> >> -- >> - Jon Gilbert >> jong@jong.org / jgilbertsjc@gmail.com >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > -- - Jon Gilbert jong@jong.org / jgilbertsjc@gmail.com
AM
Adrian Mariano
Mon, Jul 24, 2023 7:49 PM

Use path sweep with a rectangle that is the desired much larger height.
That should be equivalent to your original construction.

On Mon, Jul 24, 2023, 14:16 Jonathan Gilbert jong@jong.org wrote:

soooort of, but not really: path_sweep() gets me a shape passed along the
path, which I use elsewhere and is quite nifty, but in this case I'm
looking to take a path and convert it to a polygon which has a width, which
I then extrude into a height.

path -> path_sweep() (with a shape of the desired height, say a circle()) gets me a tubular shape that follows the path. It works so long
as the height and the width of the final shape is the same, but not so much
if I want a shape that is much taller than it is thick.

path -> stroke() (with a width) -> linear_extrude() (to the desired height)  kind of gets me where I want to be, but there's no attachment
points (which I need) or VNF (which I don't need today but would probably
like to have in the future).

path -> [something] -> linear_sweep() (to the desired height)  would
give me fully what I'm looking for.

I guess the question rephrased is: given a path and a "width" or
"thickness", how do I create a 2d polygon that follows that path, suitable
for extruding with linear_sweep()?

On Mon, Jul 24, 2023 at 10:35 AM Adrian Mariano avm4@cornell.edu wrote:

Maybe stroke or path_sweep will do what you want working directly on the
path.  You might need to use path3d to promote a 2d path to 3d.

On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert jong@jong.org wrote:

Is there a general procedure to convert a 2D path into a 3D shape?

I'm currently taking the path produced by arc(), duplicating the points
to an offset, reversing the duplication into a new path, and concat()ing
the two paths into a single 2D shape, and using that to extrude or sweep or
whatnot.

include <BOSL2/std.scad>

module _arc_arm(d, h=1, w=0) {
    width = (w==0) ? d * 0.05 : w;

    c1 = arc(36, d=d, angle=90);

    c2 = reverse(
        arc(36, d=d, angle=90,
            cp=apply(move([-width/2, -width/2]), [0, 0])
        ));

    c = concat(c1, c2);

     attachable(CENTER, 0, UP, d=d, h=h) {
        down(h/2)
            linear_sweep(c, h=h);
        children();
    }
}

_arc_arm(30, 2);

I'm using arc() in this example, but this is essentially what I'm doing
for any arbitrary 2D path that I need to convert into a simple shape with a
height dimension.

I'm not sure I'm doing this the most easiest or efficiently possible,
and I'm looking for guidance. Is there a better way to take a simple,
convex path and convert it to a 2D shape somewhere within BOSL2 somewhere?

--


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Use path sweep with a rectangle that is the desired much larger height. That should be equivalent to your original construction. On Mon, Jul 24, 2023, 14:16 Jonathan Gilbert <jong@jong.org> wrote: > soooort of, but not really: path_sweep() gets me a shape passed along the > path, which I use elsewhere and is quite nifty, but in this case I'm > looking to take a path and convert it to a polygon which has a width, which > I then extrude into a height. > > `path -> path_sweep() (with a shape of the desired height, say a > circle())` gets me a tubular shape that follows the path. It works so long > as the height and the width of the final shape is the same, but not so much > if I want a shape that is much taller than it is thick. > > `path -> stroke() (with a width) -> linear_extrude() (to the desired > height)` kind of gets me where I want to be, but there's no attachment > points (which I need) or VNF (which I don't need today but would probably > like to have in the future). > > `path -> [something] -> linear_sweep() (to the desired height)` would > give me fully what I'm looking for. > > I guess the question rephrased is: given a path and a "width" or > "thickness", how do I create a 2d polygon that follows that path, suitable > for extruding with linear_sweep()? > > > On Mon, Jul 24, 2023 at 10:35 AM Adrian Mariano <avm4@cornell.edu> wrote: > >> Maybe stroke or path_sweep will do what you want working directly on the >> path. You might need to use path3d to promote a 2d path to 3d. >> >> On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert <jong@jong.org> wrote: >> >>> Is there a general procedure to convert a 2D path into a 3D shape? >>> >>> I'm currently taking the path produced by arc(), duplicating the points >>> to an offset, reversing the duplication into a new path, and concat()ing >>> the two paths into a single 2D shape, and using that to extrude or sweep or >>> whatnot. >>> >>> ``` >>> include <BOSL2/std.scad> >>> >>> module _arc_arm(d, h=1, w=0) { >>> width = (w==0) ? d * 0.05 : w; >>> >>> c1 = arc(36, d=d, angle=90); >>> >>> c2 = reverse( >>> arc(36, d=d, angle=90, >>> cp=apply(move([-width/2, -width/2]), [0, 0]) >>> )); >>> >>> c = concat(c1, c2); >>> >>> attachable(CENTER, 0, UP, d=d, h=h) { >>> down(h/2) >>> linear_sweep(c, h=h); >>> children(); >>> } >>> } >>> >>> _arc_arm(30, 2); >>> ``` >>> >>> I'm using arc() in this example, but this is essentially what I'm doing >>> for any arbitrary 2D path that I need to convert into a simple shape with a >>> height dimension. >>> >>> I'm not sure I'm doing this the most easiest or efficiently possible, >>> and I'm looking for guidance. Is there a better way to take a simple, >>> convex path and convert it to a 2D shape somewhere within BOSL2 somewhere? >>> >>> -- >>> - Jon Gilbert >>> jong@jong.org / jgilbertsjc@gmail.com >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > > > -- > - Jon Gilbert > jong@jong.org / jgilbertsjc@gmail.com > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JG
Jonathan Gilbert
Mon, Jul 24, 2023 8:00 PM

AH! Yes. See, that is exactly the sort of answer I was looking for: meets
my needs, easy to implement, and makes me feel a little foolish for not
thinking of it before. :D  Thank you!

On Mon, Jul 24, 2023 at 12:50 PM Adrian Mariano avm4@cornell.edu wrote:

Use path sweep with a rectangle that is the desired much larger height.
That should be equivalent to your original construction.

On Mon, Jul 24, 2023, 14:16 Jonathan Gilbert jong@jong.org wrote:

soooort of, but not really: path_sweep() gets me a shape passed along the
path, which I use elsewhere and is quite nifty, but in this case I'm
looking to take a path and convert it to a polygon which has a width, which
I then extrude into a height.

path -> path_sweep() (with a shape of the desired height, say a circle()) gets me a tubular shape that follows the path. It works so long
as the height and the width of the final shape is the same, but not so much
if I want a shape that is much taller than it is thick.

path -> stroke() (with a width) -> linear_extrude() (to the desired height)  kind of gets me where I want to be, but there's no attachment
points (which I need) or VNF (which I don't need today but would probably
like to have in the future).

path -> [something] -> linear_sweep() (to the desired height)  would
give me fully what I'm looking for.

I guess the question rephrased is: given a path and a "width" or
"thickness", how do I create a 2d polygon that follows that path, suitable
for extruding with linear_sweep()?

On Mon, Jul 24, 2023 at 10:35 AM Adrian Mariano avm4@cornell.edu wrote:

Maybe stroke or path_sweep will do what you want working directly on the
path.  You might need to use path3d to promote a 2d path to 3d.

On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert jong@jong.org wrote:

Is there a general procedure to convert a 2D path into a 3D shape?

I'm currently taking the path produced by arc(), duplicating the points
to an offset, reversing the duplication into a new path, and concat()ing
the two paths into a single 2D shape, and using that to extrude or sweep or
whatnot.

include <BOSL2/std.scad>

module _arc_arm(d, h=1, w=0) {
    width = (w==0) ? d * 0.05 : w;

    c1 = arc(36, d=d, angle=90);

    c2 = reverse(
        arc(36, d=d, angle=90,
            cp=apply(move([-width/2, -width/2]), [0, 0])
        ));

    c = concat(c1, c2);

     attachable(CENTER, 0, UP, d=d, h=h) {
        down(h/2)
            linear_sweep(c, h=h);
        children();
    }
}

_arc_arm(30, 2);

I'm using arc() in this example, but this is essentially what I'm doing
for any arbitrary 2D path that I need to convert into a simple shape with a
height dimension.

I'm not sure I'm doing this the most easiest or efficiently possible,
and I'm looking for guidance. Is there a better way to take a simple,
convex path and convert it to a 2D shape somewhere within BOSL2 somewhere?

--


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

AH! Yes. See, that is exactly the sort of answer I was looking for: meets my needs, easy to implement, and makes me feel a little foolish for not thinking of it before. :D Thank you! On Mon, Jul 24, 2023 at 12:50 PM Adrian Mariano <avm4@cornell.edu> wrote: > Use path sweep with a rectangle that is the desired much larger height. > That should be equivalent to your original construction. > > > On Mon, Jul 24, 2023, 14:16 Jonathan Gilbert <jong@jong.org> wrote: > >> soooort of, but not really: path_sweep() gets me a shape passed along the >> path, which I use elsewhere and is quite nifty, but in this case I'm >> looking to take a path and convert it to a polygon which has a width, which >> I then extrude into a height. >> >> `path -> path_sweep() (with a shape of the desired height, say a >> circle())` gets me a tubular shape that follows the path. It works so long >> as the height and the width of the final shape is the same, but not so much >> if I want a shape that is much taller than it is thick. >> >> `path -> stroke() (with a width) -> linear_extrude() (to the desired >> height)` kind of gets me where I want to be, but there's no attachment >> points (which I need) or VNF (which I don't need today but would probably >> like to have in the future). >> >> `path -> [something] -> linear_sweep() (to the desired height)` would >> give me fully what I'm looking for. >> >> I guess the question rephrased is: given a path and a "width" or >> "thickness", how do I create a 2d polygon that follows that path, suitable >> for extruding with linear_sweep()? >> >> >> On Mon, Jul 24, 2023 at 10:35 AM Adrian Mariano <avm4@cornell.edu> wrote: >> >>> Maybe stroke or path_sweep will do what you want working directly on the >>> path. You might need to use path3d to promote a 2d path to 3d. >>> >>> On Mon, Jul 24, 2023, 10:29 Jonathan Gilbert <jong@jong.org> wrote: >>> >>>> Is there a general procedure to convert a 2D path into a 3D shape? >>>> >>>> I'm currently taking the path produced by arc(), duplicating the points >>>> to an offset, reversing the duplication into a new path, and concat()ing >>>> the two paths into a single 2D shape, and using that to extrude or sweep or >>>> whatnot. >>>> >>>> ``` >>>> include <BOSL2/std.scad> >>>> >>>> module _arc_arm(d, h=1, w=0) { >>>> width = (w==0) ? d * 0.05 : w; >>>> >>>> c1 = arc(36, d=d, angle=90); >>>> >>>> c2 = reverse( >>>> arc(36, d=d, angle=90, >>>> cp=apply(move([-width/2, -width/2]), [0, 0]) >>>> )); >>>> >>>> c = concat(c1, c2); >>>> >>>> attachable(CENTER, 0, UP, d=d, h=h) { >>>> down(h/2) >>>> linear_sweep(c, h=h); >>>> children(); >>>> } >>>> } >>>> >>>> _arc_arm(30, 2); >>>> ``` >>>> >>>> I'm using arc() in this example, but this is essentially what I'm doing >>>> for any arbitrary 2D path that I need to convert into a simple shape with a >>>> height dimension. >>>> >>>> I'm not sure I'm doing this the most easiest or efficiently possible, >>>> and I'm looking for guidance. Is there a better way to take a simple, >>>> convex path and convert it to a 2D shape somewhere within BOSL2 somewhere? >>>> >>>> -- >>>> - Jon Gilbert >>>> jong@jong.org / jgilbertsjc@gmail.com >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> >> >> -- >> - Jon Gilbert >> jong@jong.org / jgilbertsjc@gmail.com >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > -- - Jon Gilbert jong@jong.org / jgilbertsjc@gmail.com