Compare commits
2 Commits
flexmount
...
rackmount-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3194e6e19e | ||
|
|
98e19efa60 |
199
models/flexmount/flexmount.scad
Normal file
199
models/flexmount/flexmount.scad
Normal file
@@ -0,0 +1,199 @@
|
||||
// import BOSL2
|
||||
include <BOSL2/std.scad>
|
||||
|
||||
|
||||
|
||||
/* [Hidden] */
|
||||
// constants which shouldn't be changed
|
||||
$fn=100;
|
||||
|
||||
// This is the HomeRacker base unit. don't change this!
|
||||
BASE_UNIT=15; // mm
|
||||
// Standard tolerance for the mount. This is a sane default.
|
||||
TOLERANCE=0.2; // mm
|
||||
// Base strength. This is a sane default.
|
||||
BASE_STRENGTH=2; // mm
|
||||
// Chamfer size. This is a sane default.
|
||||
CHAMFER=1; // mm
|
||||
// Lock Pin side length
|
||||
LOCK_PIN_SIDE=4; // mm
|
||||
// lock pin edge distance
|
||||
LOCK_PIN_EDGE_DISTANCE=5.5; // mm
|
||||
|
||||
/* [Device Measurements] */
|
||||
// Width of the device in mm. Will determine how far apart the actual mounts are in width.
|
||||
device_width=100 // [20:0.1:500]
|
||||
; // TODO test for zero cube
|
||||
// Depth of the device in mm. Will determine how far apart the actual mounts are in depth.
|
||||
device_depth=99; // [54:0.1:400]
|
||||
// Height of the device in mm. Will determine how far apart the actual mounts are in height.
|
||||
device_height=25.5; // [10:0.1:400]
|
||||
|
||||
/* [Bracket] */
|
||||
// Defines the bracket thickness on top of the device.
|
||||
bracket_strength_top=7.5; // [1:0.1:50]
|
||||
// Defines how much the bracket will overlap to the sides of the device.
|
||||
bracket_strength_sides=7.5; // [2:0.1:50]
|
||||
|
||||
// diff_width resembles the gap between the device and the mount. This gap will be filled with a cuboid
|
||||
modulo_width=(BASE_UNIT - ( device_width + TOLERANCE ) % BASE_UNIT);
|
||||
WIDTH_DIFF = modulo_width==15 ? 0 : modulo_width;
|
||||
echo("Diff Width: ", WIDTH_DIFF);
|
||||
mount_gap_filler_start=(device_width+TOLERANCE)/2;
|
||||
// echo("mount_gap_filler_start: ", mount_gap_filler_start);
|
||||
// echo("effective mount distance: ", device_width+WIDTH_DIFF+TOLERANCE);
|
||||
|
||||
|
||||
DEPTH_DIFF=device_depth % BASE_UNIT;
|
||||
echo("Diff Depth: ", DEPTH_DIFF);
|
||||
mount_offset_depth=(device_depth-DEPTH_DIFF-BASE_UNIT)/2;
|
||||
echo("mount_offset_depth*2: ", mount_offset_depth*2);
|
||||
|
||||
/* Code */
|
||||
// creates a bracket around the device with TOLERANCE as additional space and BASE_STRENGTH as the strength of the bracket
|
||||
module bracket(width,depth,height) {
|
||||
// Bracket
|
||||
outer_width=width+BASE_STRENGTH*2+TOLERANCE;
|
||||
outer_depth=depth+BASE_STRENGTH*2+TOLERANCE;
|
||||
outer_height=height+BASE_STRENGTH;
|
||||
inner_width=width-bracket_strength_top*2+TOLERANCE;
|
||||
inner_depth=depth-bracket_strength_top*2+TOLERANCE;
|
||||
bottom_recess_height=height-bracket_strength_sides;
|
||||
|
||||
intersection(){
|
||||
difference() {
|
||||
// Outer
|
||||
cuboid(
|
||||
size=[outer_width,outer_depth,outer_height],
|
||||
anchor=BOTTOM,
|
||||
chamfer=CHAMFER, edges=[TOP,FRONT,BACK,LEFT,RIGHT], except=[BOTTOM]
|
||||
);
|
||||
// Top Skeleton (cut the middle to leave only a bracket to the sides)
|
||||
cuboid(
|
||||
size=[inner_width,inner_depth,outer_height],
|
||||
anchor=BOTTOM,
|
||||
chamfer=-CHAMFER, edges=[TOP]
|
||||
);
|
||||
// Bottom Recess (cut the cube to leave only a top bracket)
|
||||
cuboid(
|
||||
size=[outer_width,outer_depth,bottom_recess_height],
|
||||
anchor=BOTTOM
|
||||
);
|
||||
// Subtract Device to from bracket (cut the device into the bracket)
|
||||
cuboid(
|
||||
size=[width+TOLERANCE,depth+TOLERANCE,height+TOLERANCE/2],
|
||||
anchor=BOTTOM
|
||||
);
|
||||
}
|
||||
// chamfer intersection for the outer bottom chamfer of the bracket
|
||||
translate([0,0,outer_height])
|
||||
cuboid(
|
||||
size=[outer_width,outer_depth,bracket_strength_sides+BASE_STRENGTH-TOLERANCE/2],
|
||||
anchor=TOP,
|
||||
chamfer=CHAMFER, edges=[BOTTOM]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Mount
|
||||
module mount(){
|
||||
depth=BASE_UNIT+BASE_STRENGTH*2+TOLERANCE;
|
||||
gap_filler_width=(WIDTH_DIFF)/2;
|
||||
|
||||
// depth translation
|
||||
translate([0,mount_offset_depth,0])
|
||||
|
||||
union(){
|
||||
|
||||
translate([mount_gap_filler_start,0,0])
|
||||
// Mount
|
||||
union(){
|
||||
top_width=BASE_STRENGTH;
|
||||
bottom_width=BASE_UNIT+gap_filler_width;
|
||||
// Bridge
|
||||
difference(){
|
||||
cuboid_width = bottom_width;
|
||||
cuboid_chamfer = bottom_width;
|
||||
prismoid(
|
||||
size1 = [bottom_width, depth], // Bottom face: width 30, depth 60
|
||||
size2 = [top_width, depth], // Top face: becomes a line segment (width 0)
|
||||
shift = [(-bottom_width+top_width)/2, 0], // Shift top edge center to X=+15 (aligns with right edge of base)
|
||||
chamfer=CHAMFER,
|
||||
h = device_height, // Height
|
||||
//chamfer=CHAMFER/2,
|
||||
anchor = BOTTOM+LEFT // Anchor bottom left
|
||||
);
|
||||
translate([0,0,BASE_STRENGTH])
|
||||
cuboid(
|
||||
size=[cuboid_width,BASE_UNIT,device_height],
|
||||
anchor=BOTTOM+LEFT,
|
||||
chamfer=BASE_UNIT/2, edges=[BOTTOM], except=[RIGHT]
|
||||
);
|
||||
}
|
||||
|
||||
// Depth enforcement
|
||||
depth_enforcement_x = BASE_STRENGTH;
|
||||
depth_enforcemnt_y2 = BASE_UNIT*2;
|
||||
prismoid(
|
||||
size1 = [depth_enforcement_x, depth],
|
||||
size2 = [depth_enforcement_x, depth_enforcemnt_y2],
|
||||
shift = [0, (depth-depth_enforcemnt_y2)/2],
|
||||
h = device_height,
|
||||
chamfer=[CHAMFER,0,0,CHAMFER],
|
||||
anchor = BOTTOM+LEFT
|
||||
);
|
||||
|
||||
// Mount Rail with holes
|
||||
difference(){
|
||||
// Mount Rail
|
||||
difference(){
|
||||
height=BASE_UNIT+TOLERANCE/2;
|
||||
// outer
|
||||
cuboid(
|
||||
size=[bottom_width,depth,height],
|
||||
anchor=TOP+LEFT,
|
||||
chamfer=CHAMFER, edges=[BOTTOM,RIGHT], except=[TOP]
|
||||
);
|
||||
// support recess
|
||||
cuboid(
|
||||
size=[bottom_width,BASE_UNIT+TOLERANCE,height],
|
||||
anchor=TOP+LEFT
|
||||
);
|
||||
}
|
||||
// holes
|
||||
translate([bottom_width-LOCK_PIN_EDGE_DISTANCE,0,-LOCK_PIN_EDGE_DISTANCE-TOLERANCE/2])
|
||||
cuboid(
|
||||
size=[LOCK_PIN_SIDE,depth,LOCK_PIN_SIDE],
|
||||
anchor=TOP+RIGHT
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module mirror_mount_x_plane(){
|
||||
mount();
|
||||
x_mirror_plane = [1,0,0];
|
||||
mirror(x_mirror_plane) {
|
||||
mount();
|
||||
}
|
||||
}
|
||||
|
||||
// Assembly
|
||||
rotate([180,0,0])
|
||||
union() {
|
||||
bracket(device_width,device_depth,device_height);
|
||||
|
||||
// Mount Right
|
||||
mirror_mount_x_plane();
|
||||
|
||||
y_mirror_plane = [0,1,0];
|
||||
mirror(y_mirror_plane) {
|
||||
mirror_mount_x_plane();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
// import BOSL2
|
||||
include <BOSL2/std.scad>
|
||||
|
||||
/* [Hidden] */
|
||||
$fn=100;
|
||||
CAGE_BOLT_DIAMETER=6.5;
|
||||
RACK_BORE_DISTANCE_VERTICAL=15.875;
|
||||
RACK_BORE_DISTANCE_TOP_BOTTOM=6.35;
|
||||
RACK_MOUNT_SURFACE_WIDTH=15.875;
|
||||
RACK_BORE_DISTANCE_HORIZONTAL=RACK_MOUNT_SURFACE_WIDTH/2;
|
||||
RACK_HEIGHT_UNIT=44.5; // mm
|
||||
|
||||
RACK_WIDTH_10_INCH_INNER=222.25; // mm
|
||||
RACK_WIDTH_10_INCH_OUTER=254; // mm
|
||||
RACK_WIDTH_19_INCH=482.6; // mm
|
||||
|
||||
/* [Base] */
|
||||
// automatically chooses the tightest fit for the rackmount ears based on the device width. If true, rack_size will be ignored.
|
||||
autosize=true;
|
||||
// rack size in inches. If autosize is true, this value will be ignored. Only 10 and 19 inch racks are supported.
|
||||
rack_size=10; // [10:10 inch,19:19 inch]
|
||||
// Asymetry Slider. If autosize is true, this value will be ignored. CAUTION: there's no sanity check for this slider!
|
||||
asymetry=100; // [-150:0.1:150]
|
||||
|
||||
// Width of the device in mm. Will determine the width of the rackmount ears depending on rack_size.
|
||||
device_width=201;
|
||||
@@ -38,44 +51,18 @@ device_bore_rows=2;
|
||||
// If true, the device will be aligned to the center of the rackmount ear. Otherwise it will be aligned to the bottom of the rackmount ear.
|
||||
center_device_bore_alignment=false;
|
||||
|
||||
|
||||
/* [CONSTANTS (shouldn't need to be changed)] */
|
||||
CAGE_BOLT_DIAMETER=6.5;
|
||||
/* [Derived] */
|
||||
CHAMFER=min(strength/3,0.5);
|
||||
RACK_BORE_DISTANCE_VERTICAL=15.875;
|
||||
RACK_BORE_DISTANCE_TOP_BOTTOM=6.35;
|
||||
RACK_MOUNT_SURFACE_WIDTH=15.875;
|
||||
RACK_BORE_DISTANCE_HORIZONTAL=RACK_MOUNT_SURFACE_WIDTH/2;
|
||||
RACK_BORE_WIDTH=RACK_MOUNT_SURFACE_WIDTH-2*max(strength,2);
|
||||
RACK_HEIGHT_UNIT=44.5; // mm
|
||||
RACK_HEIGHT_UNIT_COUNT=max(1,ceil(device_height/RACK_HEIGHT_UNIT));
|
||||
RACK_HEIGHT=RACK_HEIGHT_UNIT_COUNT*RACK_HEIGHT_UNIT; // actual height calculated by height unit size x number of units
|
||||
RACK_BORE_COUNT=RACK_HEIGHT_UNIT_COUNT*3; // 3 holes for each units
|
||||
RACK_WIDTH_10_INCH_INNER=222.25; // mm
|
||||
RACK_WIDTH_10_INCH_OUTER=254; // mm
|
||||
RACK_WIDTH_19_INCH=482.6; // mm
|
||||
|
||||
// Base assertions
|
||||
module validate_params() {
|
||||
valid_rack_sizes=[10,19];
|
||||
if(autosize == false){
|
||||
assert(rack_size == 10 || rack_size == 19, "Invalid rack_size. Only 10 and 19 inch racks are supported. Choose a valid one or set autosize to true.");
|
||||
}
|
||||
}
|
||||
|
||||
validate_params();
|
||||
|
||||
// Debug
|
||||
echo("Height: ", RACK_HEIGHT);
|
||||
echo("Rack Bore Count: ", RACK_BORE_COUNT);
|
||||
|
||||
// Calculate the width of the ear
|
||||
function get_ear_width(device_width) =
|
||||
device_width > RACK_WIDTH_10_INCH_INNER || autosize == false && rack_size == 19 ?
|
||||
(RACK_WIDTH_19_INCH - device_width) / 2 :
|
||||
(RACK_WIDTH_10_INCH_OUTER - device_width) / 2
|
||||
;
|
||||
rack_ear_width = get_ear_width(device_width);
|
||||
|
||||
|
||||
function get_bore_depth(device_bore_margin_horizontal,device_bore_columns) =
|
||||
(device_bore_columns - 1) * device_bore_margin_horizontal
|
||||
@@ -92,7 +79,7 @@ device_screw_alignment = [strength,depth/2,device_screw_alignment_vertical];
|
||||
module base_ear(width,strength,height) {
|
||||
union() {
|
||||
// Front face
|
||||
cuboid([rack_ear_width,strength,height],anchor=LEFT+BOTTOM+FRONT,chamfer=CHAMFER);
|
||||
cuboid([width,strength,height],anchor=LEFT+BOTTOM+FRONT,chamfer=CHAMFER);
|
||||
// Side face
|
||||
cuboid([strength,depth,height],anchor=LEFT+BOTTOM+FRONT,chamfer=CHAMFER);
|
||||
}
|
||||
@@ -110,10 +97,18 @@ module screws_countersunk(length, diameter_head, length_head, diameter_shaft) {
|
||||
|
||||
|
||||
// Assemble the rackmount ear
|
||||
module rackmount_ear(asym=0){
|
||||
ear_width_19_inch=(RACK_WIDTH_19_INCH - device_width) / 2 + asym;
|
||||
ear_width_10_inch=(RACK_WIDTH_10_INCH_OUTER - device_width) / 2 + asym;
|
||||
// Calculate the width of the ear
|
||||
rack_ear_width = device_width > RACK_WIDTH_10_INCH_INNER || autosize == false && rack_size == 19 ?
|
||||
ear_width_19_inch:
|
||||
ear_width_10_inch
|
||||
;
|
||||
difference() {
|
||||
difference() {
|
||||
// Create the base of the ear
|
||||
base_ear(device_width,strength,RACK_HEIGHT);
|
||||
base_ear(rack_ear_width,strength,RACK_HEIGHT);
|
||||
// Create the holes for the device screws
|
||||
screws_countersunk(length=strength,diameter_head=device_bore_hole_head_diameter,length_head=device_bore_hole_head_length,diameter_shaft=device_bore_hole_diameter);
|
||||
}
|
||||
@@ -122,3 +117,13 @@ difference() {
|
||||
zcopies(spacing=RACK_BORE_DISTANCE_VERTICAL,n=3,sp=[rack_ear_width-RACK_BORE_DISTANCE_HORIZONTAL,0,RACK_BORE_DISTANCE_TOP_BOTTOM])
|
||||
cuboid([RACK_BORE_WIDTH,strength+1,CAGE_BOLT_DIAMETER], rounding=CAGE_BOLT_DIAMETER/2, edges=[TOP+LEFT,TOP+RIGHT,BOTTOM+LEFT,BOTTOM+RIGHT], anchor=FRONT);
|
||||
}
|
||||
}
|
||||
|
||||
// Place the ears
|
||||
rackmount_ear(asymetry);
|
||||
|
||||
x_mirror_plane = [1,0,0];
|
||||
translate([-device_width,0,0])
|
||||
mirror(x_mirror_plane){
|
||||
rackmount_ear(-asymetry);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user