1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-17 20:11:50 +02:00

refactored

This commit is contained in:
Justin Lin
2017-05-30 15:15:58 +08:00
parent c16355bb57
commit 80007d45a2

View File

@@ -35,23 +35,26 @@ module rounded_cube(size, corner_r, center = false) {
half_cube_leng = size / 2; half_cube_leng = size / 2;
half_leng = half_cube_leng - edge_d; half_leng = half_cube_leng - edge_d;
translate(center ? [0, 0, 0] : [half_x, half_y, half_z]) hull() { corners = [
translate([-half_l, -half_w, half_h]) for(x = [-1, 1])
sphere(corner_r, $fn = corner_frags); for(y = [-1, 1])
translate([half_l, -half_w, half_h]) for(z = [-1, 1])
sphere(corner_r, $fn = corner_frags); [half_l * x, -half_w * y, half_h * z]
translate([half_l, half_w, half_h]) ];
sphere(corner_r, $fn = corner_frags);
translate([-half_l, half_w, half_h])
sphere(corner_r, $fn = corner_frags);
translate([-half_l, -half_w, -half_h]) module corner(i) {
sphere(corner_r, $fn = corner_frags); translate(corners[i])
translate([half_l, -half_w, -half_h])
sphere(corner_r, $fn = corner_frags);
translate([half_l, half_w, -half_h])
sphere(corner_r, $fn = corner_frags);
translate([-half_l, half_w, -half_h])
sphere(corner_r, $fn = corner_frags); sphere(corner_r, $fn = corner_frags);
} }
translate(center ? [0, 0, 0] : [half_x, half_y, half_z]) hull() {
corner(0);
corner(1);
corner(2);
corner(3);
corner(4);
corner(5);
corner(6);
corner(7);
}
} }