$fn = 64; // --- Parameters --- base_width = 80; base_length = 80; ground_thickness = 2; foundation_width = 64; foundation_length = 64; foundation_height = 4; floor_width = 58; floor_length = 58; floor_height = 2; corner_radius = 2; // Connection points for modular buildings peg_hole_diameter = 3.2; // Clearance for 3mm pegs or magnets peg_hole_depth = 3; peg_inset = 6; // --- Modules --- module rounded_rect(w, l, h, r) { translate([-w/2, -l/2, 0]) hull() { translate([r, r, 0]) cylinder(h=h, r=r); translate([w-r, r, 0]) cylinder(h=h, r=r); translate([r, l-r, 0]) cylinder(h=h, r=r); translate([w-r, l-r, 0]) cylinder(h=h, r=r); } } // --- Main Geometry --- difference() { union() { // Ground layer (yard/sidewalk area) rounded_rect(base_width, base_length, ground_thickness, corner_radius); // Main foundation block translate([0, 0, ground_thickness]) rounded_rect(foundation_width, foundation_length, foundation_height, corner_radius); // Raised inner floor (creates a stepped foundation look) translate([0, 0, ground_thickness + foundation_height]) rounded_rect(floor_width, floor_length, floor_height, corner_radius); } // Magnet / Peg holes for building attachment for (x = [-1, 1]) { for (y = [-1, 1]) { translate([ x * (floor_width/2 - peg_inset), y * (floor_length/2 - peg_inset), ground_thickness + foundation_height + floor_height - peg_hole_depth ]) cylinder(h=peg_hole_depth + 1, d=peg_hole_diameter); } } }