Last active
October 2, 2024 16:20
-
-
Save rocktronica/9bf386b416345a472ef2b871b6a45c42 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
module horn_goldilocks_array( | |
height = 2.5, | |
plot = 10, | |
tolerances = [0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1], | |
shim_counts = [0, 3, 6] | |
) { | |
difference() { | |
cube([ | |
plot * len(tolerances), | |
plot * len(shim_counts), | |
height | |
]); | |
for (i_tolerance = [0 : len(tolerances) - 1]) { | |
for (i_shim_count = [0 : len(shim_counts) - 1]) { | |
translate([ | |
i_tolerance * plot + plot / 2, | |
i_shim_count * plot + plot / 2, | |
0 | |
]) { | |
// So now we have X and Y as tolerances[i_tolerance] and | |
// shim_counts[i_shim_count], and they can be used to make | |
// each individual test. | |
// Here, for example, they're passed as arguments to an | |
// external cavity() module. | |
cavity( | |
diameter = SERVO_SHAFT_DIAMETER | |
+ tolerances[i_tolerance] * 2, | |
shim_count = shim_counts[i_shim_count], | |
height = height | |
); | |
} | |
} | |
} | |
} | |
} |
Thanks! I'm still new to OpenSCAD and this will help me change stuff and see what happens. Love the idea of a servo horn variety pack for dialing in just the right sizes.
@DPHAD Oh, nice. I like OpenSCAD a lot. Feel free to email if you need anything else. I'm happy to help
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@DPHAD
Thanks for the nudge; I've added a comment to hopefully explain... I'd left out
cavity()
because I wasn't actually expecting anybody to run the code, just get a feel for how the parent module is supposed to work.Here's the missing stuff, if you want to give it a go and get the full picture in OpenSCAD. Just throw this above
horn_goldilocks_array
's definitionHope that helps