| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 | 
							- include <../config/vesa.scad>
 
- include <../config/wall.scad>
 
- include <../config/hook.scad>
 
- module vesa_rsquare(width, height) {
 
-     move_x = width / 2 - vesa_rounding;
 
-     move_y = height / 2 - vesa_rounding;
 
-     hull() {
 
-         translate([move_x, move_y]) {
 
-             circle(r = vesa_rounding);
 
-         }
 
-         translate([-move_x, move_y]) {
 
-             circle(r = vesa_rounding);
 
-         }
 
-         translate([move_x, -move_y]) {
 
-             circle(r = vesa_rounding);
 
-         }
 
-         
 
-         translate([-move_x, -move_y]) {
 
-             circle(r = vesa_rounding);
 
-         }
 
-     }
 
- }
 
- module vesa_hinge(size, thickness, hole) {
 
-     linear_extrude(height = thickness, center = true) {
 
-         difference() {
 
-             union() {
 
-                 circle(r = size / 2);
 
-                 translate([0, size / 4]) {
 
-                     square([size, size / 2], center = true);
 
-                 }
 
-             }
 
-             circle(r = hole / 2);
 
-         }
 
-     }
 
- }
 
- module vesa_monitor_hinge() {
 
-     vesa_hinge(vesa_frame_thickness, vesa_thickness, vesa_base_screw);
 
- }
 
- module vesa_main_hinge() {
 
-     vesa_hinge(vesa_frame_thickness * 2, vesa_thickness, vesa_base_screw);
 
- }
 
- module vesa_monitor() {
 
-     outside_width = vesa_frame_thickness + vesa_width;
 
-     outside_height = vesa_frame_thickness + vesa_height;
 
-     inside_width = vesa_width - vesa_frame_thickness; 
 
-     inside_height = vesa_height - vesa_frame_thickness;
 
-     module base_object() {
 
-         linear_extrude(height = vesa_thickness) {
 
-             difference() {
 
-                 vesa_rsquare(outside_width, outside_height);
 
-                 vesa_rsquare(inside_width, inside_height);
 
-                 translate([vesa_width / 2, vesa_height / 2]) {
 
-                     circle(r = vesa_hole / 2);
 
-                 }
 
-                 translate([-vesa_width / 2, vesa_height / 2]) {
 
-                     circle(r = vesa_hole / 2);
 
-                 }
 
-             
 
-                 translate([vesa_width / 2, -vesa_height / 2]) {
 
-                     circle(r = vesa_hole / 2);
 
-                 }
 
-             
 
-                 translate([-vesa_width / 2, -vesa_height / 2]) {
 
-                     circle(r = vesa_hole / 2);
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     module hinge() {
 
-         translate([0, vesa_height / 2, -vesa_frame_thickness / 2]){
 
-             rotate([90, 0, 90]) {
 
-                 vesa_monitor_hinge();
 
-             }
 
-         }
 
-     }
 
-     module double_hinge() {
 
-         translate([-vesa_thickness, 0, 0]) {
 
-             hinge();
 
-         }
 
-         translate([vesa_thickness, 0, 0]) {
 
-             hinge();
 
-         }
 
-     }
 
-     translate([vesa_width / 3, 0, 0]) {
 
-         double_hinge();
 
-     }
 
-     translate([-vesa_width / 3, 0, 0]) {
 
-         double_hinge();
 
-     }
 
-     module corner_regulation() {
 
-         move = [
 
-             0,
 
-             vesa_rounding * 2 - vesa_height / 3,
 
-             vesa_thickness / 2
 
-         ];
 
-         
 
-         translate(move) { 
 
-             rotate([0, 90, 0]) {
 
-                 cylinder(
 
-                     r = vesa_base_screw / 2, 
 
-                     h = vesa_width + vesa_frame_thickness, 
 
-                     center = true
 
-                 );
 
-             }
 
-         }
 
-     }
 
-     render() {
 
-         difference() {
 
-             base_object();
 
-             corner_regulation();
 
-         }
 
-     }
 
- }
 
- module vesa_thread() {
 
-     radius = vesa_thread_diameter / 2;
 
-     top_radius = vesa_thread_top_diameter / 2;
 
-     cylinder(r = radius, h = vesa_thread_thickness);   
 
-     cylinder(r = top_radius, h = vesa_thread_top_thickness);   
 
- }
 
- module vesa_factor() {
 
-     module circle_corner(position = [0, 0]) {
 
-         translate(position) {
 
-             circle(r = vesa_rounding);
 
-         }
 
-     }
 
-     module square_corner(position = [0, 0]) {
 
-         translate(position) {
 
-             square(vesa_rounding * 2, center = true);
 
-         }
 
-     }
 
-     module difference_circle_corner(position = [0, 0], angle = 0) {
 
-         translate(position) {
 
-             rotate(angle * 90) {
 
-                 render() {
 
-                     difference() {
 
-                         square_corner();
 
-                         circle_corner();
 
-                         translate([0, -vesa_rounding]) {
 
-                             square([vesa_rounding, vesa_rounding]);
 
-                         }
 
-                         translate([-vesa_rounding, 0]) {
 
-                             square([vesa_rounding * 2, vesa_rounding]);
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     top_x = vesa_width / 3 - vesa_thickness / 3;
 
-     top_left = [top_x, vesa_height / 2 - vesa_frame_thickness];
 
-     top_right = [-top_left.x, top_left.y];
 
-     round_top_left = [top_left.x, top_left.y - vesa_frame_thickness];
 
-     round_top_right = [top_right.x, top_right.y - vesa_frame_thickness];
 
-     
 
-     module top_shape() {
 
-         hull() {
 
-             square_corner(top_left);
 
-             square_corner(top_right);
 
-             circle_corner(round_top_left);
 
-             circle_corner(round_top_right);
 
-         }
 
-     }
 
-     top_center = [0, vesa_height / 2 - vesa_frame_thickness * 4];
 
-     bottom_center = [0, vesa_frame_thickness * 4 - vesa_height / 3];
 
-     module center_shape() {
 
-         hull() {
 
-             translate(top_center) {
 
-                 square(vesa_frame_thickness * 4, center = true);
 
-             }
 
-             translate(bottom_center) {
 
-                 square(vesa_frame_thickness * 4, center = true);
 
-             }
 
-         }
 
-         correct = vesa_frame_thickness * 2;
 
-         bottom_left = [correct + vesa_rounding, vesa_rounding - correct];
 
-         bottom_right = [-bottom_left.x, bottom_left.y];
 
-         top_left = [bottom_left.x, correct - vesa_rounding * 2];
 
-         top_right = [-bottom_left.x, top_left.y];
 
-         translate(bottom_center) {
 
-             difference_circle_corner(bottom_left, 0);  
 
-             difference_circle_corner(bottom_right, 1);  
 
-         }
 
-         translate(top_center) {
 
-             difference_circle_corner(top_left, 3);
 
-             difference_circle_corner(top_right, 2);
 
-         }
 
-     }   
 
-     bottom_y = bottom_center.y - vesa_frame_thickness * 2 - vesa_rounding * 2;
 
-     bottom_left = [vesa_width / 2, bottom_y];
 
-     bottom_right = [-bottom_left.x, bottom_left.y];
 
-     module bottom_shape() {
 
-         hull() {
 
-             circle_corner([bottom_left.x, bottom_left.y + vesa_rounding]);
 
-             circle_corner([bottom_left.x, bottom_left.y - vesa_rounding]);
 
-             
 
-             circle_corner([bottom_right.x, bottom_right.y + vesa_rounding]);
 
-             circle_corner([bottom_right.x, bottom_right.y - vesa_rounding]);
 
-         }
 
-     }
 
-     module base_object() {
 
-         linear_extrude(height = vesa_thickness) {
 
-             top_shape();
 
-             center_shape();
 
-             bottom_shape();
 
-         }
 
-     }
 
-     module corner_regulation() {
 
-         move = [
 
-             0,
 
-             vesa_rounding * 2 - vesa_height / 3,
 
-             vesa_thickness / 2
 
-         ];
 
-         
 
-         translate(move) { 
 
-             rotate([0, 90, 0]) {
 
-                 cylinder(
 
-                     r = vesa_base_screw / 2, 
 
-                     h = vesa_width + vesa_frame_thickness, 
 
-                     center = true
 
-                 );
 
-             }
 
-             
 
-             size = [
 
-                 vesa_thickness,
 
-                 vesa_thickness * 1.5,
 
-                 vesa_thickness
 
-             ];
 
-             position_x = vesa_width / 2
 
-             - vesa_frame_thickness
 
-             + vesa_thickness / 2 / 1.5;
 
-             translate([position_x, 0, 0]) {
 
-                 cube(size, center = true);
 
-             }
 
-             translate([-position_x, 0, 0]) {
 
-                 cube(size, center = true);
 
-             }
 
-         }
 
-     }
 
-     
 
-     render() {
 
-         difference() {
 
-             base_object();
 
-             corner_regulation();
 
-         }
 
-     }
 
-     module monitor_hinge(x) {
 
-         position_z = vesa_thickness - vesa_frame_thickness / 2;
 
-         translate([x, top_left.y + vesa_frame_thickness, position_z]) {
 
-             rotate([0, 90, 180]) {
 
-                 vesa_monitor_hinge();
 
-                 translate([0, vesa_frame_thickness / 2, 0]) {
 
-                     linear_extrude(height = vesa_thickness, center = true) {
 
-                         difference() {
 
-                             circle(r = vesa_frame_thickness / 2);
 
-                             translate([0, -vesa_frame_thickness / 4]) {
 
-                                 size = [
 
-                                     vesa_frame_thickness, 
 
-                                     vesa_frame_thickness / 2
 
-                                 ];
 
-                                 square(size, center = true);
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }   
 
-     }
 
-     module main_hinge(y) {
 
-         translate([0, y, -vesa_frame_thickness]) {
 
-             rotate([90, 0, 0]) {
 
-                 vesa_main_hinge();
 
-             }
 
-         }
 
-     }
 
-     monitor_hinge(top_left.x + vesa_thickness / 3);
 
-     monitor_hinge(top_right.x - vesa_thickness / 3);
 
-     main_hinge(vesa_height / 4 + vesa_frame_thickness);
 
-     main_hinge(-vesa_height / 4 + vesa_frame_thickness);
 
-     if (vesa_width >= 100) {
 
-         main_hinge(vesa_frame_thickness);
 
-     }
 
- }   
 
- module vesa_wall() {
 
-     module base_shape() {
 
-         difference() {
 
-             vesa_rsquare(vesa_wall_width, vesa_wall_height); 
 
-             inside_width = vesa_wall_width - vesa_frame_thickness * 2;
 
-             inside_height = vesa_wall_height - vesa_frame_thickness * (3 + 3);
 
-             
 
-             vesa_rsquare(inside_width, inside_height);
 
-         }
 
-         square([vesa_frame_thickness * 2, vesa_wall_height], center = true);
 
-     }
 
-     module shape() {
 
-         difference() {
 
-             base_shape();
 
-            
 
-             width = vesa_wall_width - vesa_wall_width % wall_holes_space;
 
-             height = vesa_wall_height - vesa_wall_height % wall_holes_space;
 
-             for (count_y = [-height / 2 : wall_holes_space : height / 2]) {
 
-                 for (count_x = [-width / 2 : wall_holes_space : width / 2]) {
 
-                     translate([count_x, count_y]) {
 
-                         circle(r = hook_mounting_hole / 2);
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     module base_object() {
 
-         linear_extrude(height = vesa_thickness) {
 
-             shape();
 
-         }
 
-     }
 
-     module base_hinge(y) {
 
-         translate([0, y, vesa_frame_thickness * 2 + vesa_thickness]) {
 
-             rotate([270, 0, 0]) {
 
-                 vesa_main_hinge();
 
-             }
 
-             
 
-             add_size = [
 
-                 vesa_frame_thickness * 2, 
 
-                 vesa_thickness, 
 
-                 vesa_frame_thickness
 
-             ];
 
-             translate([0, 0, -vesa_frame_thickness * 1.5]) {
 
-                 cube(add_size, center = true);
 
-             }
 
-         }
 
-     }
 
-     module hinge(y) {
 
-         base_hinge(y - vesa_thickness);
 
-         base_hinge(y + vesa_thickness);
 
-     }
 
-     base_object();
 
-     
 
-     hinge(0);
 
-     hinge(-vesa_height / 4);
 
-     hinge(vesa_height / 4);
 
- }
 
- function vesa_corner_regulation_size() = [
 
-     vesa_corner_regulation_space * (vesa_corner_regulation_count - 1),
 
-     vesa_thickness
 
- ];
 
- module vesa_corner_regulation() {
 
-     move_x = vesa_corner_regulation_size().x / 2;
 
-     module base_shape() {
 
-         hull() {
 
-             translate([move_x, 0]) {
 
-                 circle(r = vesa_thickness / 2);
 
-             }
 
-             translate([-move_x, 0]) {
 
-                 circle(r = vesa_thickness / 2);
 
-             }
 
-         }
 
-     }
 
-     module shape() {
 
-         difference() {
 
-             base_shape();
 
-             
 
-             for (count = [-move_x : vesa_corner_regulation_space : move_x]) {
 
-                 translate([count, 0]) {
 
-                     circle(r = vesa_base_screw / 2 + 0.5);
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     linear_extrude(height = vesa_thickness, center = true) {
 
-         shape();
 
-     }
 
- }
 
 
  |