$fn = 64; // Parametric Dimensions width = 200; depth = 120; base_height = 80; wall = 3; // Cable Slots slot_w = 20; slot_h = 25; // Aesthetics strap_w = 15; strap_t = 2; strap_inset = 25; lip_gap = 0.6; // Tolerance for lid fit // Reusable Cable Slot Module module cable_slot() { translate([0, -slot_w/2, -1]) cube([wall + 10, slot_w, slot_h + 1]); translate([0, 0, slot_h]) rotate([0, 90, 0]) cylinder(r=slot_w/2, h=wall + 10); } // Treasure Chest Base module chest_base() { difference() { union() { // Main body cube([width, depth, base_height]); // Decorative Straps translate([strap_inset, -strap_t, 0]) cube([strap_w, depth + 2*strap_t, base_height]); translate([width - strap_inset - strap_w, -strap_t, 0]) cube([strap_w, depth + 2*strap_t, base_height]); // Lock plate (bottom half) translate([width/2 - 15, -strap_t - 2, base_height - 20]) cube([30, strap_t + 2.1, 20]); // Inner lip for lid registration translate([wall + lip_gap, wall + lip_gap, base_height]) cube([width - 2*(wall + lip_gap), depth - 2*(wall + lip_gap), 5]); } // Hollow interior translate([wall, wall, wall]) cube([width - 2*wall, depth - 2*wall, base_height + 10]); // Hollow inner lip translate([wall*2, wall*2, base_height - 1]) cube([width - 4*wall, depth - 4*wall, 7]); // Left cable slot translate([-5, depth/2, 0]) cable_slot(); // Right cable slot translate([width - wall - 5, depth/2, 0]) cable_slot(); // Back cable slot translate([width/2, depth - 5, 0]) rotate([0, 0, 90]) cable_slot(); // Keyhole cutout translate([width/2, -strap_t - 5, base_height - 8]) rotate([-90, 0, 0]) cylinder(r=3, h=10); translate([width/2 - 1.5, -strap_t - 5, base_height - 15]) cube([3, 10, 7]); } } // Treasure Chest Lid module chest_lid() { difference() { union() { // Main dome translate([0, depth/2, 0]) rotate([0, 90, 0]) cylinder(r=depth/2, h=width); // Decorative Straps translate([strap_inset, depth/2, 0]) rotate([0, 90, 0]) cylinder(r=depth/2 + strap_t, h=strap_w); translate([width - strap_inset - strap_w, depth/2, 0]) rotate([0, 90, 0]) cylinder(r=depth/2 + strap_t, h=strap_w); // Lock plate (top half) translate([width/2 - 15, -strap_t - 2, 0]) cube([30, strap_t + 2.1, 15]); } // Hollow dome interior translate([wall, depth/2, 0]) rotate([0, 90, 0]) cylinder(r=depth/2 - wall, h=width - 2*wall); // Flatten bottom (remove lower half of cylinders for printing) translate([-5, -strap_t - 5, -depth - 5]) cube([width + 10, depth + 2*strap_t + 10, depth + 5]); } } // Layout for 3D Printing chest_base(); translate([0, depth + 30, 0]) chest_lid();