
Well, I think this is all the code there is:
module orient_to(origin, normal) {
translate(origin)
rotate([0, 0, atan2(normal.y, normal.x)]) //rotation
rotate([0, atan2(sqrt(pow(normal.x, 2)+pow(normal.y, 2)),normal.z), 0])
child();
}
module ruled_surface(limit,step) {
for (x=[0:step:limit])
assign(pf = f(x))
assign(pg = g(x))
assign(length = norm(pg  pf))
orient_to(pf, pg  pf)
cylinder(r=Line_radius,h=length);
};
function f(a) = [ Radius * cos(a),
Radius * e * sin(a),
0];
function g(a) = [ Radius * cos(a+Phase),
Radius * e * sin(a + Phase),
0]
+ [0,0,Height];
Phase = 120;
Height = 60;
Radius = 20;
Line_radius=1.5;
e=1.5;
Step=10;
ruled_surface(360,Step);
function norm(v) =
pow(v.x*v.x + v.y*v.y + v.z*v.z,0.5);
function f(x,p) = [0,0,x*Height];
function g(x,p) = [Radius * cos(x*360*Revs),
Radius * sin(x*360*Revs),
x*Height];
Height=60;
Radius=20;
Revs=2;
Steps=200;
Step=1/Steps;
Thickness=1;
Sides=10;
$fn= Sides;
ruled_surface(1,Step,Thickness);
module orient_to(origin, normal) {
translate(origin)
rotate([0, 0, atan2(normal.y, normal.x)]) //rotation
rotate([0, atan2(sqrt(pow(normal.x, 2)+pow(normal.y, 2)),normal.z), 0])
child();
}
module ruled_surface(limit,step,params) {
for (x=[0:step:limit])
assign(pf = f(x,params))
assign(pg = g(x,params))
assign(length = norm(pgpf))
orient_to(pf,pgpf)
cylinder(r=Line_radius,h=length);
};
function f(a,phase) = [ Radius * cos(a),
Radius * e * sin(a),
0];
function g(a,phase) = Top_ratio * [ Radius * cos(a+phase),
Radius * e * sin(a + phase),
0]
+ [0,0,Height];
Phase=120;
Height = 60;
Radius = 20;
Line_radius=1.5;
e=1.5;
Top_ratio = 0.8;
Step=20;
union(){
ruled_surface(360,Step,Phase);
ruled_surface(360,Step,Phase);
}
function f(x,p) = p[0] + x/Length * (p[1]  p[0]);
function g(x,p) = p[2] + x/Length * (p[3]  p[2]);
Length=40;
Width=40;
Height=60;
Steps=10;
Step=Length/Steps;
Thickness=3;
Sides=10;
p = [
[0,0,0],
[0,Width,0],
[Length,Width,0],
[Length,0,0],
[0,0,Height],
[0,Width,Height],
[Length,Width,Height],
[Length,0,Height]
];
$fn= Sides;
ruled_surface(Length,Step,Thickness,[p[0],p[2],p[5],p[7]] );
ruled_surface(Length,Step,Thickness,[p[0],p[5],p[2],p[7]] );
module slice(x,thickness) {
assign(pa = f(x))
assign(pb = g(x))
assign(length = norm(pbpa))
orient_to(pa,pbpa)
cylinder(r=thickness,h=length);
};
module ruled_surface(limit,step,thickness=1) {
for (x=[0:step:limitstep])
hull() {
slice(x,thickness);
slice(x+step,thickness);
}
};
Put it all together.
Here's what I've got:
"WARNING: No top level geometry to render"
Now which half and how, still a mystery.
