Created
June 1, 2026 16:26
-
-
Save Alxandr/e93639856f886fb2693423db28bd55a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // TV bench model. | |
| // Units: millimeters. | |
| bench_width = 2800; // 280 cm | |
| bench_depth = 400; // 40 cm | |
| bench_height = 380; // 38 cm | |
| material_thickness = 17; // 1.7 cm | |
| top_bottom_plate_thickness = 30; // 3 cm | |
| door_thickness = 17; // 1.7 cm | |
| rear_air_gap = 20; // 2 cm | |
| front_air_gap = 20; // 2 cm | |
| rear_spacer_width = 50; // 5 cm | |
| front_spacer_width = material_thickness; | |
| section_count = 6; | |
| internal_wall_count = section_count - 1; | |
| section_width = bench_width / section_count; | |
| door_pair_count = section_count / 2; | |
| door_pair_width = bench_width / door_pair_count; | |
| front_door_width = door_pair_width / 2; | |
| front_door_height = bench_height - top_bottom_plate_thickness; | |
| front_door_small_open_angle = 10; | |
| front_door_half_open_angle = 45; | |
| bottom_plate_width = bench_width; | |
| bottom_plate_depth = bench_depth - door_thickness - rear_air_gap; | |
| bottom_plate_total_depth = bottom_plate_depth + rear_air_gap; | |
| bottom_plate_thickness = top_bottom_plate_thickness; | |
| top_plate_width = bench_width; | |
| top_plate_depth = bench_depth - door_thickness; | |
| top_plate_thickness = top_bottom_plate_thickness; | |
| side_wall_width = material_thickness; | |
| side_wall_depth = bench_depth - door_thickness; | |
| side_wall_height = bench_height - 2 * top_bottom_plate_thickness; | |
| internal_wall_width = material_thickness; | |
| internal_wall_depth = bench_depth - door_thickness; | |
| internal_wall_height = bench_height - 2 * top_bottom_plate_thickness; | |
| back_wall_thickness = material_thickness; | |
| back_wall_height = bench_height - 2 * top_bottom_plate_thickness; | |
| back_wall_cutout_size = 150; // 15 cm | |
| electrical_outlet_width = 109; | |
| electrical_outlet_height = 87; | |
| electrical_outlet_wall_inset = 20; // 2 cm | |
| internal_shelf_thickness = material_thickness; | |
| internal_shelf_rear_extra_inset = 40; // 4 cm | |
| internal_shelf_rear_inset = rear_air_gap + internal_shelf_rear_extra_inset; | |
| internal_shelf_front_inset = rear_air_gap; | |
| internal_shelf_depth = bench_depth | |
| - door_thickness | |
| - rear_air_gap | |
| - material_thickness | |
| - internal_shelf_front_inset; | |
| internal_shelf_z = bottom_plate_thickness | |
| + (side_wall_height - internal_shelf_thickness) / 2; | |
| module bottom_plate() { | |
| module rear_gap_cutout(width) { | |
| translate([0, -1, -1]) | |
| cube( | |
| [ | |
| width, | |
| rear_air_gap + 2, | |
| bottom_plate_thickness + 2, | |
| ] | |
| ); | |
| } | |
| difference() { | |
| cube( | |
| [ | |
| bottom_plate_width, | |
| bottom_plate_total_depth, | |
| bottom_plate_thickness, | |
| ] | |
| ); | |
| for (section_index = [0:section_count - 1]) { | |
| cutout_left_x = section_index * section_width | |
| + rear_spacer_width | |
| + (section_index == 0 ? side_wall_width : 0); | |
| cutout_right_x = (section_index + 1) * section_width | |
| - rear_spacer_width | |
| - (section_index == section_count - 1 ? side_wall_width : 0); | |
| if (cutout_right_x > cutout_left_x) { | |
| translate([cutout_left_x, 0, 0]) | |
| rear_gap_cutout(cutout_right_x - cutout_left_x); | |
| } | |
| } | |
| } | |
| } | |
| module top_plate() { | |
| translate([0, 0, bench_height - top_plate_thickness]) | |
| difference() { | |
| cube( | |
| [ | |
| top_plate_width, | |
| top_plate_depth, | |
| top_plate_thickness, | |
| ] | |
| ); | |
| for (section_index = [0:section_count - 1]) { | |
| cutout_left_x = section_index * section_width | |
| + front_spacer_width | |
| + (section_index == 0 ? side_wall_width : 0); | |
| cutout_right_x = (section_index + 1) * section_width | |
| - front_spacer_width | |
| - (section_index == section_count - 1 ? side_wall_width : 0); | |
| if (cutout_right_x > cutout_left_x) { | |
| translate([cutout_left_x, top_plate_depth - front_air_gap, -1]) | |
| cube( | |
| [ | |
| cutout_right_x - cutout_left_x, | |
| front_air_gap + 2, | |
| top_plate_thickness + 2, | |
| ] | |
| ); | |
| } | |
| } | |
| } | |
| } | |
| module side_walls() { | |
| module side_wall() { | |
| cube( | |
| [ | |
| side_wall_width, | |
| side_wall_depth, | |
| side_wall_height, | |
| ] | |
| ); | |
| } | |
| translate([0, 0, bottom_plate_thickness]) | |
| side_wall(); | |
| translate([bench_width - side_wall_width, 0, bottom_plate_thickness]) | |
| side_wall(); | |
| } | |
| module front_doors() { | |
| door_y = bench_depth - door_thickness; | |
| door_z = bottom_plate_thickness; | |
| module front_door_pair(open_angle) { | |
| rotate([0, 0, open_angle]) | |
| cube( | |
| [ | |
| front_door_width, | |
| door_thickness, | |
| front_door_height, | |
| ] | |
| ); | |
| translate([door_pair_width, 0, 0]) | |
| rotate([0, 0, -open_angle]) | |
| translate([-front_door_width, 0, 0]) | |
| cube( | |
| [ | |
| front_door_width, | |
| door_thickness, | |
| front_door_height, | |
| ] | |
| ); | |
| } | |
| translate([0, door_y, door_z]) | |
| front_door_pair(front_door_small_open_angle); | |
| translate([door_pair_width, door_y, door_z]) | |
| front_door_pair(front_door_half_open_angle); | |
| translate([2 * door_pair_width, door_y, door_z]) | |
| front_door_pair(0s); | |
| } | |
| module internal_walls() { | |
| module internal_wall() { | |
| cube( | |
| [ | |
| internal_wall_width, | |
| internal_wall_depth, | |
| internal_wall_height, | |
| ] | |
| ); | |
| } | |
| for (wall_index = [1:internal_wall_count]) { | |
| wall_center_x = wall_index * section_width; | |
| translate( | |
| [ | |
| wall_center_x - internal_wall_width / 2, | |
| 0, | |
| bottom_plate_thickness, | |
| ] | |
| ) | |
| internal_wall(); | |
| } | |
| } | |
| module back_walls() { | |
| upper_level_bottom_z = internal_shelf_z | |
| + internal_shelf_thickness | |
| - bottom_plate_thickness; | |
| electrical_outlet_z = upper_level_bottom_z | |
| + (back_wall_height - upper_level_bottom_z - electrical_outlet_width) / 2; | |
| module back_wall(width, section_index) { | |
| electrical_outlet_x = section_index % 2 == 0 | |
| ? electrical_outlet_wall_inset | |
| : width - electrical_outlet_wall_inset - electrical_outlet_height; | |
| difference() { | |
| cube( | |
| [ | |
| width, | |
| back_wall_thickness, | |
| back_wall_height, | |
| ] | |
| ); | |
| translate( | |
| [ | |
| (width - back_wall_cutout_size) / 2, | |
| -1, | |
| (back_wall_height - back_wall_cutout_size) / 2, | |
| ] | |
| ) | |
| cube( | |
| [ | |
| back_wall_cutout_size, | |
| back_wall_thickness + 2, | |
| back_wall_cutout_size, | |
| ] | |
| ); | |
| translate( | |
| [ | |
| electrical_outlet_x, | |
| -1, | |
| electrical_outlet_z, | |
| ] | |
| ) | |
| cube( | |
| [ | |
| electrical_outlet_height, | |
| back_wall_thickness + 2, | |
| electrical_outlet_width, | |
| ] | |
| ); | |
| } | |
| } | |
| for (section_index = [0:section_count - 1]) { | |
| section_left_x = section_index == 0 | |
| ? side_wall_width | |
| : section_index * section_width + internal_wall_width / 2; | |
| section_right_x = section_index == section_count - 1 | |
| ? bench_width - side_wall_width | |
| : (section_index + 1) * section_width - internal_wall_width / 2; | |
| back_wall_width = section_right_x - section_left_x; | |
| translate( | |
| [ | |
| section_left_x, | |
| rear_air_gap, | |
| bottom_plate_thickness, | |
| ] | |
| ) | |
| back_wall(back_wall_width, section_index); | |
| } | |
| } | |
| module internal_shelves() { | |
| module internal_shelf(width) { | |
| difference() { | |
| cube( | |
| [ | |
| width, | |
| internal_shelf_depth, | |
| internal_shelf_thickness, | |
| ] | |
| ); | |
| translate([rear_spacer_width, -1, -1]) | |
| cube( | |
| [ | |
| width - 2 * rear_spacer_width, | |
| internal_shelf_rear_extra_inset + 2, | |
| internal_shelf_thickness + 2, | |
| ] | |
| ); | |
| } | |
| } | |
| for (section_index = [0:section_count - 1]) { | |
| section_left_x = section_index == 0 | |
| ? side_wall_width | |
| : section_index * section_width + internal_wall_width / 2; | |
| section_right_x = section_index == section_count - 1 | |
| ? bench_width - side_wall_width | |
| : (section_index + 1) * section_width - internal_wall_width / 2; | |
| shelf_width = section_right_x - section_left_x; | |
| translate( | |
| [ | |
| section_left_x, | |
| rear_air_gap + material_thickness, | |
| internal_shelf_z, | |
| ] | |
| ) | |
| internal_shelf(shelf_width); | |
| } | |
| } | |
| bottom_plate(); | |
| top_plate(); | |
| side_walls(); | |
| internal_walls(); | |
| back_walls(); | |
| internal_shelves(); | |
| front_doors(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment