Skip to content

Instantly share code, notes, and snippets.

@recklessop
Created July 25, 2025 21:52
Show Gist options
  • Select an option

  • Save recklessop/7e97eff12feed4e31e1ff6d5caccdd7e to your computer and use it in GitHub Desktop.

Select an option

Save recklessop/7e97eff12feed4e31e1ff6d5caccdd7e to your computer and use it in GitHub Desktop.
// Pocket Rain Gauge - Customizable SCAD Model
// Based on 1" (25.4 mm) height with internal domed bottom for support-free printing
// Updated: Longer stake (50 mm) with dull point oriented downward for ground insertion
// Customizable Parameters
inner_diameter = 20; // Inner diameter of the cylinder (mm)
inner_height = 25.4; // Total inner height from dome bottom to top (1 inch in mm)
dome_radius = 10; // Radius of the internal hemispherical dome (mm, keep <= inner_diameter/2)
wall_thickness = 2; // Wall thickness (mm)
spike_height = 50; // Height of the bottom stake (mm) - for stability
spike_tip_diameter = 4; // Diameter at the stake's tip (mm) - for a "dull" point
lip_height = 0; // Height of the top lip/flange (mm)
lip_outer_diameter = 0; // Outer diameter of the top lip (mm)
resolution = 100; // Curve resolution ($fn)
// Calculated Values (don't edit these)
outer_diameter = inner_diameter + 2 * wall_thickness;
straight_inner_height = inner_height - dome_radius; // Height of straight cylinder above dome
total_height = straight_inner_height + dome_radius + lip_height; // Total height without stake
// Main Module
module rain_gauge() {
union() {
// Outer body: Cylinder with top lip (shifted up by stake height)
translate([0, 0, spike_height]) {
// Main outer cylinder
cylinder(h = total_height, d = outer_diameter, $fn = resolution);
// Top lip/flange
translate([0, 0, total_height - lip_height]) {
cylinder(h = lip_height, d = lip_outer_diameter, $fn = resolution);
}
}
// Bottom stake (cone with dull point downward)
cylinder(h = spike_height, d1 = spike_tip_diameter, d2 = outer_diameter, $fn = resolution);
}
}
// Inner Cavity (to subtract for hollowing)
module inner_cavity() {
// Straight inner cylinder
translate([0, 0, spike_height + dome_radius]) {
cylinder(h = straight_inner_height + lip_height + 0.1, d = inner_diameter, $fn = resolution); // +0.1 for clean subtraction
}
// Domed bottom (hemisphere)
translate([0, 0, spike_height + dome_radius]) {
sphere(r = dome_radius, $fn = resolution);
}
}
// Final Model: Outer body minus inner cavity
difference() {
rain_gauge();
inner_cavity();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment