discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

Re: Linear extrude question

JB
Jordan Brown
Sat, Jan 1, 2022 9:45 PM

On 12/30/2021 10:59 PM, Jordan Brown wrote:

The geometry always makes my head hurt, but it turns out that
linear_extrude twisting is not a good way to make screw threads.

I've continued to think about this, for my own understanding.

Consider the simple cylindrical helix (cribbed from a BOSL2 example), a
spring shape:

That's not a screw thread, but it has some similarities.

Now, can we create that using a twisted linear extrude?

Clearly not, because of the ends - it begins and ends with a horizontal
cross-section of a single point, and until the top of the cylinder every
cross-section is a different shape.

But what if we ignore the ends?  The cross-section in the middle is
constant, no?

Yes, it is:

I'm sure that shape can be derived mathematically.  I'm also sure that I
can't do it, at least not off the top of my head.

But can we then linear-extrude that with a twist to form the helix?

Sort of.

What's with that scaly surface?

Here's a close-up:

Looks like issues with exactly how linear_extrude triangulates the
surface.  I don't remember the details, but I've looked at that before. 
My dim recollection is that it's not technically wrong, but it isn't
exactly right either.

By way of comparison, here's a similar close-up of the original helix:

Net, it looks like you can sort of generate that kind of shape using
linear extrusion, but it won't be easy and the result may not be optimal.

For those who want to play on their own, here's the program that I
used.  It's adapted from Example 22 at
https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep .

include <BOSL2/std.scad>
function helix(t) = [30 * cos(3 * 360 * t),
                     30 * sin(3 * 360 * t),
                     100 * (1 - t)];
helix_steps = 100;
helix = [for (i=[0:helix_steps]) helix(i/helix_steps)];
c = translate([0,11,0],circle(10));
path_sweep(c, helix, method="natural");
//projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural");
//linear_extrude(height=100, twist=3*360) projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural");
On 12/30/2021 10:59 PM, Jordan Brown wrote: > The geometry always makes my head hurt, but it turns out that > linear_extrude twisting is not a good way to make screw threads. I've continued to think about this, for my own understanding. Consider the simple cylindrical helix (cribbed from a BOSL2 example), a spring shape: That's not a screw thread, but it has some similarities. Now, can we create that using a twisted linear extrude? Clearly not, because of the ends - it begins and ends with a horizontal cross-section of a single point, and until the top of the cylinder every cross-section is a different shape. But what if we ignore the ends?  The cross-section in the middle is constant, no? Yes, it is: I'm sure that shape can be derived mathematically.  I'm also sure that I can't do it, at least not off the top of my head. But can we then linear-extrude that with a twist to form the helix? Sort of. What's with that scaly surface? Here's a close-up: Looks like issues with exactly how linear_extrude triangulates the surface.  I don't remember the details, but I've looked at that before.  My dim recollection is that it's not technically wrong, but it isn't exactly right either. By way of comparison, here's a similar close-up of the original helix: Net, it looks like you can sort of generate that kind of shape using linear extrusion, but it won't be easy and the result may not be optimal. For those who want to play on their own, here's the program that I used.  It's adapted from Example 22 at https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep . include <BOSL2/std.scad> function helix(t) = [30 * cos(3 * 360 * t), 30 * sin(3 * 360 * t), 100 * (1 - t)]; helix_steps = 100; helix = [for (i=[0:helix_steps]) helix(i/helix_steps)]; c = translate([0,11,0],circle(10)); path_sweep(c, helix, method="natural"); //projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural"); //linear_extrude(height=100, twist=3*360) projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural");
W
Whosawhatsis
Sun, Jan 2, 2022 9:17 PM

I made a spring for a model that way once. It looked pretty good once I manually chose the right value for $fn on the linear_extrude, but I ended up rewriting it as a polyhedron for speed. The screw thread coffee that I use works similarly.
On Jan 1, 2022, 13:46 -0800, Jordan Brown openscad@jordan.maileater.net, wrote:

On 12/30/2021 10:59 PM, Jordan Brown wrote:

The geometry always makes my head hurt, but it turns out that linear_extrude twisting is not a good way to make screw threads.

I've continued to think about this, for my own understanding.

Consider the simple cylindrical helix (cribbed from a BOSL2 example), a spring shape:
<HTHXqq1vsh013qRW.png>

That's not a screw thread, but it has some similarities.

Now, can we create that using a twisted linear extrude?

Clearly not, because of the ends - it begins and ends with a horizontal cross-section of a single point, and until the top of the cylinder every cross-section is a different shape.

But what if we ignore the ends?  The cross-section in the middle is constant, no?

Yes, it is:

I'm sure that shape can be derived mathematically.  I'm also sure that I can't do it, at least not off the top of my head.

But can we then linear-extrude that with a twist to form the helix?

Sort of.

<XTwaNr4PoqcTh008.png>

What's with that scaly surface?

Here's a close-up:

Looks like issues with exactly how linear_extrude triangulates the surface.  I don't remember the details, but I've looked at that before.  My dim recollection is that it's not technically wrong, but it isn't exactly right either.

By way of comparison, here's a similar close-up of the original helix:

Net, it looks like you can sort of generate that kind of shape using linear extrusion, but it won't be easy and the result may not be optimal.

For those who want to play on their own, here's the program that I used.  It's adapted from Example 22 at https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep .

include <BOSL2/std.scad>
function helix(t) = [30 * cos(3 * 360 * t),
30 * sin(3 * 360 * t),
100 * (1 - t)];
helix_steps = 100;
helix = [for (i=[0:helix_steps]) helix(i/helix_steps)];
c = translate([0,11,0],circle(10));
path_sweep(c, helix, method="natural");
//projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural");
//linear_extrude(height=100, twist=3*360) projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural");


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

I made a spring for a model that way once. It looked pretty good once I manually chose the right value for $fn on the linear_extrude, but I ended up rewriting it as a polyhedron for speed. The screw thread coffee that I use works similarly. On Jan 1, 2022, 13:46 -0800, Jordan Brown <openscad@jordan.maileater.net>, wrote: > On 12/30/2021 10:59 PM, Jordan Brown wrote: > > The geometry always makes my head hurt, but it turns out that linear_extrude twisting is not a good way to make screw threads. > > I've continued to think about this, for my own understanding. > > Consider the simple cylindrical helix (cribbed from a BOSL2 example), a spring shape: > <HTHXqq1vsh013qRW.png> > > That's not a screw thread, but it has some similarities. > > Now, can we create that using a twisted linear extrude? > > Clearly not, because of the ends - it begins and ends with a horizontal cross-section of a single point, and until the top of the cylinder every cross-section is a different shape. > > But what if we ignore the ends?  The cross-section in the middle is constant, no? > > Yes, it is: > > > I'm sure that shape can be derived mathematically.  I'm also sure that I can't do it, at least not off the top of my head. > > But can we then linear-extrude that with a twist to form the helix? > > Sort of. > > <XTwaNr4PoqcTh008.png> > > What's with that scaly surface? > > Here's a close-up: > > > > Looks like issues with exactly how linear_extrude triangulates the surface.  I don't remember the details, but I've looked at that before.  My dim recollection is that it's not technically wrong, but it isn't exactly right either. > > By way of comparison, here's a similar close-up of the original helix: > > > Net, it looks like you can sort of generate that kind of shape using linear extrusion, but it won't be easy and the result may not be optimal. > > For those who want to play on their own, here's the program that I used.  It's adapted from Example 22 at https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep . > > > include <BOSL2/std.scad> > > function helix(t) = [30 * cos(3 * 360 * t), > > 30 * sin(3 * 360 * t), > > 100 * (1 - t)]; > > helix_steps = 100; > > helix = [for (i=[0:helix_steps]) helix(i/helix_steps)]; > > c = translate([0,11,0],circle(10)); > > path_sweep(c, helix, method="natural"); > > //projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural"); > > //linear_extrude(height=100, twist=3*360) projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural"); > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
T
tjhowse
Wed, Jan 5, 2022 5:48 AM

Here's the result. It should work pretty well.
https://www.youtube.com/watch?v=rJ4YKEeZN9o

On Mon, 3 Jan 2022 at 07:17, Whosawhatsis whosawhatsis@gmail.com wrote:

I made a spring for a model that way once. It looked pretty good once I
manually chose the right value for $fn on the linear_extrude, but I ended
up rewriting it as a polyhedron for speed. The screw thread coffee that I
use works similarly.
On Jan 1, 2022, 13:46 -0800, Jordan Brown openscad@jordan.maileater.net,
wrote:

On 12/30/2021 10:59 PM, Jordan Brown wrote:

The geometry always makes my head hurt, but it turns out that
linear_extrude twisting is not a good way to make screw threads.

I've continued to think about this, for my own understanding.

Consider the simple cylindrical helix (cribbed from a BOSL2 example), a
spring shape:
<HTHXqq1vsh013qRW.png>

That's not a screw thread, but it has some similarities.

Now, can we create that using a twisted linear extrude?

Clearly not, because of the ends - it begins and ends with a horizontal
cross-section of a single point, and until the top of the cylinder every
cross-section is a different shape.

But what if we ignore the ends?  The cross-section in the middle is
constant, no?

Yes, it is:

I'm sure that shape can be derived mathematically.  I'm also sure that I
can't do it, at least not off the top of my head.

But can we then linear-extrude that with a twist to form the helix?

Sort of.

<XTwaNr4PoqcTh008.png>

What's with that scaly surface?

Here's a close-up:

Looks like issues with exactly how linear_extrude triangulates the
surface.  I don't remember the details, but I've looked at that before.  My
dim recollection is that it's not technically wrong, but it isn't exactly
right either.

By way of comparison, here's a similar close-up of the original helix:

Net, it looks like you can sort of generate that kind of shape using
linear extrusion, but it won't be easy and the result may not be optimal.

For those who want to play on their own, here's the program that I used.
It's adapted from Example 22 at
https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep
.

include <BOSL2/std.scad>
function helix(t) = [30 * cos(3 * 360 * t),
30 * sin(3 * 360 * t),
100 * (1 - t)];
helix_steps = 100;
helix = [for (i=[0:helix_steps]) helix(i/helix_steps)];
c = translate([0,11,0],circle(10));
path_sweep(c, helix, method="natural");
//projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural");
//linear_extrude(height=100, twist=3*360) projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural");


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's the result. It should work pretty well. https://www.youtube.com/watch?v=rJ4YKEeZN9o On Mon, 3 Jan 2022 at 07:17, Whosawhatsis <whosawhatsis@gmail.com> wrote: > I made a spring for a model that way once. It looked pretty good once I > manually chose the right value for $fn on the linear_extrude, but I ended > up rewriting it as a polyhedron for speed. The screw thread coffee that I > use works similarly. > On Jan 1, 2022, 13:46 -0800, Jordan Brown <openscad@jordan.maileater.net>, > wrote: > > On 12/30/2021 10:59 PM, Jordan Brown wrote: > > The geometry always makes my head hurt, but it turns out that > linear_extrude twisting is not a good way to make screw threads. > > > I've continued to think about this, for my own understanding. > > Consider the simple cylindrical helix (cribbed from a BOSL2 example), a > spring shape: > <HTHXqq1vsh013qRW.png> > > That's not a screw thread, but it has some similarities. > > Now, can we create that using a twisted linear extrude? > > Clearly not, because of the ends - it begins and ends with a horizontal > cross-section of a single point, and until the top of the cylinder every > cross-section is a different shape. > > But what if we ignore the ends? The cross-section in the middle is > constant, no? > > Yes, it is: > > > I'm sure that shape can be derived mathematically. I'm also sure that I > can't do it, at least not off the top of my head. > > But can we then linear-extrude that with a twist to form the helix? > > Sort of. > > <XTwaNr4PoqcTh008.png> > > What's with that scaly surface? > > Here's a close-up: > > > > Looks like issues with exactly how linear_extrude triangulates the > surface. I don't remember the details, but I've looked at that before. My > dim recollection is that it's not technically wrong, but it isn't exactly > right either. > > By way of comparison, here's a similar close-up of the original helix: > > > Net, it looks like you can sort of generate that kind of shape using > linear extrusion, but it won't be easy and the result may not be optimal. > > For those who want to play on their own, here's the program that I used. > It's adapted from Example 22 at > https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-path_sweep > . > > include <BOSL2/std.scad> > function helix(t) = [30 * cos(3 * 360 * t), > 30 * sin(3 * 360 * t), > 100 * (1 - t)]; > helix_steps = 100; > helix = [for (i=[0:helix_steps]) helix(i/helix_steps)]; > c = translate([0,11,0],circle(10)); > path_sweep(c, helix, method="natural"); > //projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural"); > //linear_extrude(height=100, twist=3*360) projection(cut=true) translate([0,0,-40]) path_sweep(c, helix, method="natural"); > > > _______________________________________________ > 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 >