172 lines
13 KiB
OpenSCAD
172 lines
13 KiB
OpenSCAD
include <../../config.scad>;
|
|
use <./skeleton_beam.scad>;
|
|
use <../fixings/square_tube_joint_cross.scad>;
|
|
use <../fixings/square_tube_joint_n_way.scad>;
|
|
use <../fixings/square_tube_joint_tee.scad>;
|
|
|
|
function get_length_beam_from_total_length_and_count_segments(length_total, count_segments) = (length_total - (count_segments + 1) * D_BEAM_SKELETON) / (count_segments);
|
|
|
|
module skeleton() {
|
|
// Shopping
|
|
echo("Skeleton");
|
|
// Model
|
|
translate([0, 0, -D_BEAM_SKELETON / 2]) union() {
|
|
count_beams_on_side_face_along_y = COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y;
|
|
count_beams_on_rear_face_along_x = COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_X;
|
|
count_beams_on_rear_face_along_z = COUNT_BEAMS_ON_SIDE_FACE_ALONG_Z;
|
|
count_beams_on_top_face_along_x = COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_X;
|
|
count_beams_on_top_face_along_y = COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y;
|
|
|
|
length_beam_on_bottom_face_along_x = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[0], COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_X);
|
|
length_beam_on_bottom_face_along_y = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[1], COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y);
|
|
length_beam_on_side_face_along_y = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[1], count_beams_on_side_face_along_y);
|
|
length_beam_on_side_face_along_z = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[2], COUNT_BEAMS_ON_SIDE_FACE_ALONG_Z);
|
|
length_beam_on_rear_face_along_x = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[0], count_beams_on_rear_face_along_x);
|
|
length_beam_on_rear_face_along_z = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[2], count_beams_on_rear_face_along_z);
|
|
length_beam_on_top_face_along_x = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[0], count_beams_on_top_face_along_x);
|
|
length_beam_on_top_face_along_y = get_length_beam_from_total_length_and_count_segments(R_EXTERNAL[1], count_beams_on_top_face_along_y);
|
|
|
|
// Bottom
|
|
translate([0, 0, -R_INTERNAL[2] / 2]) for (index_beam_on_bottom_face_along_x = [0 : 1 : COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_X]) { // -R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2
|
|
for (index_beam_on_bottom_face_along_y = [0 : 1 : COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y]) {
|
|
// Beams
|
|
if (index_beam_on_bottom_face_along_x < COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_X) {
|
|
translate([-R_INTERNAL[0] / 2 + length_beam_on_bottom_face_along_x / 2 + (D_BEAM_SKELETON + length_beam_on_bottom_face_along_x) * (index_beam_on_bottom_face_along_x), -R_INTERNAL[1] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_bottom_face_along_y) * (index_beam_on_bottom_face_along_y), 0]) rotate([0, 90, 0]) skeleton_beam(length_beam_on_bottom_face_along_x);
|
|
}
|
|
if (index_beam_on_bottom_face_along_y < COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y) {
|
|
translate([-R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_bottom_face_along_x) * (index_beam_on_bottom_face_along_x), -R_INTERNAL[1] / 2 + length_beam_on_bottom_face_along_y / 2 + (D_BEAM_SKELETON + length_beam_on_bottom_face_along_y) * (index_beam_on_bottom_face_along_y), 0]) rotate([90, 0, 0]) skeleton_beam(length_beam_on_bottom_face_along_y);
|
|
}
|
|
// Joints
|
|
translate([-R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_bottom_face_along_x) * (index_beam_on_bottom_face_along_x), -R_INTERNAL[1] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_bottom_face_along_y) * (index_beam_on_bottom_face_along_y), 0]) {
|
|
if (index_beam_on_bottom_face_along_x == 0 || index_beam_on_bottom_face_along_x == COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_X) {
|
|
mirror([(index_beam_on_bottom_face_along_x == COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_X ? 1 : 0), 0, 0]) {
|
|
if (index_beam_on_bottom_face_along_y == 0 || index_beam_on_bottom_face_along_y == COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y) {
|
|
mirror([0, (index_beam_on_bottom_face_along_y == COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y ? 1 : 0), 0]) square_tube_joint_n_way(D_BEAM_SKELETON, T_BEAM_SKELETON, 3);
|
|
}
|
|
else {
|
|
rotate([90, 0, 0]) square_tube_joint_n_way(D_BEAM_SKELETON, T_BEAM_SKELETON, 4);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if (index_beam_on_bottom_face_along_y == 0) {
|
|
square_tube_joint_tee(D_BEAM_SKELETON, T_BEAM_SKELETON);
|
|
}
|
|
else if (index_beam_on_bottom_face_along_y == COUNT_BEAMS_ON_BOTTOM_FACE_ALONG_Y) {
|
|
rotate([90, 0, -90]) square_tube_joint_n_way(D_BEAM_SKELETON, T_BEAM_SKELETON, 4);
|
|
}
|
|
else {
|
|
square_tube_joint_cross(D_BEAM_SKELETON, T_BEAM_SKELETON);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Sides
|
|
for (index_side = [0 : 1 : 1]) mirror([index_side, 0, 0]) {
|
|
translate([R_INTERNAL[0] / 2 + D_BEAM_SKELETON / 2, 0, 0]) for (index_beam_on_side_face_along_z = [0 : 1 : COUNT_BEAMS_ON_SIDE_FACE_ALONG_Z]) {
|
|
for (index_beam_on_side_face_along_y = [0 : 1 : count_beams_on_side_face_along_y]) {
|
|
// Beams
|
|
if (
|
|
index_beam_on_side_face_along_y < count_beams_on_side_face_along_y
|
|
&& index_beam_on_side_face_along_z > 0
|
|
&& index_beam_on_side_face_along_z < COUNT_BEAMS_ON_SIDE_FACE_ALONG_Z
|
|
|
|
) {
|
|
translate([0, -R_INTERNAL[1] / 2 + length_beam_on_side_face_along_y / 2 + (D_BEAM_SKELETON + length_beam_on_side_face_along_y) * (index_beam_on_side_face_along_y), -R_INTERNAL[2] / 2 + (D_BEAM_SKELETON + length_beam_on_side_face_along_z) * (index_beam_on_side_face_along_z)]) rotate([90, 0, 0]) skeleton_beam(length_beam_on_side_face_along_y);
|
|
}
|
|
if (index_beam_on_side_face_along_z < COUNT_BEAMS_ON_SIDE_FACE_ALONG_Z) {
|
|
translate([0, -R_INTERNAL[1] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_side_face_along_y) * (index_beam_on_side_face_along_y), -R_INTERNAL[2] / 2 + D_BEAM_SKELETON / 2 + length_beam_on_side_face_along_z / 2 + (D_BEAM_SKELETON + length_beam_on_side_face_along_z) * (index_beam_on_side_face_along_z)]) skeleton_beam(length_beam_on_side_face_along_z);
|
|
}
|
|
// Joints
|
|
translate([0, -R_INTERNAL[1] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_side_face_along_y) * (index_beam_on_side_face_along_y), -R_INTERNAL[2] / 2 + (D_BEAM_SKELETON + length_beam_on_side_face_along_z) * (index_beam_on_side_face_along_z)]) {
|
|
if (
|
|
index_beam_on_side_face_along_z > 0
|
|
&& index_beam_on_side_face_along_z < COUNT_BEAMS_ON_SIDE_FACE_ALONG_Z
|
|
) {
|
|
if (index_beam_on_side_face_along_y == 0) {
|
|
rotate([0, 90, 0]) square_tube_joint_tee(D_BEAM_SKELETON, T_BEAM_SKELETON);
|
|
}
|
|
else if (index_beam_on_side_face_along_y == count_beams_on_side_face_along_y) {
|
|
rotate([0, 0, 180]) square_tube_joint_n_way(D_BEAM_SKELETON, T_BEAM_SKELETON, 4);
|
|
}
|
|
else {
|
|
rotate([0, 90, 0]) square_tube_joint_cross(D_BEAM_SKELETON, T_BEAM_SKELETON);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Rear
|
|
translate([0, R_INTERNAL[1] / 2 + D_BEAM_SKELETON / 2, 0]) for (index_beam_on_rear_face_along_x = [0 : 1 : count_beams_on_rear_face_along_x]) {
|
|
for (index_beam_on_rear_face_along_z = [0 : 1 : count_beams_on_rear_face_along_z]) {
|
|
// Beams
|
|
if (
|
|
index_beam_on_rear_face_along_x < count_beams_on_rear_face_along_x
|
|
&& index_beam_on_rear_face_along_z > 0
|
|
&& index_beam_on_rear_face_along_z < count_beams_on_rear_face_along_z
|
|
|
|
) {
|
|
translate([-R_INTERNAL[0] / 2 + length_beam_on_rear_face_along_x / 2 + (D_BEAM_SKELETON + length_beam_on_rear_face_along_x) * (index_beam_on_rear_face_along_x), 0, -R_INTERNAL[2] / 2 + (D_BEAM_SKELETON + length_beam_on_rear_face_along_z) * (index_beam_on_rear_face_along_z)]) rotate([0, 90, 0]) skeleton_beam(length_beam_on_rear_face_along_x);
|
|
}
|
|
if (
|
|
index_beam_on_rear_face_along_z < count_beams_on_rear_face_along_z
|
|
&& index_beam_on_rear_face_along_x > 0
|
|
&& index_beam_on_rear_face_along_x < count_beams_on_rear_face_along_x
|
|
) {
|
|
translate([-R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_rear_face_along_x) * (index_beam_on_rear_face_along_x), 0, -R_INTERNAL[2] / 2 + D_BEAM_SKELETON / 2 + length_beam_on_rear_face_along_z / 2 + (D_BEAM_SKELETON + length_beam_on_rear_face_along_z) * (index_beam_on_rear_face_along_z)]) skeleton_beam(length_beam_on_rear_face_along_z);
|
|
}
|
|
// Joints
|
|
translate([-R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_rear_face_along_x) * (index_beam_on_rear_face_along_x), 0, -R_INTERNAL[2] / 2 + (D_BEAM_SKELETON + length_beam_on_rear_face_along_z) * (index_beam_on_rear_face_along_z)]) {
|
|
if (
|
|
index_beam_on_rear_face_along_z > 0
|
|
&& index_beam_on_rear_face_along_z < count_beams_on_rear_face_along_z
|
|
) {
|
|
if (index_beam_on_rear_face_along_x > 0 && index_beam_on_rear_face_along_x < count_beams_on_rear_face_along_x) {
|
|
rotate([90, 0, 0]) square_tube_joint_cross(D_BEAM_SKELETON, T_BEAM_SKELETON);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Top
|
|
translate([0, 0, R_INTERNAL[2] / 2 + D_BEAM_SKELETON]) for (index_beam_on_top_face_along_x = [0 : 1 : count_beams_on_top_face_along_x]) { // -R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2
|
|
for (index_beam_on_top_face_along_y = [0 : 1 : count_beams_on_top_face_along_y]) {
|
|
// Beams
|
|
if (index_beam_on_top_face_along_x < count_beams_on_top_face_along_x) {
|
|
translate([-R_INTERNAL[0] / 2 + length_beam_on_top_face_along_x / 2 + (D_BEAM_SKELETON + length_beam_on_top_face_along_x) * (index_beam_on_top_face_along_x), -R_INTERNAL[1] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_top_face_along_y) * (index_beam_on_top_face_along_y), 0]) rotate([0, 90, 0]) skeleton_beam(length_beam_on_top_face_along_x);
|
|
}
|
|
if (index_beam_on_top_face_along_y < count_beams_on_top_face_along_y) {
|
|
translate([-R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_top_face_along_x) * (index_beam_on_top_face_along_x), -R_INTERNAL[1] / 2 + length_beam_on_top_face_along_y / 2 + (D_BEAM_SKELETON + length_beam_on_top_face_along_y) * (index_beam_on_top_face_along_y), 0]) rotate([90, 0, 0]) skeleton_beam(length_beam_on_top_face_along_y);
|
|
}
|
|
// Joints
|
|
translate([-R_INTERNAL[0] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_top_face_along_x) * (index_beam_on_top_face_along_x), -R_INTERNAL[1] / 2 - D_BEAM_SKELETON / 2 + (D_BEAM_SKELETON + length_beam_on_top_face_along_y) * (index_beam_on_top_face_along_y), 0]) {
|
|
if (index_beam_on_top_face_along_x == 0 || index_beam_on_top_face_along_x == count_beams_on_top_face_along_x) {
|
|
mirror([(index_beam_on_top_face_along_x == count_beams_on_top_face_along_x ? 1 : 0), 0, 0]) {
|
|
if (index_beam_on_top_face_along_y == 0 || index_beam_on_top_face_along_y == count_beams_on_top_face_along_y) {
|
|
mirror([0, (index_beam_on_top_face_along_y == count_beams_on_top_face_along_y ? 1 : 0), 1]) square_tube_joint_n_way(D_BEAM_SKELETON, T_BEAM_SKELETON, 3);
|
|
}
|
|
else {
|
|
rotate([-90, 0, 0]) square_tube_joint_n_way(D_BEAM_SKELETON, T_BEAM_SKELETON, 4);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if (index_beam_on_top_face_along_y == 0) {
|
|
square_tube_joint_tee(D_BEAM_SKELETON, T_BEAM_SKELETON);
|
|
}
|
|
else if (index_beam_on_top_face_along_y == count_beams_on_top_face_along_y) {
|
|
rotate([-90, 0, -90]) square_tube_joint_n_way(D_BEAM_SKELETON, T_BEAM_SKELETON, 4);
|
|
}
|
|
else {
|
|
square_tube_joint_cross(D_BEAM_SKELETON, T_BEAM_SKELETON);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
skeleton(); |