scad/mason jar holder.scad

99 lines
2.6 KiB
OpenSCAD

Mouth_type = "wide"; // ["wide", "regular"]
Holder_type = "lid"; // ["lid", "ring"]
Holder_height = 177.0; // 0.1
Holder_base_depth = 2.0; // 0.1
Holder_stake_width = 3.0; // 0.1
/* [Mouth Settings] */
wide_mouth_ring_od = 88.9; // 3.5"
wide_mouth_ring_id = 69.85; // 2.75"
wide_mouth_ring_height = 16.0;
wide_mouth_lid_diameter = 86.0; // ~3 3/8"
wide_mouth_lid_depth = 2.5; // ish
wide_mouth_base_diameter = 94.0; // 0.1
regular_mouth_ring_od = 73.03; // 2 7/8"
regular_mouth_ring_id = 57.15; // 2 1/4"
regular_mouth_ring_height = 14.0;
regular_mouth_lid_diameter = 69.0; // 2 5/8"
regular_mouth_lid_depth = 2.5; // ish
regular_mouth_base_diameter = 76.0; // 0.1
custom_mouth_ring_od = 0; // 0.01
custom_mouth_ring_id = 0; // 0.01
custom_mouth_ring_height = 0; // 0.01
custom_mouth_lid_diameter = 0; // 0.01
custom_mouth_base_diameter = 0; // 0.01
/* [OpenSCAD Settings] */
$fn = 120.0; // 0.1
module base() {
difference() {
cylinder(h = Holder_base_depth, d = base_diameter);
}
}
module stake(width, depth, height) {
// @TODO: Calculate the offsets
height_offset = 30;
width_offset = 8;
difference() {
cube([width, depth, height]);
translate([width/2, depth+0.5, height/2]) {
rotate([90, 0, 0]) {
#hull() {
translate([0, -height/2 + height_offset, 0]) {
cylinder(h = depth+1, r= width/2 - width_offset);
}
translate([0, height/2 - height_offset, 0]) {
cylinder(h = depth+1, r = width/2 - width_offset);
}
}
}
}
}
}
module ring_holder() {
height = Holder_height - Holder_base_depth;
depth = Holder_stake_width;
width = (Mouth_type == "wide" ? wide_mouth_ring_id : regular_mouth_ring_id) / 2.0 - 1.0;
union() {
cylinder(height, r=depth);
// @TODO: Translate a bit to center the stakes
for (angle = [0, 120, 240]) {
rotate(angle, [0,0,1]) {
stake(width, depth, height);
}
}
}
}
module lid_holder() {
height = Holder_height - Holder_base_depth;
depth = Holder_stake_width;
width = (Mouth_type == "wide" ? wide_mouth_lid_diameter : regular_mouth_lid_diameter) + 1.0;
difference() {
cylinder(h=height, d = width + depth*2);
cylinder(h=height, d = width);
translate([-depth*2, -depth*2, 0]) {
#cube([width, width, height]);
}
}
}
base_diameter = Mouth_type == "wide" ? wide_mouth_base_diameter : regular_mouth_base_diameter;
union() {
translate([0, 0, -Holder_base_depth]) {
base();
}
if (Holder_type == "ring") {
ring_holder();
}
if (Holder_type == "lid") {
lid_holder();
}
};