Hi all, I am modelling a top hat, and would be grateful for suggestions as to the most efficient way to extrude the basic oval shape of the hat over an arc. I am most of the way there with the basic shape with this: linear_extrude(height = 153, center = true, convexity = 10, scale=1.19875) scale([1,1.19255]) circle(161/2); The change I need to make is that the scale factor of the linear_extrude needs to increase from bottom to top, so it widens out over a curve – and the top of the hat flares out a little. I’ve done a lot of modelling in OpenSCAD but not played much with mathematical functions, so any pointers would be appreciated. I’d like to take this further, to also twisting the top of the hat, based on what I learn from this. Many thanks, Alex _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Have a look at this code. It uses an exponential funktion.
in a more general formulation you would write your own function f to describe the trajectory. E.g.

In reply to this post by alexgibson
Also consider approach where you draw the profile and build a volume of revolution
Check this code for example to make handles:  http://www.thingiverse.com/thing:923244 (tricky to ensure they meet perfectly in the mifddle) Use inkscape to draw the profile:  http://www.thingiverse.com/thing:1065500 
In reply to this post by alexgibson
I would use another approach. For curved surfaces I generally prefer to build the form from meshes of calculated points and compose everything with polyhedron. Here is a possible code:
The form is based on an elliptic oval and a scale profile. A mesh is built from them. The show_closed_mesh module is a very simple version of a more general version I coded. It takes only one envelope in the form of a (closed) mesh and closes it with two planar faces. If needed this two faces may be triangulated. 
In reply to this post by Parkinbot
Yes  this is exactly it, thanks very much. I will play about with it until
I can properly use all aspects. Many thanks! Original Message From: Discuss [mailto:[hidden email]] On Behalf Of Parkinbot Sent: 24 May 2016 00:04 To: [hidden email] Subject: Re: [OpenSCAD] Curved linear extrude Have a look at this code. It uses an exponential funktion. > pf = 1.004; > > for (i=[0:153]) > hull() > { > translate([0, 0, i]) > scale(pow(pf, i)*[1,1.19255]) > cylinder(r=161/2, h = .01); > translate([0, 0, i+1]) > scale(pow(pf, i+1)*[1,1.19255]) > cylinder(r=161/2, h = .01); > } in a more general formulation you would write your own function f to describe the trajectory. E.g. > step = 10; > for (i=[0:step:153]) > hull() > { > translate([0, 0, i]) > scale(f(i)*[1,1.19255]) > cylinder(r=161/2, h = .01); > translate([0, 0, i+step]) > scale(f(i+step)*[1,1.19255]) > cylinder(r=161/2, h = .01); > } > > function f(i) = 1+ pow(i/200,2); <http://forum.openscad.org/file/n17409/hat.png>  View this message in context: http://forum.openscad.org/Curvedlinearextrudetp17407p17409.html Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org  No virus found in this message. Checked by AVG  www.avg.com Version: 2015.0.6201 / Virus Database: 4568/12284  Release Date: 05/23/16 _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by Neon22
Thanks Neon22 this is also a very useful approach.
Original Message From: Discuss [mailto:[hidden email]] On Behalf Of Neon22 Sent: 24 May 2016 00:18 To: [hidden email] Subject: Re: [OpenSCAD] Curved linear extrude Also consider approach where you draw the profile and build a volume of revolution Check this code for example to make handles:  http://www.thingiverse.com/thing:923244 (tricky to ensure they meet perfectly in the mifddle) Use inkscape to draw the profile:  http://www.thingiverse.com/thing:1065500  View this message in context: http://forum.openscad.org/Curvedlinearextrudetp17407p17410.html Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org  No virus found in this message. Checked by AVG  www.avg.com Version: 2015.0.6201 / Virus Database: 4568/12284  Release Date: 05/23/16 _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Free forum by Nabble  Edit this page 