| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- include <../config/plate.scad>
- include <ATX.scad>
- include <connector.scad>
- 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
- ],
- [
- -plate_mount_width / 2 + plate_mount_rounding,
- -plate_mount_depth / 2 + plate_mount_rounding + plate_mount_small
- ],
- [
- 0,
- plate_mount_depth / 2 - plate_mount_rounding - plate_mount_small / 2
- ],
- [
- 0,
- -plate_mount_depth / 2 + plate_mount_rounding + plate_mount_small / 2
- ],
- [
- plate_mount_width / 2 - plate_mount_rounding,
- plate_mount_depth / 2 - plate_mount_rounding
- ],
- [
- plate_mount_width / 2 - plate_mount_rounding,
- -plate_mount_depth / 2 + plate_mount_rounding
- ]
- ];*/
- module plate_shape() {
- size = plate_size;
- holes = plate_holes;
- padding = plate_padding;
- hole = plate_hole;
- module corner(x = 0, y = 0) {
- translate([x, y]) {
- circle(r = padding);
- }
- }
- module board_mount_hole(hole = [0, 0]) {
- translate(hole) {
- circle(r = hole / 2);
- }
- }
- module base_shape() {
- hull() {
- move_x = size[0] / 2;
- move_y = size[1] / 2;
- corner(move_x, move_y);
- corner(-move_x, move_y);
- corner(move_x, -move_y);
- corner(-move_x, -move_y);
- }
- }
- module shape_with_mobo_mount() {
- difference() {
- base_shape();
-
- for (hole = holes) {
- board_mount_hole(hole);
- }
- }
- }
- module mount_shape(position = [0, 0], mirrored = false, scaled = false) {
- if (mirrored) {
- mirror([1, 0]) {
- mount_shape(mirrored = false);
- }
- } else {
-
- width = plate_mount_width;
- depth = plate_mount_depth;
- small = plate_mount_small;
- rounding = plate_mount_rounding;
- hole_scale = plate_mount_hole_scale;
- hole = plate_mount_hole;
- move_x = width / 2 - rounding;
- move_y_big = depth / 2 - rounding;
- move_y_small = move_y_big - small;
- translate(position) {
- difference() {
- hull() {
- translate([move_x, move_y_big]) {
- circle(r = rounding);
- }
- translate([move_x, -move_y_big]) {
- circle(r = rounding);
- }
- translate([-move_x, move_y_small]) {
- circle(r = rounding);
- }
- translate([-move_x, -move_y_small]) {
- circle(r = rounding);
- }
- }
-
- if (!scaled) {
- scale(hole_scale) {
- mount_shape(scaled = true);
- }
- for (count = plate_mount_holes_pattern()) {
- translate(count) {
- circle(r = hole / 2);
- }
- }
- }
- }
- }
- }
- }
- mount_move_x
- = plate_mount_width / 2
- + plate_size.x / 2
- + plate_padding;
- shape_with_mobo_mount();
-
- translate([mount_move_x, 0]) {
- mount_shape(mirrored = true);
- }
-
- translate([-mount_move_x, 0]) {
- mount_shape(mirrored = false);
- }
- }
- module plate_object() {
- linear_extrude(height = plate_thickness, center = true) {
- plate_shape();
- }
- }
|