基于外接十二面体边拆分空心球
Split hollow sphere based on circumscribed Dodecahedron sides
我试图在我的 Printrbot 上打印一个 300mm 的空心球体,方法是将球体的内腔塑造成规则的外接多面体,并根据外接多面体的边拆分球体。我首先尝试用立方体进行此操作,得到 6 个侧面,底部为可 3d 打印的平底,但是由于打印机的构建体积有限(150x150x150 毫米),结果侧面的 ~175 毫米边缘不适合。
下一个合理的步骤似乎是将外接多面体更改为十二面体并打印出 12 个面而不是 6 个面,但是,我在弄清楚如何正确地将五边形面投影到球体和切片上时遇到了一些问题它相应地。有什么方法可以得到球体和投影十二面体边的交点吗?我当前的代码如下。
$fn = 72;
diameter=300;
side();
module side()
{
difference()
{
hollow_sphere(diameter);
rotate([180,0,0])
fiveSideMask();
}
}
// A cubic mask to remove all sides but one from the circle
module fiveSideMask()
{
union()
{
rotate([45,0,0])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
rotate([-45,0,0])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
rotate([0,0,45])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
rotate([0,0,-45])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
}
}
module hollow_sphere(diameter=300, shell_thickness=5)
{
difference()
{
sphere(d=diameter, center=true);
//Sphere internal cavity
//sphere(d=(diameter-(shell_thickness*2)), center=true);
//Cube internal cavity
cube(CubeEdgeFromDiag(diameter - shell_thickness * 2), center=true);
//Dodecahedron internal cavity
//rotate([90,0,0])
//dodecahedron(225);
}
}
function CubeEdgeFromDiag(diagLength) = (sqrt(3) * diagLength) / 3;
module dodecahedron(size)
{
dihedral = 116.565;
intersection()
{
box(size);
intersection_for(i=[1:5])
{
rotate([dihedral, 0, 360 / 5 * i]) box(size);
}
}
}
module box(size)
{
cube([2*size, 2*size, size], center = true);
}
您实际上可以使用与您现有的技术类似的技术
fiveSideMask
模块,但不是围绕方形金字塔切割,而是围绕五角金字塔切割:
// A mask to remove everything from the sphere but the projection of the face.
module sideMask() {
union() {
radius = diameter / 2;
dihedral_angle = acos(-1/sqrt(5));
// Five slabs adjacent to the pentagonal-pyramind that projects out
// around the face.
for (theta = [0:360/5:359]) {
rotate([90 - dihedral_angle,0,theta])
translate([-diameter/2,0, 0])
cube([diameter, radius, diameter]);
}
// We also want to mask out the opposite side of the sphere.
translate([-radius, -radius, -radius])
cube([diameter, diameter, radius]);
}
}
您还可以通过在 side
中使用 hull
来简化 hollow_sphere
(并使其名称更准确)。这在计算上更昂贵,但大大简化了代码。传递给 hollow_sphere
的 shell_thickness
最终将成为十二面体顶点处的最小厚度:
module side() {
// hull() is pretty expensive, but it nicely flattens out the bottom of the
// shape, making for something easily printable.
hull() difference() {
hollow_sphere(diameter);
rotate([180,0,0])
sideMask();
}
}
module hollow_sphere(diameter=300, shell_thickness=15) {
difference() {
sphere(d=diameter);
sphere(d=diameter - shell_thickness);
}
}
您唯一需要保留的其他内容是文件顶部的几行...
$fn = 72;
diameter=300;
side();
...你会得到这样的东西:
我试图在我的 Printrbot 上打印一个 300mm 的空心球体,方法是将球体的内腔塑造成规则的外接多面体,并根据外接多面体的边拆分球体。我首先尝试用立方体进行此操作,得到 6 个侧面,底部为可 3d 打印的平底,但是由于打印机的构建体积有限(150x150x150 毫米),结果侧面的 ~175 毫米边缘不适合。
下一个合理的步骤似乎是将外接多面体更改为十二面体并打印出 12 个面而不是 6 个面,但是,我在弄清楚如何正确地将五边形面投影到球体和切片上时遇到了一些问题它相应地。有什么方法可以得到球体和投影十二面体边的交点吗?我当前的代码如下。
$fn = 72;
diameter=300;
side();
module side()
{
difference()
{
hollow_sphere(diameter);
rotate([180,0,0])
fiveSideMask();
}
}
// A cubic mask to remove all sides but one from the circle
module fiveSideMask()
{
union()
{
rotate([45,0,0])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
rotate([-45,0,0])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
rotate([0,0,45])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
rotate([0,0,-45])
translate([0,-diameter/4, 0])
cube([diameter, diameter/2, diameter], center=true);
}
}
module hollow_sphere(diameter=300, shell_thickness=5)
{
difference()
{
sphere(d=diameter, center=true);
//Sphere internal cavity
//sphere(d=(diameter-(shell_thickness*2)), center=true);
//Cube internal cavity
cube(CubeEdgeFromDiag(diameter - shell_thickness * 2), center=true);
//Dodecahedron internal cavity
//rotate([90,0,0])
//dodecahedron(225);
}
}
function CubeEdgeFromDiag(diagLength) = (sqrt(3) * diagLength) / 3;
module dodecahedron(size)
{
dihedral = 116.565;
intersection()
{
box(size);
intersection_for(i=[1:5])
{
rotate([dihedral, 0, 360 / 5 * i]) box(size);
}
}
}
module box(size)
{
cube([2*size, 2*size, size], center = true);
}
您实际上可以使用与您现有的技术类似的技术
fiveSideMask
模块,但不是围绕方形金字塔切割,而是围绕五角金字塔切割:
// A mask to remove everything from the sphere but the projection of the face.
module sideMask() {
union() {
radius = diameter / 2;
dihedral_angle = acos(-1/sqrt(5));
// Five slabs adjacent to the pentagonal-pyramind that projects out
// around the face.
for (theta = [0:360/5:359]) {
rotate([90 - dihedral_angle,0,theta])
translate([-diameter/2,0, 0])
cube([diameter, radius, diameter]);
}
// We also want to mask out the opposite side of the sphere.
translate([-radius, -radius, -radius])
cube([diameter, diameter, radius]);
}
}
您还可以通过在 side
中使用 hull
来简化 hollow_sphere
(并使其名称更准确)。这在计算上更昂贵,但大大简化了代码。传递给 hollow_sphere
的 shell_thickness
最终将成为十二面体顶点处的最小厚度:
module side() {
// hull() is pretty expensive, but it nicely flattens out the bottom of the
// shape, making for something easily printable.
hull() difference() {
hollow_sphere(diameter);
rotate([180,0,0])
sideMask();
}
}
module hollow_sphere(diameter=300, shell_thickness=15) {
difference() {
sphere(d=diameter);
sphere(d=diameter - shell_thickness);
}
}
您唯一需要保留的其他内容是文件顶部的几行...
$fn = 72;
diameter=300;
side();
...你会得到这样的东西: