411 REFERENCE · Wikibooks
OpenSCAD Tutorial/Printable version
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
// ===============================
// SECRET SLIDING LID LOCK BOX
// PLA – Bambu Lab A1
// ===============================
// -------- PARAMETERS --------
box_len = 120;
box_wid = 80;
box_hgt = 50;
wall = 3;
bottom = 4;
rail_h = 6;
rail_t = 2.5;
rail_offset = 3;
lid_t = 4;
lid_clear = 0.25;
pin_w = 7.5;
pin_h = 9.5;
pin_l = 12;
spring_len = 25;
spring_w = 10;
spring_t = 1.8;
spring_angle = 18;
false_bottom_t = 2;
press_d = 12;
// -------- TOGGLE PARTS --------
SHOW_BOX = true;
SHOW_LID = true;
SHOW_PIN = true;
SHOW_SPRING = true;
SHOW_FALSE_BOTTOM = true;
// ===============================
// BOX BODY
// ===============================
module box_body() {
difference() {
cube([box_len, box_wid, box_hgt]);
translate([wall, wall, bottom])
cube([
box_len - 2*wall,
box_wid - 2*wall,
box_hgt
]);
}
// Rails
translate([0, wall, box_hgt - rail_offset - rail_h])
cube([box_len, rail_t, rail_h]);
translate([0, box_wid - wall - rail_t, box_hgt - rail_offset - rail_h])
cube([box_len, rail_t, rail_h]);
// Latch pin channel
translate([
box_len - wall - pin_l,
box_wid/2 - pin_w/2,
bottom + 12
])
cube([pin_l + 1, pin_w + 0.5, pin_h + 0.5]);
}
// ===============================
// SLIDING LID
// ===============================
module lid() {
difference() {
cube([
box_len - 1.5,
box_wid - 1.5,
lid_t
]);
// Pin slot
translate([
box_len/2 - 7,
box_wid/2 - 4,
lid_t - 2.5
])
cube([14, 8, 3]);
}
}
// ===============================
// LATCH PIN
// ===============================
module latch_pin() {
cube([pin_l, pin_w, pin_h]);
}
// ===============================
// SPRING TAB
// ===============================
module spring_tab() {
rotate([0, spring_angle, 0])
cube([spring_len, spring_w, spring_t]);
}
// ===============================
// FALSE BOTTOM
// ===============================
module false_bottom() {
difference() {
cube([
box_len - 2*wall - 2,
box_wid - 2*wall - 2,
false_bottom_t
]);
// Thin press area
translate([
(box_len - 2*wall)/2 - press_d/2,
(box_wid - 2*wall)/2 - press_d/2,
0
])
cylinder(h=false_bottom_t, d=press_d);
}
}
// ===============================
// ASSEMBLY VIEW
// ===============================
if (SHOW_BOX)
box_body();
if (SHOW_LID)
translate([0, 0, box_hgt + 5])
lid();
if (SHOW_PIN)
translate([box_len + 5, 0, 0])
latch_pin();
if (SHOW_SPRING)
translate([box_len + 5, 20, 0])
spring_tab();
if (SHOW_FALSE_BOTTOM)
translate([box_len + 5, 40, 0])
false_bottom();