Ver Fonte

Start work on the laptop holder.

cixo há 1 ano atrás
pai
commit
7f4d9c14c3
4 ficheiros alterados com 263 adições e 0 exclusões
  1. 248 0
      assets/laptop_pocket.scad
  2. 1 0
      config/cord.scad
  3. 9 0
      config/laptop_pocket.scad
  4. 5 0
      renders/laptop_pocket.scad

+ 248 - 0
assets/laptop_pocket.scad

@@ -0,0 +1,248 @@
+include <../config/laptop_pocket.scad>
+include <../config/thread.scad>
+include <../config/wall.scad>
+include <../config/cord.scad>
+include <thread.scad>
+
+module laptop_pocket_object() {
+    module back_shape() {
+        handle_height = laptop_pocket_handle_back_height;
+        handle_width = laptop_pocket_handle_width;
+        width = laptop_pocket_width;
+        height = laptop_pocket_height;
+        rounding = laptop_pocket_rounding;
+        
+        module corner(x, y) {
+            translate([x, y]) {
+                circle(r = rounding);   
+            }
+        }
+
+        module handle(reverse = false) {
+            move_left_x = width / 2 - rounding;
+            move_right_x = move_left_x - handle_width + rounding * 2;
+            move_y = handle_height / 2 - rounding;
+
+            hull() {
+                corner(reverse ? move_left_x : -move_left_x, move_y);
+                corner(reverse ? move_right_x : -move_right_x, move_y);
+                corner(reverse ? move_left_x : -move_left_x, -move_y);
+                corner(reverse ? move_right_x : -move_right_x, -move_y);
+            }
+        }
+
+        module center(scale_x = 0, scale_y = 0) {
+            move_x = width / 2 - rounding - scale_x;
+            move_bottom_y = rounding - handle_height / 2 + scale_y;
+            move_top_y = move_bottom_y + height - rounding * 2 - scale_y * 2;
+
+            hull() {
+                corner(move_x, move_top_y);
+                corner(move_x, move_bottom_y);
+                corner(-move_x, move_top_y);
+                corner(-move_x, move_bottom_y);
+            }
+        }
+        
+        module connectors() {
+            rounding = laptop_pocket_rounding;
+
+            module connector(left) {
+                move_x = left ? (-rounding / 2) : (rounding / 2);
+
+                translate([move_x, rounding / 2]) {
+                    difference() {
+                        square(rounding * 2, center = true);
+                        circle(r = rounding);
+                        
+                        translate([0, rounding / 2]) {
+                            square([rounding * 2, rounding], center = true);
+                        }
+
+                        move_x = left ? (-rounding / 2) : (rounding / 2);
+                        
+                        translate([move_x, -rounding / 2]) {
+                            square(rounding, center = true);
+                        }
+                    }
+                }
+            }
+            
+            width = laptop_pocket_width - laptop_pocket_handle_width * 2;
+            height = laptop_pocket_height;
+            handle_height = laptop_pocket_handle_back_height;
+            move_x = width / 2 - rounding / 2;
+            move_y = height - handle_height / 2 + rounding / 2;
+            
+            translate([move_x, move_y]) {
+                connector(true);
+            }
+
+            translate([-move_x, move_y]) {
+                connector(false);
+            }
+        }
+
+        module base_shape() {
+            handle(false);
+            handle(true);
+            center();
+            connectors();
+        }
+
+        module hole_shape() {
+            min_thickness = laptop_pocket_base_thickness * 2 
+            + thread_top_diameter;
+        
+            default_thickness = laptop_pocket_handle_width;
+            thickness = max(min_thickness, default_thickness);
+
+            center(thickness, thickness);
+        }
+
+        render() {
+            difference() {
+                base_shape();
+                hole_shape();
+            }
+        }
+    }
+
+    module front_shape() {
+        rounding = laptop_pocket_rounding;
+        width = laptop_pocket_width;
+        height = laptop_pocket_handle_back_height;
+        front_height = thread_top_diameter + laptop_pocket_base_thickness * 2;
+        move_x = width  / 2 - rounding;
+        move_bottom_y = rounding - height / 2;
+        move_top_y = move_bottom_y + front_height - rounding * 2;
+        
+        module corner(x, y) {
+            translate([x, y]) {
+                circle(r = rounding);   
+            }
+        }
+        
+        hull() {
+            corner(move_x, move_top_y);
+            corner(move_x, move_bottom_y);
+            corner(-move_x, move_top_y);
+            corner(-move_x, move_bottom_y);
+        }
+    }   
+
+    module base_object() {
+        back_thickness = thread_height + laptop_pocket_base_thickness;
+        front_thickness = laptop_pocket_laptop_thickness;
+        thickness = front_thickness + back_thickness;
+        back_center = back_thickness / 2 - thickness / 2;
+        front_center = thickness / 2 - front_thickness / 2;
+
+        translate([0, back_center, 0]) {  
+            rotate([90, 0, 0]) {
+                linear_extrude(height = back_thickness, center = true) {
+                    back_shape();
+                }
+            }
+        }
+
+        translate([0, front_center, 0]) {
+            rotate([90, 0, 0]) {
+                linear_extrude(height = front_thickness, center = true) {
+                    front_shape();
+                }
+            }
+        }
+    }
+
+    module final_object() {
+        module thread(move_x, move_z, front = false) {
+            move_y = thread_height / 2
+            - laptop_pocket_laptop_thickness / 2
+            - thread_height / 2
+            - laptop_pocket_base_thickness / 2;
+
+            translate([move_x, front ? -move_y : move_y, move_z]) {
+                rotate([front ? 90 : 270, 0, 0]) {
+                    thread_object();
+                }
+            }
+        }
+
+        module back_threads() {
+            base_width = laptop_pocket_width - thread_top_diameter;
+            base_height = laptop_pocket_height - thread_top_diameter;
+            width = base_width - base_width % wall_holes_space;
+            height = base_height - base_height % wall_holes_space;
+            move_x = width / 2;
+            move_y = height / 2;
+
+            center_y = laptop_pocket_handle_back_height / 2 
+            - laptop_pocket_height / 2;
+
+            for (count_x = [-move_x : wall_holes_space : move_x]) {
+                for (count_y = [-move_y : wall_holes_space : move_y]) {
+                    thread(count_x, count_y - center_y);
+                }
+            }
+        }
+
+        module front_threads() {
+            move_y = thread_top_diameter / 2
+            - laptop_pocket_handle_back_height / 2
+            + laptop_pocket_base_thickness;
+           
+            base_width = laptop_pocket_width - 
+            thread_top_diameter;
+
+            width = base_width 
+            - base_width % wall_holes_space;
+
+            move_x = width / 2;
+            
+            for (count_x = [-move_x : wall_holes_space : move_x]) {
+                thread(count_x, move_y, true);
+            }
+        }
+
+        module single_cord(move_x) {
+            radius = cord_hole_diameter / 2;
+            height = thread_height + laptop_pocket_base_thickness;
+
+            move_y = height / 2
+            - laptop_pocket_laptop_thickness / 2
+            - height / 2;
+
+            move_z = laptop_pocket_handle_back_height / 2
+            - radius / 2
+            - laptop_pocket_base_thickness * 2;
+
+            translate([move_x, move_y, move_z]) {
+                rotate([90, 0, 0]) {
+                    cylinder(r = radius, h = height, center = true);
+                }
+            }
+        }
+
+        module cords() {
+            move_x = laptop_pocket_width / 2
+            - laptop_pocket_handle_width / 2;
+
+            single_cord(move_x);
+            single_cord(-move_x);
+        }
+
+        color("#37c887") {
+            render() {
+                difference() {
+                    base_object();
+                    back_threads();
+                    front_threads();
+                    cords();
+                }
+            }
+        }
+    }
+
+    final_object();
+}

+ 1 - 0
config/cord.scad

@@ -0,0 +1 @@
+cord_hole_diameter = 3;

+ 9 - 0
config/laptop_pocket.scad

@@ -0,0 +1,9 @@
+laptop_pocket_laptop_thickness = 30;
+laptop_pocket_handle_front_height = 50;
+laptop_pocket_handle_back_height = 150;
+laptop_pocket_handle_back_thickness = 3;
+laptop_pocket_handle_width = 15;
+laptop_pocket_height = 55;
+laptop_pocket_width = 150;
+laptop_pocket_rounding = 5;
+laptop_pocket_base_thickness = 2;

+ 5 - 0
renders/laptop_pocket.scad

@@ -0,0 +1,5 @@
+include <../assets/laptop_pocket.scad>
+
+$fn = 100;
+
+laptop_pocket_object();