discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Making a curved cone?

JB
Jordan Brown
Thu, Apr 29, 2021 4:05 PM

I want to make a slightly curved cone, so it's a cylinder() call, but
I'd like about 15 degrees of bend in the cone over its' length. Think
of a curved Marlinspike, if you've done ropework.

There's no simple way.  You need to construct a polyhedron.

There are libraries that will help you do this, mostly with the name
"sweep".  Here is one such function:

https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-sweep

These generally operate by having you supply a polygon that is then
swept along a specified path to form a polyhedron.

Here's an example:

include <BOSL2/std.scad>

// Usual $fs, $fa, $fn control the number of sides of the circle.
$fs = 0.5;

step = 0.01;    // Steps from 0 to 1 by this increment
bend = 15;      // In degrees
height = 20;    // Before bending
r1 = 3;        // At base
r2 = 0;        // At peak

path_transforms = [
for (t=[0:step:1-step])
xrot(bendt)
* translate([0,0,height
t])
* scale(1 + t*(r2-r1)/r1)
];
sweep(circle(r=r1), path_transforms);

> I want to make a slightly curved cone, so it's a cylinder() call, but > I'd like about 15 degrees of bend in the cone over its' length. Think > of a curved Marlinspike, if you've done ropework. There's no simple way.  You need to construct a polyhedron. There are libraries that will help you do this, mostly with the name "sweep".  Here is one such function: https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-sweep These generally operate by having you supply a polygon that is then swept along a specified path to form a polyhedron. Here's an example: include <BOSL2/std.scad> // Usual $fs, $fa, $fn control the number of sides of the circle. $fs = 0.5; step = 0.01; // Steps from 0 to 1 by this increment bend = 15; // In degrees height = 20; // Before bending r1 = 3; // At base r2 = 0; // At peak path_transforms = [ for (t=[0:step:1-step]) xrot(bend*t) * translate([0,0,height*t]) * scale(1 + t*(r2-r1)/r1) ]; sweep(circle(r=r1), path_transforms);