jon
2016-12-25 00:39:35 UTC
I have a bit of code at the end of this question. It produces a shape
with 4 curved sides, each of which lies on the surface of a cylinder.
Note that this is an example shape: I want to work with families of
similar shapes, not just with this one example.
I would like a way to take each of the 4 surfaces and produce a 2D shape
that, when cut out and bent, would conform to the original surface. The
idea is to be able to create the original shape out of, say, cardboard
by cutting out the 4 2D shapes and then taping them together.
I have a conceptual idea of how this would be done in a traditional
programming language if I had a list of the coordinates along each of
the 4 boundary lines. I considered re-writing the code, below, as a
sweep, and generating the coordinates explicitly, but a) that is not
trivial (to me), and ii) I want to solve the more general case where the
equations that determine the shape are not known. I looked at the
generated STL file, and the coordinates are there, but not organized in
the way that I would want them to be.
This may be more effort than I want to expend, but I wondered if anyone
had a brilliant insight.
Thanks!
Jon
le = 10; // length
d1 = 25; // diameter of top
d2 = 35; // diameter of bottom
d = -8; // delta to drop center of bottom
$fn = 100;
module shape() {
translate([0, 0, -6])
intersection() {
translate([-le/2, 0, 0])
difference() {
rotate([0, 90, 0])
cylinder(h = le, d = d1);
translate([-1, 0, d])
rotate([0, 90, 0])
cylinder(h = le + 2, d = d2);
}
intersection() {
translate([10, 0, 0])
cylinder(h = 100, d = 30);
translate([-10, 0, 0])
cylinder(h = 100, d = 30);
}
}
}
shape();
*difference() {
shape();
translate([0, 0, -4])
scale([0.8, 0.8, 2])
shape();
}
with 4 curved sides, each of which lies on the surface of a cylinder.
Note that this is an example shape: I want to work with families of
similar shapes, not just with this one example.
I would like a way to take each of the 4 surfaces and produce a 2D shape
that, when cut out and bent, would conform to the original surface. The
idea is to be able to create the original shape out of, say, cardboard
by cutting out the 4 2D shapes and then taping them together.
I have a conceptual idea of how this would be done in a traditional
programming language if I had a list of the coordinates along each of
the 4 boundary lines. I considered re-writing the code, below, as a
sweep, and generating the coordinates explicitly, but a) that is not
trivial (to me), and ii) I want to solve the more general case where the
equations that determine the shape are not known. I looked at the
generated STL file, and the coordinates are there, but not organized in
the way that I would want them to be.
This may be more effort than I want to expend, but I wondered if anyone
had a brilliant insight.
Thanks!
Jon
le = 10; // length
d1 = 25; // diameter of top
d2 = 35; // diameter of bottom
d = -8; // delta to drop center of bottom
$fn = 100;
module shape() {
translate([0, 0, -6])
intersection() {
translate([-le/2, 0, 0])
difference() {
rotate([0, 90, 0])
cylinder(h = le, d = d1);
translate([-1, 0, d])
rotate([0, 90, 0])
cylinder(h = le + 2, d = d2);
}
intersection() {
translate([10, 0, 0])
cylinder(h = 100, d = 30);
translate([-10, 0, 0])
cylinder(h = 100, d = 30);
}
}
}
shape();
*difference() {
shape();
translate([0, 0, -4])
scale([0.8, 0.8, 2])
shape();
}