Procházet zdrojové kódy

Add connector between flat case elements.

Cixo Develop před 11 měsíci
rodič
revize
925e94139b
4 změnil soubory, kde provedl 120 přidání a 2 odebrání
  1. 102 0
      assets/connector.scad
  2. 5 2
      assets/plate.scad
  3. 9 0
      config/connector.scad
  4. 4 0
      renders/connector.scad

+ 102 - 0
assets/connector.scad

@@ -0,0 +1,102 @@
+include <../config/connector.scad>
+include <../config/plate.scad>
+include <ATX.scad>
+
+function connector_holes_pattern() = [
+    [connector_mount_width / 2, connector_mount_height / 2],
+    [connector_mount_width / 2, -connector_mount_height / 2],
+    [0, connector_mount_height / 2],
+    [0, -connector_mount_height / 2],
+    [-connector_mount_width / 2, connector_mount_height / 2],
+    [-connector_mount_width / 2, -connector_mount_height / 2],
+];
+
+module connector_object() {
+    depth = connector_depth;
+    height = connector_height;
+    rounding = connector_rounding;
+    thickness = connector_thickness;
+    rods = connector_rods;
+    hole = connector_hole;
+    screwdriver_hole = connector_screwdriver_hole;
+
+    module cross_shape(scaled = false, cut = true) {
+        module corner(x = 0, y = 0) {
+            translate([x, y]) {
+                circle(r = rounding);
+            }
+        }
+
+        move_x = depth / 2 - rounding;
+        move_y = height / 2 - rounding;
+   
+        if (!scaled) {
+            difference() {
+                hull() {
+                    corner(move_x, move_y);
+                    corner(-move_x, move_y);
+                    corner(-move_x, -move_y);
+                }
+                
+                if (cut) {
+                    cross_shape(scaled = true);
+                }
+            } 
+        } else {
+            scaled_x = (move_x - rods) / move_x;
+            scaled_y = (move_y - rods) / move_y;
+
+            scale([scaled_x, scaled_y]) {
+                x_change = move_x - move_x * scaled_x;
+                y_change = move_y - move_y * scaled_y;
+
+                translate([-x_change / 2, y_change / 2])
+                    cross_shape(scaled = false, cut = false);
+            }
+        }
+    }
+
+    module base_object() {
+        rotate([90, 0, 0]) {
+            linear_extrude(height = thickness, center = true) {
+                cross_shape();
+            }
+        }
+    }
+   
+    module top_holes(size = height) {
+        for (count = connector_holes_pattern()) {
+            translate([count.x, count.y, 0]) {
+                cylinder(h = size, r = hole / 2, center = true);
+                
+                translate([0, 0, -rods]) {
+                    cylinder(
+                        h = size, 
+                        r = screwdriver_hole / 2, 
+                        center = true
+                    );
+                }
+            }
+        }
+    }
+
+    module side_holes() {
+        rotate([0, 90, 180]) {
+            top_holes(size = depth);
+        }
+    }
+
+    module final_object() {
+        difference() {
+            base_object();
+            top_holes();
+            side_holes();
+        }
+    }
+
+    color("#222222") {
+        render() {
+            final_object();
+        }
+    }
+}

+ 5 - 2
assets/plate.scad

@@ -1,7 +1,10 @@
 include <../config/plate.scad>
 include <ATX.scad>
+include <connector.scad>
 
-function plate_mount_holes_pattern() = [
+function plate_mount_holes_pattern() = connector_holes_pattern();
+
+/*function plate_mount_holes_pattern() = [
     [
         -plate_mount_width / 2 + plate_mount_rounding, 
         plate_mount_depth / 2 - plate_mount_rounding - plate_mount_small
@@ -26,7 +29,7 @@ function plate_mount_holes_pattern() = [
         plate_mount_width / 2 - plate_mount_rounding, 
         -plate_mount_depth / 2 + plate_mount_rounding
     ]
-];
+];*/
 
 module plate_shape() {
     size = plate_size;

+ 9 - 0
config/connector.scad

@@ -0,0 +1,9 @@
+connector_rounding = 5;
+connector_depth = 80;
+connector_thickness = 70;
+connector_height = 70;
+connector_rods = 5;
+connector_mount_width = 50;
+connector_mount_height = 42;
+connector_hole = 3;
+connector_screwdriver_hole = 6;

+ 4 - 0
renders/connector.scad

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