Cixo Develop 11 месяцев назад
Родитель
Сommit
badf7346c9

+ 164 - 0
case/assets/angle.scad

@@ -0,0 +1,164 @@
+include <../config/global.scad>
+include <../config/angle.scad>
+
+function angle_top_holes_space()
+    = angle_holes_space;
+
+function angle_bottom_holes_space()
+    = angle_holes_space + angle_margin * 2;
+
+function angle_width()
+    = max(angle_top_holes_space(), angle_bottom_holes_space())
+    + angle_margin * 2
+    + angle_thickness * 2;
+
+function angle_outside_depth()
+    = angle_depth
+    + angle_thickness;
+
+module angle_cutoff(top = false, only_holes = false) {
+    module holes() {
+        move 
+        = top 
+        ? angle_top_holes_space() / 2 
+        : angle_bottom_holes_space() / 2;
+
+        translate([-move, 0]) {
+            circle(d = angle_hole_diameter);
+        }
+    
+        translate([move, 0]) {
+            circle(d = angle_hole_diameter);
+        }
+    }
+
+    module supports() {
+        move 
+        = angle_width() / 2
+        - angle_thickness / 2;
+
+        translate([-move, 0]) {
+            square([angle_thickness, angle_depth], center = true);   
+        }
+
+        translate([move, 0]) {
+            square([angle_thickness, angle_depth], center = true);   
+        }
+    }
+
+    holes();
+
+    if (!only_holes) {
+        supports();
+    }
+}
+
+module angle_object() {
+    module cross_section(hulled = false) {
+        module corner(move_x = 0, move_y = 0) {
+            translate([move_x, move_y]) {
+                circle(d = angle_thickness);
+            }
+        }
+
+        module base() {
+            move = angle_depth / 2;
+
+            hull() {
+                corner(-move, move);
+                corner(move, move);
+            }
+
+            hull() {
+                corner(-move, move);
+                corner(-move, -move);
+            }
+        }
+
+        if (hulled) {
+            hull() {
+                base();
+            }
+        } else {
+            base ();
+        }
+    }
+
+    module base_object() {
+        module center() {
+            height 
+            = angle_width()
+            - angle_thickness * 2;
+        
+            linear_extrude(height = height, center = true) {
+                cross_section(hulled = false);
+            }
+        }
+
+        module support() {
+            height = angle_thickness;
+
+            linear_extrude(height = height, center = true) {
+                cross_section(hulled = true);
+            }
+        }
+
+        module full() {
+            center();
+
+            move
+            = angle_width() / 2
+            - angle_thickness / 2;
+
+            translate([0, 0, move]) {
+                support();
+            }
+
+            translate([0, 0, -move]) {
+                support();
+            }
+        }
+
+        rotate([270, 0, 90]) {
+            full();
+        }
+    }
+
+    module holes() {
+        height = angle_outside_depth();
+        move = angle_thickness / 2;
+
+        translate([0, move, 0]) {
+            linear_extrude(height = height, center = true) {
+                angle_cutoff(top = true, only_holes = true);
+            }
+        }
+
+        translate([0, 0, move]) {
+            rotate([90, 0, 0]) {
+                linear_extrude(height = height, center = true) {
+                    angle_cutoff(top = false, only_holes = true);
+                }
+            }
+        }
+    }
+
+    color("#AABBCC") {
+        render() {
+            correction_y
+            = angle_outside_depth() / 2
+            - angle_depth / 2;
+
+            correction_z
+            = angle_outside_depth() / 2
+            - angle_depth / 2;
+
+            translate([0, correction_y, correction_z]) {
+                difference() {
+                    base_object();
+                    holes();
+                }
+            }
+        }
+    }
+}

+ 49 - 10
case/assets/top.scad

@@ -1,9 +1,15 @@
 include <ATX.scad>
 include <pattern.scad>
+include <angle.scad>
 include <functions.scad>
 include <../config/global.scad>
 include <../config/top.scad>
 
+function top_size() = [
+    top_motherboard_size.x + top_padding * 2,
+    top_motherboard_size.y + top_padding * 2
+];
+
 module top_shape() {
     padding = top_padding;
     rounding = top_rounding;
@@ -18,8 +24,8 @@ module top_shape() {
     }
 
     module base_shape() {
-        width = motherboard_size.x + padding * 2;
-        height = motherboard_size.y + padding * 2;
+        width = top_size().x;
+        height = top_size().y;
     
         hull() {
             for (count = square_vector(width, height, rounding)) {
@@ -38,18 +44,51 @@ module top_shape() {
         }
     }
 
-    difference() {
-        base_shape();
-        motherboard_holes();
-    
-        if (top_pattern) {
-            pattern(motherboard_size.x, motherboard_size.y);
+    module angles_cuts() {
+        module front_cutoff(move_x = 0) {
+            move_y
+            = motherboard_size.y / 2
+            + plywood_thickness;
+
+            translate([move_x, -move_y]) {
+                angle_cutoff(top = true);
+            }
+        }
+
+        module side_cutoff(left = true, move_y = 0) {
+            move_x
+            = motherboard_size.x / 2
+            + plywood_thickness;
+
+            translate([move_x * (left ? 1 : -1), move_y]) {
+                rotate(90) {
+                    angle_cutoff(top = true);
+                }
+            }
+        }
+        
+        front_cutoff(move_x = 0);
+        side_cutoff(left = true, move_y = 0);
+        side_cutoff(left = false, move_y = 0);
+    }
+
+    render() {
+        difference() {
+            base_shape();
+            motherboard_holes();
+            angles_cuts();
+
+            if (top_pattern) {
+                pattern(motherboard_size.x, motherboard_size.y);
+            }
         }
     }
 }
 
 module top_object() {
-    linear_extrude(center = true, height = plywood_thickness) {
-        top_shape();
+    color("#CCBBAA") {
+        linear_extrude(center = true, height = plywood_thickness) {
+            top_shape();
+        }
     }
 }

+ 5 - 0
case/config/angle.scad

@@ -0,0 +1,5 @@
+angle_depth = 20;
+angle_hole_diameter = 3;
+angle_holes_space = 20;
+angle_margin = 10;
+angle_thickness = 10;

+ 21 - 0
case/make/make.2D.sh

@@ -0,0 +1,21 @@
+#!/bin/bash
+
+MAKE_DIR=$(dirname $(realpath $0))
+PROJECT_DIR=$(dirname $MAKE_DIR)
+MANUFACTURE_DIR=$PROJECT_DIR/manufacture
+BUILD_DIR=$PROJECT_DIR/build.2D
+
+if [ ! -d $BUILD_DIR ]; then
+    mkdir $BUILD_DIR
+else 
+    rm -f $BUILD_DIR/*.dxf
+fi
+
+for count in $MANUFACTURE_DIR/*.2D.scad; do
+    base=$(basename $count .2D.scad)
+    output=$BUILD_DIR/$base.dxf
+
+    echo "Rendering $base..."
+    openscad $count -o $output > /dev/null 2> /dev/null
+done
+

+ 21 - 0
case/make/make.3D.sh

@@ -0,0 +1,21 @@
+#!/bin/bash
+
+MAKE_DIR=$(dirname $(realpath $0))
+PROJECT_DIR=$(dirname $MAKE_DIR)
+MANUFACTURE_DIR=$PROJECT_DIR/manufacture
+BUILD_DIR=$PROJECT_DIR/build.3D
+
+if [ ! -d $BUILD_DIR ]; then
+    mkdir $BUILD_DIR
+else 
+    rm -f $BUILD_DIR/*.stl
+fi
+
+for count in $MANUFACTURE_DIR/*.3D.scad; do
+    base=$(basename $count .3D.scad)
+    output=$BUILD_DIR/$base.stl
+
+    echo "Rendering $base..."
+    openscad $count -o $output > /dev/null 2> /dev/null
+done
+

+ 4 - 0
case/manufacture/angle.3D.scad

@@ -0,0 +1,4 @@
+include <../assets/angle.scad>
+
+$fn = 200;
+angle_object();

+ 4 - 0
case/manufacture/top.2D.scad

@@ -0,0 +1,4 @@
+include <../assets/top.scad>
+
+$fn = 200;
+top_shape();

+ 4 - 0
case/renders/angle.scad

@@ -0,0 +1,4 @@
+include <../assets/angle.scad>
+include <render_options.scad>
+
+angle_object();

+ 49 - 0
case/renders/submission.scad

@@ -0,0 +1,49 @@
+include <render_options.scad>
+include <../assets/top.scad>
+include <../assets/angle.scad>
+
+top_position_z = 0;
+
+module top_mount() {
+    top_object();
+   
+    module side() {
+        move_y = 0;
+        move_z = plywood_thickness / 2;
+        move_x 
+        = top_size().x / 2
+        + plywood_thickness;
+
+        translate([move_x, move_y, -move_z]) {
+            rotate([0, 0, 90]) {
+                angle_object();
+            }
+        }
+    }
+    
+    module front() {
+        move_x = 0;
+        move_z = plywood_thickness / 2;
+        move_y
+        = top_size().y / 2
+        + plywood_thickness;
+
+        translate([move_x, -move_y, -move_z]) {
+            angle_object();
+        }
+    }
+
+    mirror([0, 0, 0]) {
+        side();
+    }
+
+    mirror([1, 0, 0]) {
+        side();
+    }
+
+    front();
+}
+
+translate([0, 0, top_position_z]) {
+    top_mount();
+}