Last active
January 18, 2025 00:16
-
-
Save Pandapip1/1783392fdb66d0c6f40e9e0c5d91468e to your computer and use it in GitHub Desktop.
ATX Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $fn=200; | |
| $fs=0.01; | |
| epsilon = 0.1; | |
| // https://danielupshaw.com/openscad-rounded-corners/ | |
| module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") { | |
| // If single value, convert to [x, y, z] vector | |
| size = (size[0] == undef) ? [size, size, size] : size; | |
| translate_min = radius; | |
| translate_xmax = size[0] - radius; | |
| translate_ymax = size[1] - radius; | |
| translate_zmax = size[2] - radius; | |
| diameter = radius * 2; | |
| module build_point(type = "sphere", rotate = [0, 0, 0]) { | |
| if (type == "sphere") { | |
| sphere(r = radius); | |
| } else if (type == "cylinder") { | |
| rotate(a = rotate) | |
| cylinder(h = diameter, r = radius, center = true); | |
| } | |
| } | |
| obj_translate = (center == false) ? | |
| [0, 0, 0] : [ | |
| -(size[0] / 2), | |
| -(size[1] / 2), | |
| -(size[2] / 2) | |
| ]; | |
| translate(v = obj_translate) { | |
| hull() { | |
| for (translate_x = [translate_min, translate_xmax]) { | |
| x_at = (translate_x == translate_min) ? "min" : "max"; | |
| for (translate_y = [translate_min, translate_ymax]) { | |
| y_at = (translate_y == translate_min) ? "min" : "max"; | |
| for (translate_z = [translate_min, translate_zmax]) { | |
| z_at = (translate_z == translate_min) ? "min" : "max"; | |
| translate(v = [translate_x, translate_y, translate_z]) | |
| if ( | |
| (apply_to == "all") || | |
| (apply_to == "xmin" && x_at == "min") || (apply_to == "xmax" && x_at == "max") || | |
| (apply_to == "ymin" && y_at == "min") || (apply_to == "ymax" && y_at == "max") || | |
| (apply_to == "zmin" && z_at == "min") || (apply_to == "zmax" && z_at == "max") | |
| ) { | |
| build_point("sphere"); | |
| } else { | |
| rotate = | |
| (apply_to == "xmin" || apply_to == "xmax" || apply_to == "x") ? [0, 90, 0] : ( | |
| (apply_to == "ymin" || apply_to == "ymax" || apply_to == "y") ? [90, 90, 0] : | |
| [0, 0, 0] | |
| ); | |
| build_point("cylinder", rotate); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| module mobo_standoff() { | |
| difference() { | |
| cylinder(h = 7, r = 3.9 / 2 + 1.6); | |
| cylinder(h = 7 + epsilon, r = 3.9 / 2); | |
| } | |
| } | |
| module atx_standoffs() { | |
| // translate([0, -243.84, -3]) cube([304.8, 243.84, 3]); | |
| translate([16.51, -10.16, 0]) mobo_standoff(); | |
| translate([16.51, -165.1, 0]) mobo_standoff(); | |
| translate([16.51, -237.49, 0]) mobo_standoff(); | |
| translate([95.25, -10.16, 0]) mobo_standoff(); | |
| translate([147.32, -10.16, 0]) mobo_standoff(); | |
| translate([147.32, -165.1, 0]) mobo_standoff(); | |
| translate([147.32, -237.49, 0]) mobo_standoff(); | |
| translate([298.45, -33.02, 0]) mobo_standoff(); | |
| translate([298.45, -165.1, 0]) mobo_standoff(); | |
| translate([298.45, -237.49, 0]) mobo_standoff(); | |
| } | |
| // Dimensions to fit it in | |
| #cube([485, 508, 177.8]); | |
| translate([32, 0, 0]) cube([422, 508, 10]); | |
| difference() { | |
| cube([484, 10, 177.8]); | |
| // Rackmount screw holes | |
| translate([8, 6.35, 0]) roundedcube(size = [4.76 * 2, 15, 100], radius = 4.76, center = true); | |
| } | |
| atx_standoffs(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment