Эх сурвалжийг харах

Restart work of the cable holder.

cixo 1 жил өмнө
parent
commit
eb61e74f6f

+ 47 - 61
assets/cable_holder.scad

@@ -3,84 +3,70 @@ include <../config/thread.scad>
 include <../config/wall.scad>
 include <thread.scad>
 
-module cable_holder_shape() {
-    module base_shape() {
-        rounding = cable_holder_height / 2;
-        move_x = cable_holder_width / 2 - rounding;
+module cable_holder_object() {
+    module single_cable_shape() {
+        difference() {
+            outside = cable_holder_thickness * 2 
+            + cable_holder_cable_diameter;
 
-        hull() {
-            translate([-move_x, 0]) {
-                circle(r = rounding);
-            }
+            position = outside / 2
+            - cable_holder_thickness / 2;
 
-            translate([move_x, 0]) {
-                circle(r = rounding);
-            }
-        }
+            circle(r = outside / 2);
+            circle(r = cable_holder_cable_diameter / 2);
 
-        translate([0, rounding / 2]) {
-            square([cable_holder_width, rounding], center = true);
+            translate([0, position]) {
+                square(cable_holder_hole, center = true);
+            }
         }
     }
 
-    module cable_holes() {
-        space = (cable_holder_height - cable_holder_holes_diameter) / 2;
-        spacing = cable_holder_holes_diameter + space;
-        base_width = cable_holder_width - space;
-        width = base_width - base_width % spacing;
-        count_of = round(width / spacing);
+    module single_cable_object() {
+        height = cable_holder_base_thickness;
 
-        for (count = [0 : 1 : count_of - 1]) {
-            move_x = count * spacing - width / 2 + spacing / 2;
-            translate([move_x, 0]) {
-                circle(r = cable_holder_holes_diameter / 2);
+        module base() {
+            linear_extrude(height = height, center = true) {
+                single_cable_shape();
             }
         }
-    }
-    
-    difference() {
-        base_shape();
-        cable_holes();
-    }
-}
+        
+        module blocker() {
+            radius = cable_holder_blocker_diameter / 2;
+            top = cable_holder_base_thickness;
+            
+            height = cable_holder_cable_diameter 
+            + cable_holder_thickness * 2;
 
-module cable_holder_object() {
-    module base_object() {
-        render() { 
-            linear_extrude(height = cable_holder_thickness, center = true) {
-                cable_holder_shape();
-            }   
-        }
-    }
-
-    module thread(move_x) {
-        move_y = cable_holder_height / 2 - thread_height / 2;
-
-        translate([move_x, move_y, 0]) {
-            rotate([90, 0, 0]) {
-                thread_object();
-            }
-        }   
-    }
+            move = cable_holder_cable_diameter / 2
+            - radius;
 
-    module threads() {
-        base_width = cable_holder_width 
-        - cable_holder_width 
-        % wall_holes_space;
+            move_top = top / 2 - radius;
 
-        move_x = base_width / 2;
+            translate([0, move, move_top]) {
+                rotate([0, 270, 0]) {
+                    cylinder(r = radius, h = height, center = true);
+                    translate([radius, 0, 0]) {
+                        rotate([0, 0, 45]) {
+                            size = [
+                                radius * 2, 
+                                radius * 2, 
+                                height
+                            ];
 
-        for (count = [-move_x : wall_holes_space : move_x]) {
-            thread(count);
+                            cube(size, center = true);
+                        }
+                    }
+                }
+            }
         }
-    }
-
-    color("#F56E36") {
+        
         render() {
             difference() {
-                base_object();
-                threads();
+                base();
+                blocker();
             }
         }
     }
+
+    single_cable_object();
 }

+ 5 - 4
config/cable_holder.scad

@@ -1,4 +1,5 @@
-cable_holder_thickness = 10;
-cable_holder_height = 20;
-cable_holder_width = 52.5;
-cable_holder_holes_diameter = 10;
+cable_holder_thickness = 2;
+cable_holder_base_thickness = 10;
+cable_holder_cable_diameter = 8;
+cable_holder_hole = 5;
+cable_holder_blocker_diameter = 2;