Soldato
Will find some good challenges and create some threads this evening or tomorrow when I get time
Looks like @Steedie hasn't had time yet, so i'll kick it off whilst I have both time and an idea:
I want to build a contraption for cutting screw threads into wood dowels. The cutting head is moved along the workpiece on a 1.25mm pitch (pitch = distance between threads) threaded rod. If I want to cut a 1.25mm pitch thread into the wood, I need to rotate the wood dowel and the threaded rod together at a 1:1 ratio.
If I want to cut other thread pitches into the wood, i'll need some cogs to rotate the parts at different speeds.
If i want a 2.5mm pitch thread in the wood, the threaded rod needs to rotate at twice the speed that the wood dowel is rotating at. This means I'd use something like an 11tooth cog meshing with a 22tooth cog to give the correct gear ratio.
So, I want some code which can take in a thread pitch (in mm) and output a corresponding set of cogs which will give me the desired ratio.
Some rules:
Obviously, cogs can only have integer numbers of teeth.
2.5% variation is acceptable for the ratio.
Max cog size is 100teeth, min is 9 - if no combination of integer numbered cogs within that range can produce the required ratio, output an error.
It's preferable but not essential to have an odd number of total teeth between the 2 cogs (my example of 11 and 22 teeth cogs give a total of 33 teeth, which is better than using 10 and 20 cogs which would have given the same ratio)
edit: added minimum cog size
Last edited: