$fn = 64; // --- Parameters --- pot_diameter = 100; // Inner diameter to fit the pot clearance = 2; // Extra space to easily slide over the pot fence_height = 70; // Total height of the pickets picket_width = 12; // Width of each individual picket picket_thickness = 3; // Thickness of the pickets rail_height = 6; // Height of the horizontal connecting bands rail_thickness = 2.5; // Thickness of the horizontal bands num_pickets = 22; // Total number of pickets around the ring // --- Derived Variables --- inner_r = (pot_diameter + clearance) / 2; // --- Modules --- // Single picket generator module picket(w, h, t) { union() { // Main rectangular body translate([0, -w/2, 0]) cube([t, w, h - w/2]); // Pointed top hull() { translate([0, -w/2, h - w/2 - 0.01]) cube([t, w, 0.01]); translate([0, -0.01, h - 0.01]) cube([t, 0.02, 0.01]); } } } // Main fence ring assembly module fence_ring() { union() { // Bottom Rail translate([0, 0, fence_height * 0.15]) difference() { cylinder(r = inner_r + rail_thickness, h = rail_height); translate([0, 0, -1]) cylinder(r = inner_r, h = rail_height + 2); } // Top Rail translate([0, 0, fence_height * 0.65]) difference() { cylinder(r = inner_r + rail_thickness, h = rail_height); translate([0, 0, -1]) cylinder(r = inner_r, h = rail_height + 2); } // Pickets for (i = [0 : num_pickets - 1]) { rotate([0, 0, i * 360 / num_pickets]) // Overlap by 0.5mm into the rail to ensure a manifold mesh translate([inner_r + rail_thickness - 0.5, 0, 0]) picket(picket_width, fence_height, picket_thickness); } } } // --- Render --- fence_ring();