discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

is there a tutorial or document on simplifying complex union/differences?

AM
Adrian Mariano
Sat, Mar 1, 2025 5:08 AM

To be more specific, stroke creates a cylinder object for every line
segment in the input.  It then also creates a sphere object to put at every
joint.  So you'll get basically 2N objects for a path of length N.  In
contrast, path_sweep creates a single polyhedron object for one path.

On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss <
discuss@lists.openscad.org> wrote:

Yeah, stroke() will end up making roughly two nodes (I think)  per path
vertex. Use path_sweep() instead.

-Revar

On Feb 28, 2025, at 6:19 PM, John David via Discuss <
discuss@lists.openscad.org> wrote:


<face_palm> I was looking at the wrong code.  This code uses the "stroke"
module from BOSL2.  I really need to clean up this code.  Sorry for the
noise...

On Fri, Feb 28, 2025 at 9:15 PM John David ebo.2112@gmail.com wrote:

I was using the "sweep" function from the Naca_sweep.scad library.  This
is older code I was playing with along the way.  I think I should see if I
can refactor it to use BOSL2's path_sweep function.  They probably do the
same thing.  Thanks for the pointer!

On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown <
openscad@jordan.maileater.net> wrote:

On 2/28/2025 5:52 PM, John David wrote:

I'm currently getting "Normalized tree has 1936 elements!" At the
moment, there are 9 intersecting hollow pipes. 7 of these pipes are
generated from a NURBS that curve. When it generates the evaluation points
it creates a lot of them, and then I sweep along this general path.

I've never used the NURBS stuff, but it looks purely mathematical; it
doesn't look like it generates any geometry on its own.

When you say that you "sweep" along this path, exactly what do you mean?

Do you mean something like BOSL2's path_sweep(), or something else?

path_sweep() generates one node, so this is one node:

include <BOSL2/std.scad>
include <BOSL2/nurbs.scad>
$fs = 0.5;
$fa = 2;
control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]];
curve = nurbs_curve(control,2,splinesteps=16);
path_sweep(circle(2), curve);

<xB2hFqenzKHDI2iy.png>


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

To be more specific, stroke creates a cylinder object for every line segment in the input. It then also creates a sphere object to put at every joint. So you'll get basically 2N objects for a path of length N. In contrast, path_sweep creates a single polyhedron object for one path. On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss < discuss@lists.openscad.org> wrote: > Yeah, `stroke()` will end up making roughly two nodes (I think) per path > vertex. Use `path_sweep()` instead. > > -Revar > > > On Feb 28, 2025, at 6:19 PM, John David via Discuss < > discuss@lists.openscad.org> wrote: > >  > <face_palm> I was looking at the wrong code. This code uses the "stroke" > module from BOSL2. I really need to clean up this code. Sorry for the > noise... > > On Fri, Feb 28, 2025 at 9:15 PM John David <ebo.2112@gmail.com> wrote: > >> I was using the "sweep" function from the Naca_sweep.scad library. This >> is older code I was playing with along the way. I think I should see if I >> can refactor it to use BOSL2's path_sweep function. They probably do the >> same thing. Thanks for the pointer! >> >> On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown < >> openscad@jordan.maileater.net> wrote: >> >>> On 2/28/2025 5:52 PM, John David wrote: >>> >>> I'm currently getting "Normalized tree has 1936 elements!" At the >>> moment, there are 9 intersecting hollow pipes. 7 of these pipes are >>> generated from a NURBS that curve. When it generates the evaluation points >>> it creates a lot of them, and then I sweep along this general path. >>> >>> >>> I've never used the NURBS stuff, but it looks purely mathematical; it >>> doesn't look like it generates any geometry on its own. >>> >>> When you say that you "sweep" along this path, exactly what do you mean? >>> >>> Do you mean something like BOSL2's path_sweep(), or something else? >>> >>> path_sweep() generates one node, so this is one node: >>> >>> include <BOSL2/std.scad> >>> include <BOSL2/nurbs.scad> >>> $fs = 0.5; >>> $fa = 2; >>> control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]]; >>> curve = nurbs_curve(control,2,splinesteps=16); >>> path_sweep(circle(2), curve); >>> >>> <xB2hFqenzKHDI2iy.png> >>> >>> _______________________________________________ > 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 >
JD
John David
Sat, Mar 1, 2025 5:28 AM

Ah.  Yea, that is wasteful.  Thank you for the explanation.

On Sat, Mar 1, 2025 at 12:09 AM Adrian Mariano via Discuss <
discuss@lists.openscad.org> wrote:

To be more specific, stroke creates a cylinder object for every line
segment in the input.  It then also creates a sphere object to put at every
joint.  So you'll get basically 2N objects for a path of length N.  In
contrast, path_sweep creates a single polyhedron object for one path.

On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss <
discuss@lists.openscad.org> wrote:

Yeah, stroke() will end up making roughly two nodes (I think)  per path
vertex. Use path_sweep() instead.

-Revar

On Feb 28, 2025, at 6:19 PM, John David via Discuss <
discuss@lists.openscad.org> wrote:


<face_palm> I was looking at the wrong code.  This code uses the "stroke"
module from BOSL2.  I really need to clean up this code.  Sorry for the
noise...

On Fri, Feb 28, 2025 at 9:15 PM John David ebo.2112@gmail.com wrote:

I was using the "sweep" function from the Naca_sweep.scad library.  This
is older code I was playing with along the way.  I think I should see if I
can refactor it to use BOSL2's path_sweep function.  They probably do the
same thing.  Thanks for the pointer!

On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown <
openscad@jordan.maileater.net> wrote:

On 2/28/2025 5:52 PM, John David wrote:

I'm currently getting "Normalized tree has 1936 elements!" At the
moment, there are 9 intersecting hollow pipes. 7 of these pipes are
generated from a NURBS that curve. When it generates the evaluation points
it creates a lot of them, and then I sweep along this general path.

I've never used the NURBS stuff, but it looks purely mathematical; it
doesn't look like it generates any geometry on its own.

When you say that you "sweep" along this path, exactly what do you mean?

Do you mean something like BOSL2's path_sweep(), or something else?

path_sweep() generates one node, so this is one node:

include <BOSL2/std.scad>
include <BOSL2/nurbs.scad>
$fs = 0.5;
$fa = 2;
control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]];
curve = nurbs_curve(control,2,splinesteps=16);
path_sweep(circle(2), curve);

<xB2hFqenzKHDI2iy.png>


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. Yea, that is wasteful. Thank you for the explanation. On Sat, Mar 1, 2025 at 12:09 AM Adrian Mariano via Discuss < discuss@lists.openscad.org> wrote: > To be more specific, stroke creates a cylinder object for every line > segment in the input. It then also creates a sphere object to put at every > joint. So you'll get basically 2N objects for a path of length N. In > contrast, path_sweep creates a single polyhedron object for one path. > > On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss < > discuss@lists.openscad.org> wrote: > >> Yeah, `stroke()` will end up making roughly two nodes (I think) per path >> vertex. Use `path_sweep()` instead. >> >> -Revar >> >> >> On Feb 28, 2025, at 6:19 PM, John David via Discuss < >> discuss@lists.openscad.org> wrote: >> >>  >> <face_palm> I was looking at the wrong code. This code uses the "stroke" >> module from BOSL2. I really need to clean up this code. Sorry for the >> noise... >> >> On Fri, Feb 28, 2025 at 9:15 PM John David <ebo.2112@gmail.com> wrote: >> >>> I was using the "sweep" function from the Naca_sweep.scad library. This >>> is older code I was playing with along the way. I think I should see if I >>> can refactor it to use BOSL2's path_sweep function. They probably do the >>> same thing. Thanks for the pointer! >>> >>> On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown < >>> openscad@jordan.maileater.net> wrote: >>> >>>> On 2/28/2025 5:52 PM, John David wrote: >>>> >>>> I'm currently getting "Normalized tree has 1936 elements!" At the >>>> moment, there are 9 intersecting hollow pipes. 7 of these pipes are >>>> generated from a NURBS that curve. When it generates the evaluation points >>>> it creates a lot of them, and then I sweep along this general path. >>>> >>>> >>>> I've never used the NURBS stuff, but it looks purely mathematical; it >>>> doesn't look like it generates any geometry on its own. >>>> >>>> When you say that you "sweep" along this path, exactly what do you mean? >>>> >>>> Do you mean something like BOSL2's path_sweep(), or something else? >>>> >>>> path_sweep() generates one node, so this is one node: >>>> >>>> include <BOSL2/std.scad> >>>> include <BOSL2/nurbs.scad> >>>> $fs = 0.5; >>>> $fa = 2; >>>> control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]]; >>>> curve = nurbs_curve(control,2,splinesteps=16); >>>> path_sweep(circle(2), curve); >>>> >>>> <xB2hFqenzKHDI2iy.png> >>>> >>>> _______________________________________________ >> 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 >
JD
John David
Sat, Mar 1, 2025 6:35 AM

Yea, I changed things over to path_sweep() and now "Normalized tree has 244
elements" and the resultant STL is now 4m instead of 35... More cleanup to
do.

Thank you everyone.

EBo --

On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss <
discuss@lists.openscad.org> wrote:

Yeah, stroke() will end up making roughly two nodes (I think)  per path
vertex. Use path_sweep() instead.

-Revar

On Feb 28, 2025, at 6:19 PM, John David via Discuss <
discuss@lists.openscad.org> wrote:


<face_palm> I was looking at the wrong code.  This code uses the "stroke"
module from BOSL2.  I really need to clean up this code.  Sorry for the
noise...

On Fri, Feb 28, 2025 at 9:15 PM John David ebo.2112@gmail.com wrote:

I was using the "sweep" function from the Naca_sweep.scad library.  This
is older code I was playing with along the way.  I think I should see if I
can refactor it to use BOSL2's path_sweep function.  They probably do the
same thing.  Thanks for the pointer!

On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown <
openscad@jordan.maileater.net> wrote:

On 2/28/2025 5:52 PM, John David wrote:

I'm currently getting "Normalized tree has 1936 elements!" At the
moment, there are 9 intersecting hollow pipes. 7 of these pipes are
generated from a NURBS that curve. When it generates the evaluation points
it creates a lot of them, and then I sweep along this general path.

I've never used the NURBS stuff, but it looks purely mathematical; it
doesn't look like it generates any geometry on its own.

When you say that you "sweep" along this path, exactly what do you mean?

Do you mean something like BOSL2's path_sweep(), or something else?

path_sweep() generates one node, so this is one node:

include <BOSL2/std.scad>
include <BOSL2/nurbs.scad>
$fs = 0.5;
$fa = 2;
control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]];
curve = nurbs_curve(control,2,splinesteps=16);
path_sweep(circle(2), curve);

<xB2hFqenzKHDI2iy.png>


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

Yea, I changed things over to path_sweep() and now "Normalized tree has 244 elements" and the resultant STL is now 4m instead of 35... More cleanup to do. Thank you everyone. EBo -- On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss < discuss@lists.openscad.org> wrote: > Yeah, `stroke()` will end up making roughly two nodes (I think) per path > vertex. Use `path_sweep()` instead. > > -Revar > > > On Feb 28, 2025, at 6:19 PM, John David via Discuss < > discuss@lists.openscad.org> wrote: > >  > <face_palm> I was looking at the wrong code. This code uses the "stroke" > module from BOSL2. I really need to clean up this code. Sorry for the > noise... > > On Fri, Feb 28, 2025 at 9:15 PM John David <ebo.2112@gmail.com> wrote: > >> I was using the "sweep" function from the Naca_sweep.scad library. This >> is older code I was playing with along the way. I think I should see if I >> can refactor it to use BOSL2's path_sweep function. They probably do the >> same thing. Thanks for the pointer! >> >> On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown < >> openscad@jordan.maileater.net> wrote: >> >>> On 2/28/2025 5:52 PM, John David wrote: >>> >>> I'm currently getting "Normalized tree has 1936 elements!" At the >>> moment, there are 9 intersecting hollow pipes. 7 of these pipes are >>> generated from a NURBS that curve. When it generates the evaluation points >>> it creates a lot of them, and then I sweep along this general path. >>> >>> >>> I've never used the NURBS stuff, but it looks purely mathematical; it >>> doesn't look like it generates any geometry on its own. >>> >>> When you say that you "sweep" along this path, exactly what do you mean? >>> >>> Do you mean something like BOSL2's path_sweep(), or something else? >>> >>> path_sweep() generates one node, so this is one node: >>> >>> include <BOSL2/std.scad> >>> include <BOSL2/nurbs.scad> >>> $fs = 0.5; >>> $fa = 2; >>> control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]]; >>> curve = nurbs_curve(control,2,splinesteps=16); >>> path_sweep(circle(2), curve); >>> >>> <xB2hFqenzKHDI2iy.png> >>> >>> _______________________________________________ > 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 >
JD
John David
Sun, Mar 2, 2025 4:55 PM

BTW, adding path_merge_collinear to the evaluation reduced the reported
execution time by 15%, but the real winner was converting to path_sweep
(not sure how much that saved, but it was like 80 to 90% or something
insane like that).

Thank you everyone for the suggestions.

EBo --

On Sat, Mar 1, 2025 at 1:35 AM John David ebo.2112@gmail.com wrote:

Yea, I changed things over to path_sweep() and now "Normalized tree has
244 elements" and the resultant STL is now 4m instead of 35... More cleanup
to do.

Thank you everyone.

EBo --

On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss <
discuss@lists.openscad.org> wrote:

Yeah, stroke() will end up making roughly two nodes (I think)  per path
vertex. Use path_sweep() instead.

-Revar

On Feb 28, 2025, at 6:19 PM, John David via Discuss <
discuss@lists.openscad.org> wrote:


<face_palm> I was looking at the wrong code.  This code uses the "stroke"
module from BOSL2.  I really need to clean up this code.  Sorry for the
noise...

On Fri, Feb 28, 2025 at 9:15 PM John David ebo.2112@gmail.com wrote:

I was using the "sweep" function from the Naca_sweep.scad library.  This
is older code I was playing with along the way.  I think I should see if I
can refactor it to use BOSL2's path_sweep function.  They probably do the
same thing.  Thanks for the pointer!

On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown <
openscad@jordan.maileater.net> wrote:

On 2/28/2025 5:52 PM, John David wrote:

I'm currently getting "Normalized tree has 1936 elements!" At the
moment, there are 9 intersecting hollow pipes. 7 of these pipes are
generated from a NURBS that curve. When it generates the evaluation points
it creates a lot of them, and then I sweep along this general path.

I've never used the NURBS stuff, but it looks purely mathematical; it
doesn't look like it generates any geometry on its own.

When you say that you "sweep" along this path, exactly what do you mean?

Do you mean something like BOSL2's path_sweep(), or something else?

path_sweep() generates one node, so this is one node:

include <BOSL2/std.scad>
include <BOSL2/nurbs.scad>
$fs = 0.5;
$fa = 2;
control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]];
curve = nurbs_curve(control,2,splinesteps=16);
path_sweep(circle(2), curve);

<xB2hFqenzKHDI2iy.png>


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

BTW, adding path_merge_collinear to the evaluation reduced the reported execution time by 15%, but the real winner was converting to path_sweep (not sure how much that saved, but it was like 80 to 90% or something insane like that). Thank you everyone for the suggestions. EBo -- On Sat, Mar 1, 2025 at 1:35 AM John David <ebo.2112@gmail.com> wrote: > Yea, I changed things over to path_sweep() and now "Normalized tree has > 244 elements" and the resultant STL is now 4m instead of 35... More cleanup > to do. > > Thank you everyone. > > EBo -- > > > > > On Fri, Feb 28, 2025 at 9:31 PM Revar Desmera via Discuss < > discuss@lists.openscad.org> wrote: > >> Yeah, `stroke()` will end up making roughly two nodes (I think) per path >> vertex. Use `path_sweep()` instead. >> >> -Revar >> >> >> On Feb 28, 2025, at 6:19 PM, John David via Discuss < >> discuss@lists.openscad.org> wrote: >> >>  >> <face_palm> I was looking at the wrong code. This code uses the "stroke" >> module from BOSL2. I really need to clean up this code. Sorry for the >> noise... >> >> On Fri, Feb 28, 2025 at 9:15 PM John David <ebo.2112@gmail.com> wrote: >> >>> I was using the "sweep" function from the Naca_sweep.scad library. This >>> is older code I was playing with along the way. I think I should see if I >>> can refactor it to use BOSL2's path_sweep function. They probably do the >>> same thing. Thanks for the pointer! >>> >>> On Fri, Feb 28, 2025 at 9:09 PM Jordan Brown < >>> openscad@jordan.maileater.net> wrote: >>> >>>> On 2/28/2025 5:52 PM, John David wrote: >>>> >>>> I'm currently getting "Normalized tree has 1936 elements!" At the >>>> moment, there are 9 intersecting hollow pipes. 7 of these pipes are >>>> generated from a NURBS that curve. When it generates the evaluation points >>>> it creates a lot of them, and then I sweep along this general path. >>>> >>>> >>>> I've never used the NURBS stuff, but it looks purely mathematical; it >>>> doesn't look like it generates any geometry on its own. >>>> >>>> When you say that you "sweep" along this path, exactly what do you mean? >>>> >>>> Do you mean something like BOSL2's path_sweep(), or something else? >>>> >>>> path_sweep() generates one node, so this is one node: >>>> >>>> include <BOSL2/std.scad> >>>> include <BOSL2/nurbs.scad> >>>> $fs = 0.5; >>>> $fa = 2; >>>> control = [[5,0],[0,20],[33,43],[37,88],[60,62],[44,22],[77,44],[79,22],[44,3],[22,7]]; >>>> curve = nurbs_curve(control,2,splinesteps=16); >>>> path_sweep(circle(2), curve); >>>> >>>> <xB2hFqenzKHDI2iy.png> >>>> >>>> _______________________________________________ >> 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 >> >