Last active
March 5, 2021 04:01
-
-
Save BekaValentine/2067e3fe4c4fed04ac9b92efe90d684c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fn = 100; | |
module radius_gauge(min_radius, max_radius, radius_step, vertical_step_size, padding) { | |
gauge_side = max_radius + padding; | |
vertical_step_count = (max_radius - min_radius) / radius_step; | |
gauge_height = vertical_step_count * vertical_step_size + 2*padding; | |
difference() { | |
cube([gauge_side,gauge_side,gauge_height]); | |
translate([0,0,padding]) | |
for (i = [0:vertical_step_count]) { | |
radius = min_radius + i*radius_step; | |
zpos = i*vertical_step_size; | |
translate([0,0,zpos]) | |
cylinder(r = radius, | |
h = gauge_height); | |
d = 0.5; | |
translate([radius + 1,d,zpos]) | |
rotate([90,0,0]) | |
linear_extrude(height = 2*d) | |
text(str(radius), size = vertical_step_size - 0.1); | |
} | |
} | |
} | |
radius_gauge( | |
min_radius = 2, | |
max_radius = 20, | |
radius_step = 0.5, | |
vertical_step_size = 2, | |
padding = 10 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment