Tapered Extrusions

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Tapered Extrusions

buzz
Hi All,

I've been searching/googleing , and I'm unable to figure out how to do a 'tapered extrusion' in openscad.   I assume there's got to be a way, but it escapes me.

by 'tapered extrusion' I mean something akin to linear_extrusion(), but in which the 2D profile gradually gets smaller as it extrudes further. 

The simplest form of this would be a cone, which is a 2D circle extruded vertically ( for a distance that is the height of the cone), and is extruded down to a 'point' that is 0% of the dimensions of the original circle.  

I know the openscad 'cylinder' object can make cones ( and truncated conical shapes ) .... however, I'm looking for a way to extrude arbitrary 2D shapes in a similar manner, and I can't figure it out.


Anyway, I guess I'm either after someone telling me how to do this in openscad, or if it's not possible, then this is a feature request... :-)  Before you ignore this as a "feature request without patch", please consider at least pointing me in the right directio. :-)


I see this generic method would be useful for ( here's a few examples):

* wood-screws, and other  tapered+threaded devices

* airfoils, wings, propellors, where the basic 2D shape is a 2D airfoil, but the extruded length can taper and/or twist.

* non-circular ducting or piping that needs to keep its profile, but shrink/grow in size ( eg square overhead airconditioning ducting )

* potplant bases  (not the round ones, the square or rectangular based ones, with tapered walls )

* heels for high-heeled shoes ( typically a funny 'D' shape, and taper down to the ground )

* wedges  ( yes, I know, those can normal be made by subtraction, as they are just intersecting rectangles, but what if the wedge was a unique 2D profiled polygon?  )

Thanks,
Buzz

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

William Adams
That's an interesting suggestion.

I'm not quite sure how you would guide the taper for an arbitrary 2D shape.  Would all vertices gravitate towards/away from the centroid?

I think what you really want is to have two profile curves, and interpolate between the two as you go from one to the other.

That would be pretty easy if each curve were defined parametrically.  that is, you can specify a 'u' value and get a point around the curve.  Then you just line up the 'u' values and do a lerp between the two profiles.

You're pretty much on your own as far as OpenScad helping you do this in such a free form though.  I have done quite a bit of 'free form' surface/curve/shape making in OpenScad.  I did this for various revoloids, bezier surfaces, and the like.  You can take a look at the technique here:

That last one in particular does a sweep of one curve, along another.

Once you comprehend the 'stitch polyhedra pieces together' technique, you can pretty much build anything you want.

-- William

===============================
- Shaping clay is easier than digging it out of the ground.

http://blog.nanotechstyles.com
http://www.thingiverse.com/WilliamAAdams
https://github.com/Wiladams
 



From: [hidden email]
Date: Tue, 6 Dec 2011 12:25:36 +1000
To: [hidden email]
Subject: [OpenSCAD] Tapered Extrusions

Hi All,

I've been searching/googleing , and I'm unable to figure out how to do a 'tapered extrusion' in openscad.   I assume there's got to be a way, but it escapes me.

by 'tapered extrusion' I mean something akin to linear_extrusion(), but in which the 2D profile gradually gets smaller as it extrudes further. 

The simplest form of this would be a cone, which is a 2D circle extruded vertically ( for a distance that is the height of the cone), and is extruded down to a 'point' that is 0% of the dimensions of the original circle.  

I know the openscad 'cylinder' object can make cones ( and truncated conical shapes ) .... however, I'm looking for a way to extrude arbitrary 2D shapes in a similar manner, and I can't figure it out.


Anyway, I guess I'm either after someone telling me how to do this in openscad, or if it's not possible, then this is a feature request... :-)  Before you ignore this as a "feature request without patch", please consider at least pointing me in the right directio. :-)


I see this generic method would be useful for ( here's a few examples):

* wood-screws, and other  tapered+threaded devices

* airfoils, wings, propellors, where the basic 2D shape is a 2D airfoil, but the extruded length can taper and/or twist.

* non-circular ducting or piping that needs to keep its profile, but shrink/grow in size ( eg square overhead airconditioning ducting )

* potplant bases  (not the round ones, the square or rectangular based ones, with tapered walls )

* heels for high-heeled shoes ( typically a funny 'D' shape, and taper down to the ground )

* wedges  ( yes, I know, those can normal be made by subtraction, as they are just intersecting rectangles, but what if the wedge was a unique 2D profiled polygon?  )

Thanks,
Buzz


_______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad
Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

buzz

On Tue, Dec 6, 2011 at 5:03 PM, William Adams <[hidden email]> wrote:
That's an interesting suggestion.

I'm not quite sure how you would guide the taper for an arbitrary 2D shape.  Would all vertices gravitate towards/away from the centroid?

Yes.      Assuming a horizontal 2D profile/surface to start with, any horizontal slice of the resulting object would just be a scaled-down ( and possibly rotated, if that was optionally added) version of the original.   Seemed simple to me, and I'm really surprised that it doesn't already exist.     


I think what you really want is to have two profile curves, and interpolate between the two as you go from one to the other.

Are you suggesting that a more general version of the solution would be to not limit the solution to having a "fixed taper"  , but might instead use a (optionally) curved line to define the profile of the created object in the new 3rd dimension?      This would work for me, since my definition above is simply using a straight line instead of a curved one.      I was limiting myself to straight tapers, as I assumed (1) it's all I need (2) it would be easier (3) it may already exist in a form I haven't seen yet.


That would be pretty easy if each curve were defined parametrically.  that is, you can specify a 'u' value and get a point around the curve.  Then you just line up the 'u' values and do a lerp between the two profiles.

I have no idea what a 'lerp' is ( nor a 'hermite')   I'm a programmer, not a mathematician, so I'm coming from a different background that you, obviously.  <googles> Oh, Linear Interpolation, right.
 

You're pretty much on your own as far as OpenScad helping you do this in such a free form though.  

I was kinda hoping someone had developed or coded a file called (hypothetically) extrusions.scad, and mathematically created some additions like maybe a tapered_extrusion() or profiled_extrusion()  or whatever that I might just be able to take advantage of.  oh well.
 
I have done quite a bit of 'free form' surface/curve/shape making in OpenScad.  I did this for various revoloids, bezier surfaces, and the like.  You can take a look at the technique here:

 

Those hurt my head with their complexity, and are completely beyond me at this point, although I'll study them some more at some point, I'm sure.  :-)
 

That last one in particular does a sweep of one curve, along another.

I'm not sure that's quite what I'm after.... is it?   
 

Once you comprehend the 'stitch polyhedra pieces together' technique, you can pretty much build anything you want.

Yes, I can see that, but it's the sort of thing I think we shouldn't all have to be repeating/re-doing from such a low level, as it belongs in either the openscad implementation, or a library, like MCAD ( https://github.com/elmom/MCAD )

Thanks,
( more help invited! )
Buzz.
 

-- William

===============================
- Shaping clay is easier than digging it out of the ground.

http://blog.nanotechstyles.com
http://www.thingiverse.com/WilliamAAdams
https://github.com/Wiladams
 



From: [hidden email]
Date: Tue, 6 Dec 2011 12:25:36 +1000
To: [hidden email]
Subject: [OpenSCAD] Tapered Extrusions


Hi All,

I've been searching/googleing , and I'm unable to figure out how to do a 'tapered extrusion' in openscad.   I assume there's got to be a way, but it escapes me.

by 'tapered extrusion' I mean something akin to linear_extrusion(), but in which the 2D profile gradually gets smaller as it extrudes further. 

The simplest form of this would be a cone, which is a 2D circle extruded vertically ( for a distance that is the height of the cone), and is extruded down to a 'point' that is 0% of the dimensions of the original circle.  

I know the openscad 'cylinder' object can make cones ( and truncated conical shapes ) .... however, I'm looking for a way to extrude arbitrary 2D shapes in a similar manner, and I can't figure it out.


Anyway, I guess I'm either after someone telling me how to do this in openscad, or if it's not possible, then this is a feature request... :-)  Before you ignore this as a "feature request without patch", please consider at least pointing me in the right directio. :-)


I see this generic method would be useful for ( here's a few examples):

* wood-screws, and other  tapered+threaded devices

* airfoils, wings, propellors, where the basic 2D shape is a 2D airfoil, but the extruded length can taper and/or twist.

* non-circular ducting or piping that needs to keep its profile, but shrink/grow in size ( eg square overhead airconditioning ducting )

* potplant bases  (not the round ones, the square or rectangular based ones, with tapered walls )

* heels for high-heeled shoes ( typically a funny 'D' shape, and taper down to the ground )

* wedges  ( yes, I know, those can normal be made by subtraction, as they are just intersecting rectangles, but what if the wedge was a unique 2D profiled polygon?  )

Thanks,
Buzz


_______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

Len Trigg
In reply to this post by buzz
On Tue, Dec 6, 2011 at 3:25 PM, buzz <[hidden email]> wrote:
> I've been searching/googleing , and I'm unable to figure out how to do a
> 'tapered extrusion' in openscad.   I assume there's got to be a way, but it
> escapes me.
>
> by 'tapered extrusion' I mean something akin to linear_extrusion(), but in
> which the 2D profile gradually gets smaller as it extrudes further.

Can you use the 3d hull to do what you want? e.g.:
hull() {
  translate([0,0,10]) cube([20,20,1]);
  translate([5,5]) cylinder(r=5,h=1);
}

Cheers,
Len.

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

William Adams
In reply to this post by buzz
what would be the ideal form of expressing this?
 
taper_extrude(basepts, height, percent_shrink, twist_degrees)
 
basepts - The polygon defining the base
height - how tall the thing is
percent_shrink - How much to shrink the thing as you go up
twist_degrees - how much to twist as you go up
 
Or some other form?
 
I think a parametric representation would be easiest
 
extrude(startprofile, endprofile, height)
 
startprofile - a function defining what the base looks like
endprofile - a function defining what the end looks like
height - how high to make it
 
This would require functions be passed as parameters.  There are ways of getting around this in fairly limited cases.  For example, you could specify a limited set of functions, and internally extrude() could map.  So, in the case of using a superellipse, for example, as the driving profile, you could do something like:
 
starting = [func=superellipse, [xradius=5, yradius = 5, N=4]]    // A square with rounded corners
ending = [func=superellipse, [xradius=5, yradius =5, N=1]]      // A circle
 
Note: not exact syntax, but you should get the general idea.
 
extrude(starting, endging, 12)
 
That would give you an extrusion with a base in the shape of a square, and a top in the shape of a circle.  That could be a pretty straight forward way to do things.
 
This could be added fairly easily as a library, or as an inbuilt function.
 
Similarly, you could do someting like:
 
starting = [func=polyloop, [[pt1], [pt2], [pt3], [pt4]]
ending = [func=polyloop, [[pt1], [pt2], [pt3], [pt4]]
 
extrude(starting, ending, 12)
 
In this case, the function would be 'polyloop'.  You would have to specify the same number of points for each curve, or use the smallest number of points, but it could be done.  Just match the points up.
 
And lastly;
 
starting = [func=polyloop, [[pt1], [pt2], [pt3], [pt4]]
 
extrude(starting, height=12, shrink=100, twist=30)
 
A single set of points, using the polyloop function.  Extrude by 12, twist 30 degrees along the way, and shrink down to a point.
 
this could all be implemented given today's OpenScad, as a module, or become an inbuilt fairly easily.  but, it's not there as of today, as far as I know.
 
By the way, I'm not a math background guy.  I'm just a programmer like you.
 
If you're interested in the technique of encoding 'functions' as arrays, you might take a look at this study:
 
http://www.thingiverse.com/thing:10137
 
but yah, wouldn't it be nice if this were just a simple library that someone had already coded up?
 
 
-- William


===============================
- Shaping clay is easier than digging it out of the ground.

http://blog.nanotechstyles.com
http://www.thingiverse.com/WilliamAAdams
https://github.com/Wiladams
 

 

From: [hidden email]
Date: Tue, 6 Dec 2011 17:56:22 +1000
Subject: Re: [OpenSCAD] Tapered Extrusions
To: [hidden email]; [hidden email]


On Tue, Dec 6, 2011 at 5:03 PM, William Adams <[hidden email]> wrote:
That's an interesting suggestion.

I'm not quite sure how you would guide the taper for an arbitrary 2D shape.  Would all vertices gravitate towards/away from the centroid?

Yes.      Assuming a horizontal 2D profile/surface to start with, any horizontal slice of the resulting object would just be a scaled-down ( and possibly rotated, if that was optionally added) version of the original.   Seemed simple to me, and I'm really surprised that it doesn't already exist.     


I think what you really want is to have two profile curves, and interpolate between the two as you go from one to the other.

Are you suggesting that a more general version of the solution would be to not limit the solution to having a "fixed taper"  , but might instead use a (optionally) curved line to define the profile of the created object in the new 3rd dimension?      This would work for me, since my definition above is simply using a straight line instead of a curved one.      I was limiting myself to straight tapers, as I assumed (1) it's all I need (2) it would be easier (3) it may already exist in a form I haven't seen yet.


That would be pretty easy if each curve were defined parametrically.  that is, you can specify a 'u' value and get a point around the curve.  Then you just line up the 'u' values and do a lerp between the two profiles.

I have no idea what a 'lerp' is ( nor a 'hermite')   I'm a programmer, not a mathematician, so I'm coming from a different background that you, obviously.  <googles> Oh, Linear Interpolation, right.
 

You're pretty much on your own as far as OpenScad helping you do this in such a free form though.  

I was kinda hoping someone had developed or coded a file called (hypothetically) extrusions.scad, and mathematically created some additions like maybe a tapered_extrusion() or profiled_extrusion()  or whatever that I might just be able to take advantage of.  oh well.
 
I have done quite a bit of 'free form' surface/curve/shape making in OpenScad.  I did this for various revoloids, bezier surfaces, and the like.  You can take a look at the technique here:

 

Those hurt my head with their complexity, and are completely beyond me at this point, although I'll study them some more at some point, I'm sure.  :-)
 

That last one in particular does a sweep of one curve, along another.

I'm not sure that's quite what I'm after.... is it?   
 

Once you comprehend the 'stitch polyhedra pieces together' technique, you can pretty much build anything you want.

Yes, I can see that, but it's the sort of thing I think we shouldn't all have to be repeating/re-doing from such a low level, as it belongs in either the openscad implementation, or a library, like MCAD ( https://github.com/elmom/MCAD )

Thanks,
( more help invited! )
Buzz.
 

-- William

===============================
- Shaping clay is easier than digging it out of the ground.

http://blog.nanotechstyles.com
http://www.thingiverse.com/WilliamAAdams
https://github.com/Wiladams
 



From: [hidden email]
Date: Tue, 6 Dec 2011 12:25:36 +1000
To: [hidden email]
Subject: [OpenSCAD] Tapered Extrusions


Hi All,

I've been searching/googleing , and I'm unable to figure out how to do a 'tapered extrusion' in openscad.   I assume there's got to be a way, but it escapes me.

by 'tapered extrusion' I mean something akin to linear_extrusion(), but in which the 2D profile gradually gets smaller as it extrudes further. 

The simplest form of this would be a cone, which is a 2D circle extruded vertically ( for a distance that is the height of the cone), and is extruded down to a 'point' that is 0% of the dimensions of the original circle.  

I know the openscad 'cylinder' object can make cones ( and truncated conical shapes ) .... however, I'm looking for a way to extrude arbitrary 2D shapes in a similar manner, and I can't figure it out.


Anyway, I guess I'm either after someone telling me how to do this in openscad, or if it's not possible, then this is a feature request... :-)  Before you ignore this as a "feature request without patch", please consider at least pointing me in the right directio. :-)


I see this generic method would be useful for ( here's a few examples):

* wood-screws, and other  tapered+threaded devices

* airfoils, wings, propellors, where the basic 2D shape is a 2D airfoil, but the extruded length can taper and/or twist.

* non-circular ducting or piping that needs to keep its profile, but shrink/grow in size ( eg square overhead airconditioning ducting )

* potplant bases  (not the round ones, the square or rectangular based ones, with tapered walls )

* heels for high-heeled shoes ( typically a funny 'D' shape, and taper down to the ground )

* wedges  ( yes, I know, those can normal be made by subtraction, as they are just intersecting rectangles, but what if the wedge was a unique 2D profiled polygon?  )

Thanks,
Buzz


_______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

clothbot
In reply to this post by buzz
How about adding "scale1" and "scale2" parameters to the existing linear_extrude function?

Then it could behave similar to the cylinder(r1,r2) variant for cones:

  linear_extrude(scale1=1.0,scale2=0.0,height=2) circle(r=1.0);

…would be equivalent to...

  cylinder(r1=1.0,r2=0.0,h=2);

Andrew.

On 2011-12-05, at 9:25 PM, buzz wrote:

> Hi All,
>
> I've been searching/googleing , and I'm unable to figure out how to do a 'tapered extrusion' in openscad.   I assume there's got to be a way, but it escapes me.
>
> by 'tapered extrusion' I mean something akin to linear_extrusion(), but in which the 2D profile gradually gets smaller as it extrudes further.  
>
> The simplest form of this would be a cone, which is a 2D circle extruded vertically ( for a distance that is the height of the cone), and is extruded down to a 'point' that is 0% of the dimensions of the original circle.  
>
> I know the openscad 'cylinder' object can make cones ( and truncated conical shapes ) .... however, I'm looking for a way to extrude arbitrary 2D shapes in a similar manner, and I can't figure it out.
>
>
> Anyway, I guess I'm either after someone telling me how to do this in openscad, or if it's not possible, then this is a feature request... :-)  Before you ignore this as a "feature request without patch", please consider at least pointing me in the right directio. :-)
>
>
> I see this generic method would be useful for ( here's a few examples):
>
> * wood-screws, and other  tapered+threaded devices
>
> * airfoils, wings, propellors, where the basic 2D shape is a 2D airfoil, but the extruded length can taper and/or twist.
>
> * non-circular ducting or piping that needs to keep its profile, but shrink/grow in size ( eg square overhead airconditioning ducting )
>
> * potplant bases  (not the round ones, the square or rectangular based ones, with tapered walls )
>
> * heels for high-heeled shoes ( typically a funny 'D' shape, and taper down to the ground )
>
> * wedges  ( yes, I know, those can normal be made by subtraction, as they are just intersecting rectangles, but what if the wedge was a unique 2D profiled polygon?  )
>
> Thanks,
> Buzz
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/



Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

Len Trigg
On Wed, Dec 7, 2011 at 3:47 AM, Andrew Plumb <[hidden email]> wrote:
> How about adding "scale1" and "scale2" parameters to the existing linear_extrude function?

Where would you choose as the origin of scaling?

The 3d hull approach works and also lets you do things like have the
two ends offset.

Cheers,
Len.

3dhull.png (25K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

Len Trigg
On Wed, Dec 7, 2011 at 8:04 AM, Len Trigg <[hidden email]> wrote:
> On Wed, Dec 7, 2011 at 3:47 AM, Andrew Plumb <[hidden email]> wrote:
>> How about adding "scale1" and "scale2" parameters to the existing linear_extrude function?
>
> Where would you choose as the origin of scaling?
>
> The 3d hull approach works and also lets you do things like have the
> two ends offset.

Note that it requires your two ends to be convex - any concavity in
your end shapes will get lost.

Cheers,
Len.

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

clothbot
In reply to this post by Len Trigg
Cool!  Didn't know about 3D hull.  That definitely opens up some options.

Re. the origin of scaling, it's always [0,0].  Just add a translate([x,y]) to position it elsewhere.

Here's roughly how I would expect a "tapered_extrude" to look:

--snip--

 module tapered_extrude_children(scale1=10.0,scale2=1.0,height=10,twist=45,fn=32) {
  for(kid=[0:$children-1]) {
    for(i=[0:fn-1]) translate([0,0,height*i/fn]) rotate([0,0,twist*i/fn]) {
      hull() {
        linear_extrude(height=height/fn/10) scale(scale1*(fn-i)/fn+scale2*i/fn) child(kid);
        translate([0,0,height/fn-height/fn/10])
          linear_extrude(height=height/fn/10) scale(scale1*(fn-i-1)/fn+scale2*(i+1)/fn) child(kid);
      } // hull
    } // for each slice
  } // for each child
} // module

tapered_extrude_children(scale1=5.0,scale2=2.0,height=5,twist=30,fn=32) {
  translate([-0.25,-0.25]) square(size=[1.0,1.0],center=false);
  translate([-0.5,-0.5]) circle($fn=32,r=0.5);
}

--end-snip--

…but instead of discrete slices it would join up the 2D vertices as they twist and translate up the z-axis to form a nice polyhedral mesh.

Andrew.


On 2011-12-06, at 2:04 PM, Len Trigg wrote:

> On Wed, Dec 7, 2011 at 3:47 AM, Andrew Plumb <[hidden email]> wrote:
>> How about adding "scale1" and "scale2" parameters to the existing linear_extrude function?
>
> Where would you choose as the origin of scaling?
>
> The 3d hull approach works and also lets you do things like have the
> two ends offset.
>
> Cheers,
> Len.
> <3dhull.png>_______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/



Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

nophead


On 6 December 2011 20:14, Andrew Plumb <[hidden email]> wrote:
Cool!  Didn't know about 3D hull.  That definitely opens up some options.

Re. the origin of scaling, it's always [0,0].  Just add a translate([x,y]) to position it elsewhere.

Here's roughly how I would expect a "tapered_extrude" to look:

--snip--

 module tapered_extrude_children(scale1=10.0,scale2=1.0,height=10,twist=45,fn=32) {
 for(kid=[0:$children-1]) {
   for(i=[0:fn-1]) translate([0,0,height*i/fn]) rotate([0,0,twist*i/fn]) {
     hull() {
       linear_extrude(height=height/fn/10) scale(scale1*(fn-i)/fn+scale2*i/fn) child(kid);
       translate([0,0,height/fn-height/fn/10])
         linear_extrude(height=height/fn/10) scale(scale1*(fn-i-1)/fn+scale2*(i+1)/fn) child(kid);
     } // hull
   } // for each slice
 } // for each child
} // module

tapered_extrude_children(scale1=5.0,scale2=2.0,height=5,twist=30,fn=32) {
 translate([-0.25,-0.25]) square(size=[1.0,1.0],center=false);
 translate([-0.5,-0.5]) circle($fn=32,r=0.5);
}

--end-snip--

…but instead of discrete slices it would join up the 2D vertices as they twist and translate up the z-axis to form a nice polyhedral mesh.

Andrew.

 
Does hull() work with for loops yet? The 2D hull() in the June release does not work in a for loop.
 

On 2011-12-06, at 2:04 PM, Len Trigg wrote:

> On Wed, Dec 7, 2011 at 3:47 AM, Andrew Plumb <[hidden email]> wrote:
>> How about adding "scale1" and "scale2" parameters to the existing linear_extrude function?
>
> Where would you choose as the origin of scaling?
>
> The 3d hull approach works and also lets you do things like have the
> two ends offset.
>
> Cheers,
> Len.
> <3dhull.png>_______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

clothbot
On 2011-12-06, at 3:34 PM, nop head wrote:
> Does hull() work with for loops yet? The 2D hull() in the June release does not work in a for loop.

My example works with the 2011.12.06 Mac image I just downloaded.

The following 3D hull appears to work:

hull() for(i=[0:5]) rotate([0,0,360*i/6]) translate([10,0,0]) cylinder($fn=16,r=2.5,h=1.0);

The 2D hull equivalent does not work, but you can turn that 3D example into a 2D output with a projection:

 projection() hull() for(i=[0:5]) rotate([0,0,360*i/6]) translate([10,0,0]) cylinder($fn=16,r=2.5,h=1.0);

Andrew.


--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/



Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

kintel
Administrator
In reply to this post by nophead
On Dec 6, 2011, at 21:34 PM, nop head wrote:

> Does hull() work with for loops yet? The 2D hull() in the June release does not work in a for loop.

I just fixed this. Thanks for reminding me about this one.

The hull() module generally needs testing, so don't hesitate to send me anything which looks broken.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

buzz
In reply to this post by clothbot


On Wed, Dec 7, 2011 at 12:47 AM, Andrew Plumb <[hidden email]> wrote:
How about adding "scale1" and "scale2" parameters to the existing linear_extrude function?

Then it could behave similar to the cylinder(r1,r2) variant for cones:

 linear_extrude(scale1=1.0,scale2=0.0,height=2) circle(r=1.0);


I like this idea, for its simplicity, but I don't know where I'd have to go to make this change.  :-(
 

…would be equivalent to...

 cylinder(r1=1.0,r2=0.0,h=2);

Andrew.

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

buzz
In reply to this post by clothbot
I've just been ferreting around in openscad/src/linearextrude*  and I see that there is already some intent to create a 'scale' parameter for linear_extrude().     However,  I also grepped through tests/regression and found  the only time I can see that  it's ever used is when extruding DXF file/s, not arbitrary 2D polygons.      Finally, I found in ( http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/DXF_Extrusion ) that the 'scale' attribute is labeled as 'scale FIXME' , which I presume means the intent is there for it to work, but it's busted?

I guess someone ( Marius? )  has already been thinking along these lines, but never quite implemented it fully yet?   ... or am I mistaken?

Buzz.

On Wed, Dec 7, 2011 at 12:47 AM, Andrew Plumb <[hidden email]> wrote:
How about adding "scale1" and "scale2" parameters to the existing linear_extrude function?

Then it could behave similar to the cylinder(r1,r2) variant for cones:

 linear_extrude(scale1=1.0,scale2=0.0,height=2) circle(r=1.0);

…would be equivalent to...

 cylinder(r1=1.0,r2=0.0,h=2);

Andrew.

On 2011-12-05, at 9:25 PM, buzz wrote:

> Hi All,
>
> I've been searching/googleing , and I'm unable to figure out how to do a 'tapered extrusion' in openscad.   I assume there's got to be a way, but it escapes me.
>
> by 'tapered extrusion' I mean something akin to linear_extrusion(), but in which the 2D profile gradually gets smaller as it extrudes further.
>
> The simplest form of this would be a cone, which is a 2D circle extruded vertically ( for a distance that is the height of the cone), and is extruded down to a 'point' that is 0% of the dimensions of the original circle.
>
> I know the openscad 'cylinder' object can make cones ( and truncated conical shapes ) .... however, I'm looking for a way to extrude arbitrary 2D shapes in a similar manner, and I can't figure it out.
>
>
> Anyway, I guess I'm either after someone telling me how to do this in openscad, or if it's not possible, then this is a feature request... :-)  Before you ignore this as a "feature request without patch", please consider at least pointing me in the right directio. :-)
>
>
> I see this generic method would be useful for ( here's a few examples):
>
> * wood-screws, and other  tapered+threaded devices
>
> * airfoils, wings, propellors, where the basic 2D shape is a 2D airfoil, but the extruded length can taper and/or twist.
>
> * non-circular ducting or piping that needs to keep its profile, but shrink/grow in size ( eg square overhead airconditioning ducting )
>
> * potplant bases  (not the round ones, the square or rectangular based ones, with tapered walls )
>
> * heels for high-heeled shoes ( typically a funny 'D' shape, and taper down to the ground )
>
> * wedges  ( yes, I know, those can normal be made by subtraction, as they are just intersecting rectangles, but what if the wedge was a unique 2D profiled polygon?  )
>
> Thanks,
> Buzz
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

kintel
Administrator
In reply to this post by buzz
Hi,

Just FYI:
I've seen attempts to do smth. similar to tapered extrusions by trying to use non-affine transforms. See the thread "Bug with gcal multmatrix" started by Len Trigg May this year.
We're still limited by CGAL not supporting non-affine transforms, and I'm not sure how we could fix that.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

kintel
Administrator
In reply to this post by buzz
On Dec 7, 2011, at 06:42 AM, buzz wrote:

> I guess someone ( Marius? )  has already been thinking along these lines, but never quite implemented it fully yet?   ... or am I mistaken?
>
The scale parameter only worked for the (now deprecated) variant of linear_extrude() which read from a dxf file. It scales the contents of the dxf file. This is now done in import().

The thoughts I've had regarding this are something like this:
o Supply a number of 3D transforms to linear_extrude, interpolate over the transformed shapes. This requires rethinking linear_extrude a bit.
o Alternatively, generalize this a bit more, and extrude along a path instead of just linear. I believe Giles has been playing with this in RapCad but I haven't looked into it yet.

In any case, I don't think rushing to add a scale parameter is the solution, but it might prove to gain better understanding of what we actually want.

Anyway, if you want to play, here is where to look:
o The scale parameter can be reused
o The extrusion itself is done in PolySetCGALEvaluator::extrudeDxfData(LinearExtrudeNode &, DxfData &)

Don't let dxfdata confuse you - it has historic reasons and should be refactored, but I'm putting it off until after the upcoming release.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Tapered Extrusions

William Adams
I think the path approach would be great.
 
If you have a general parameterized path mechanism, whether it be bezier, b-spline, nurbs, or whatever, then it can be used in many different places.  You could use it for translation offsets, radii, rotations, whatever.
 
I can imagine creating an undulating tube, where the radius of the circle is governed by one curve, and the displacement is governed by another.  I believe this can be implemented even in the current OpenScad, although if it were baked in, it would be very fast I'm sure.
 
I created a version of a 'tapered' object, using the technique I outlined earlier.  That is, given a couple of profiles for the ends, do a sweep to create the object.
 
http://www.thingiverse.com/thing:14388
 
Although I did this in Banate CAD, I'm sure it can be done in OpenScad as well.  It's just the polyhedra stitching is the only real challenging part.
 
If something like that were baked in, i'm sure it would be useful.  As Banate CAD code looks pretty much like 'C', it could be considered as an example implementation.
 
-- William

===============================
- Shaping clay is easier than digging it out of the ground.

http://blog.nanotechstyles.com
http://www.thingiverse.com/WilliamAAdams
https://github.com/Wiladams
 

 
> From: [hidden email]

> Date: Wed, 7 Dec 2011 14:04:11 +0100
> To: [hidden email]; [hidden email]
> Subject: Re: [OpenSCAD] Tapered Extrusions
>
> On Dec 7, 2011, at 06:42 AM, buzz wrote:
>
> > I guess someone ( Marius? ) has already been thinking along these lines, but never quite implemented it fully yet? ... or am I mistaken?
> >
> The scale parameter only worked for the (now deprecated) variant of linear_extrude() which read from a dxf file. It scales the contents of the dxf file. This is now done in import().
>
> The thoughts I've had regarding this are something like this:
> o Supply a number of 3D transforms to linear_extrude, interpolate over the transformed shapes. This requires rethinking linear_extrude a bit.
> o Alternatively, generalize this a bit more, and extrude along a path instead of just linear. I believe Giles has been playing with this in RapCad but I haven't looked into it yet.
>
> In any case, I don't think rushing to add a scale parameter is the solution, but it might prove to gain better understanding of what we actually want.
>
> Anyway, if you want to play, here is where to look:
> o The scale parameter can be reused
> o The extrusion itself is done in PolySetCGALEvaluator::extrudeDxfData(LinearExtrudeNode &, DxfData &)
>
> Don't let dxfdata confuse you - it has historic reasons and should be refactored, but I'm putting it off until after the upcoming release.
>
> -Marius
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad