Ver Fonte

Final headphones holder.

cixo há 9 meses atrás
pai
commit
84f8596586

+ 45 - 0
assets/angle_connector.scad

@@ -0,0 +1,45 @@
+include <../config/angle_connector.scad>
+
+module angle_connector_base_shape() {
+    rounding = angle_rounding;
+    width = angle_connector_depth;
+    height = angle_connector_height;
+    margin = angle_connector_thickness;
+
+    module shape(width, height) {
+        move_x = width / 2;
+        move_y = height / 2;
+
+        hull() {
+            translate([-move_x + rounding, move_y - rounding]) {
+                circle(r = rounding);
+            }
+
+            translate([-move_x + rounding, -move_y + rounding]) {
+                circle(r = rounding);
+            }
+
+            translate([move_x - rounding, move_y - rounding]) {
+                circle(r = rounding);
+            }
+        }
+    }
+
+    difference() {
+        shape(width, height);
+        x = 20 * sqrt(2);
+        translate([-x / 2, x / 2]) {
+            shape(width - margin * 2 - x, height - margin * 2 - x);
+        }
+    }
+}
+
+module angle_connector_base_object() {
+    linear_extrude(height = angle_connector_width, center = true) {
+        angle_connector_base_shape();
+    }
+}
+
+module angle_connector_object() {
+    angle_connector_base_object();
+}

+ 44 - 58
assets/connector.scad

@@ -1,86 +1,72 @@
+include <functions.scad>
 include <../config/connector.scad>
 
+function connector_size() = [
+    
+];
+
 module connector_shape() {
-    rounding = connector_depth / 2;
-    move = connector_width - rounding * 2;
+    hole = connector_hole;
+    holes = connector_holes;
     width = connector_width;
+    rounding = connector_rounding;
+    holes_space = width / (holes.x + 1);
+    height = holes_space * (holes.y + 1);
 
-    module base_shape(split = false) {
-        if (!split) {
-            hull() {
-                circle(r = rounding);
-
-                translate([move, 0]) {
-                    circle(r = rounding);
-                }
-            }
-        } else {
-            translate([-move, 0]) {
-                base_shape(split = false);
-            }
-        }
-    }
-
-    module holes(split = false) {
-        if (!split) {
-            space_y = rounding * 2 / (connector_holes_in_y + 1);
-            space_x = move / (connector_holes_in_x - 1);
+    module single_side() {
+        module holes() {
+            for (count_x = [-width / 2 : holes_space : width / 2]) {
+                for (count_y = [-height / 2 : holes_space : height / 2]) {
+                    side_x = abs(count_x) == width / 2;
+                    side_y = abs(count_y) == height / 2;
 
-            for (count_y = [-rounding : space_y : rounding]) {
-                if (count_y != rounding && count_y != -rounding) {
-                    for (count_x = [0 : space_x : move]) {
+                    if (!side_x && !side_y) {
                         translate([count_x, count_y]) {
-                            circle(r = connector_hole / 2);
+                            circle(d = hole);           
                         }
                     }
                 }
             }
-        } else {
-            translate([-move, 0]) {
-                holes(split = false);
+        }
+
+        module base() {
+            hull() {
+                for (count = square_corners(width, height, rounding)) {
+                    corner(count, rounding, count.y < 0);
+                }
             }
         }
-    }
 
-    module final_shape(split = false) {
         difference() {
-            base_shape(split);
-            holes(split);
+            base();
+            holes();
         }
     }
 
-    module final_solid() {
-        render() {
-            hull() {
-                base_shape(split = false);
-
-                if (connector_dual) {
-                    base_shape(split = true);
-                }
-
-                rotate(180 - connector_angle) {
-                    final_shape(split = true);
-                }
+    module center_side() {
+        hull() {
+            for (count = square_corners(width, width, rounding)) {
+                corner(count, rounding, count.y > 0 || count.x < 0);
             }
         }
     }
 
-    module final_holes() {
-        holes(split = false);
-
-        if (connector_dual) {
-            holes(split = true);
-        }
-
-        rotate(180 - connector_angle) {
-            holes(split = true);
+    module rotated(count) {
+        rotate(count) {
+            translate([0, height / 2 + width / 2]) {
+                single_side();
+            }
         }
     }
 
-    render() {
-        difference() {
-            final_solid();
-            final_holes();
+    move_x = -width / 2;
+    move_y = width / 2;
+
+    translate([move_x, move_y]) {
+        render() {
+            rotated(0);
+            rotated(90);
+            center_side();
         }
     }
 }

+ 16 - 0
assets/functions.scad

@@ -0,0 +1,16 @@
+function square_corners(width, height, rounding = 0) = [
+    [width / 2 - rounding, height / 2 - rounding],
+    [-width / 2 + rounding, height / 2 - rounding],
+    [width / 2 - rounding, -height / 2 + rounding],
+    [-width / 2 + rounding, -height / 2 + rounding],
+];
+
+module corner(vector = [0, 0], rounding = 0, squared = false) {
+    translate(vector) {
+        if (squared) {
+            square([rounding * 2, rounding * 2], center = true);
+        } else {
+            circle(r = rounding);
+        }
+    }
+}

+ 152 - 0
assets/headphones_holder.scad

@@ -1,7 +1,159 @@
 include <../config/headphones_holder.scad>
 
+module headphones_holder_hanger_object() {
+    height = headphones_holder_height;
+    depth = headphones_holder_depth;
+    leg_depth = headphones_holder_leg_depth;
+    leg_width = headphones_holder_leg_width;
+    leg_thickness = headphones_holder_leg_thickness;
+    blocker_size = headphones_hanger_blocker_size;
+
+    module hanger() {
+        module main() {
+            size = [
+                blocker_size,
+                leg_depth * 1.5,
+                blocker_size
+            ];
+
+            cube(size, center = true);
+        }
+
+        module headphones() {
+            size = [
+                blocker_size,
+                blocker_size * 2,
+                blocker_size / 2
+            ];
+            
+            translate([0, 0, blocker_size / 4]) {
+                cube(size, center = true);
+            }
+        }
+
+        render() {
+            difference() {
+                main();
+                headphones();
+            }
+        }
+    }
+
+    hanger();
+}
+
+module headphones_holder_leg_object() {
+    height = headphones_holder_height;
+    depth = headphones_holder_depth;
+    leg_depth = headphones_holder_leg_depth;
+    leg_width = headphones_holder_leg_width;
+    leg_thickness = headphones_holder_leg_thickness;
+    blocker_size = headphones_hanger_blocker_size;
+
+    module legs_shape() {
+        module single_leg(splited = false) {
+            module point(x, y, squared = false) {
+                translate([x, y]) {
+                    if (squared) {
+                        square(leg_width, center = true);
+                    } else {
+                        circle(r = leg_width / 2);
+                    }
+                }
+            }
+
+            move_x = leg_depth / 2 - leg_width / 2;
+            move_y = leg_depth / 2 - leg_width / 2;
+            
+            union() {
+                hull() {
+                    point(-move_x, move_y, squared = !splited);
+                    point(move_x, move_y, squared = splited);
+                }
+
+                hull() {
+                    if (splited) {
+                        point(-move_x, move_y, squared = false);
+                        point(-move_x, -move_y, squared = false);
+                    } else {
+                        point(move_x, move_y, squared = false);
+                        point(move_x, -move_y, squared = false);
+                    }
+                }
+            }
+        }
+
+        translate([-leg_depth / 2, 0]) {
+            single_leg(splited = true);
+        }
+
+        translate([leg_depth / 2, 0]) {
+            single_leg();
+        }
+    }
+
+    module legs_object() {
+        linear_extrude(height = leg_thickness, center = false) {
+            legs_shape();
+        }
+    }
+
+    module frame_object() {
+        precission = 1 / $fn;
+
+        module end_shape(x, y, z, top = false) {
+            translate([x, y, z - precission * (top ? 1 : -1)]) {
+                width = leg_width * (top ? 1 : 2);
+                depth = leg_width;
+                height = precission;
+
+                cube([width, depth, height], center = true);
+            }
+        }
+
+        move_y_bottom = leg_depth / 2 - leg_width / 2;
+        move_y_top = move_y_bottom + depth;
+
+        hull() {
+            end_shape(0, move_y_bottom, 0, top = false);
+            end_shape(0, move_y_top, height + depth, top = true);
+        }
+
+        hull() {
+            end_shape(0, move_y_top, height + depth, top = true);
+            end_shape(0, move_y_top, height + depth + blocker_size, top = true);
+        }
+    }
+
+    legs_object();
+    
+    translate([0, 0, leg_thickness]) {
+        frame_object();
+    }
+}
+
 module headphones_holder_object() {
     height = headphones_holder_height;
     depth = headphones_holder_depth;
     leg_depth = headphones_holder_leg_depth;
+    leg_width = headphones_holder_leg_width;
+    leg_thickness = headphones_holder_leg_thickness;
+    blocker_size = headphones_hanger_blocker_size;
+
+
+    color("#444444") {
+        render() {
+            headphones_holder_leg_object();
+        }
+    }
+
+    hanger_z = leg_thickness + height + depth + blocker_size / 2;
+
+    color("#999999") {
+        render() {
+            translate([0, 0, hanger_z]) {
+                headphones_holder_hanger_object();
+            }
+        }
+    }
 }

+ 5 - 0
config/angle_connector.scad

@@ -0,0 +1,5 @@
+angle_connector_width = 50;
+angle_connector_depth = 120;
+angle_connector_height = 120;
+angle_rounding = 10;
+angle_connector_thickness = 20;

+ 3 - 5
config/connector.scad

@@ -1,8 +1,6 @@
 connector_angle = 90;
 connector_hole = 3;
-connector_holes_in_x = 5;
-connector_holes_in_y = 2;
-connector_width = 150;
-connector_depth = 40;
+connector_holes = [2, 5];
+connector_width = 30;
 connector_thickness = 3;
-connector_dual = true;
+connector_rounding = 5;

+ 4 - 1
config/headphones_holder.scad

@@ -1,3 +1,6 @@
 headphones_holder_height = 150;
 headphones_holder_depth = 30;
-headphones_holder_leg_depth = 50;
+headphones_holder_leg_depth = 70;
+headphones_holder_leg_width = 20;
+headphones_holder_leg_thickness = 20;
+headphones_hanger_blocker_size = 30;

+ 4 - 0
manufacture/headphones_holder_hanger.3D.scad

@@ -0,0 +1,4 @@
+include <../assets/headphones_holder.scad>
+
+$fn = 100;
+headphones_holder_hanger_object();

+ 4 - 0
manufacture/headphones_holder_leg.3D.scad

@@ -0,0 +1,4 @@
+include <../assets/headphones_holder.scad>
+
+$fn = 100;
+headphones_holder_leg_object();

+ 4 - 0
renders/angle_connector.scad

@@ -0,0 +1,4 @@
+include <../assets/angle_connector.scad>
+
+$fn = 100;
+angle_connector_object();