Newsgroups: rec.crafts.metalworking Subject: Re: "fudging" a metric thread Summary: Expires: References: <853972049.12856@dejanews.com> <5c93i0$1ae@newshost.netrix.com> <854384246.3460@dejanews.com> Sender: Followup-To: Distribution: Organization: Department of Electrical Engineering, Sydney University Keywords: Cc: In article <854384246.3460@dejanews.com>, wrote: > >I don't mention his name, lest he be deluged with requests It was me. Here's the program: change Ngears to the number of gears you have, the leadscrew_pitch to your lathe's (note that it is expected to be METRIC, ie in millimetres) and the array gear[Ngears] should have your gear sets teeth numbers (in no particular order). The program will grind through all possible combinations of your gear set and print out the combinations that have the desired pitch within your given tolerance. This was only a quickie, like most of my metalworking programs, because I want the answers fast, not caring about nice interfaces etc. Apologies to any C purists out there... /* DISCLAIMER Copyright (C) 1997 by Adrian Philip Whichello. All rights reserved. I, Adrian Philip Whichello, MAKE NO WARRANTY ON THIS SOFTWARE, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO QUALITY, ACCURACY, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL I BE HELD RESPONSIBLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OF THE SOFTWARE. I RELEASE THIS PROGRAM AS FREEWARE. YOU MAY COPY, GIVE AWAY AND USE THIS PROGRAM, PROVIDED THIS NOTICE REMAINS ATTACHED AT ALL TIMES. */ /* I think that about covers it :-) */ #include #include #include #include #define Ngears 10 #define Ngears_1 Ngears-1 #define leadscrew_pitch 2.0 main(argc, argv) int argc; char *argv[]; { int gear[Ngears] = {28, 30, 42, 49, 56, 63, 70, 84, 98, 105}; int headstock, leadscrew, stud1u, stud1l, stud2u, stud2l; float pitch, desired_pitch, tolerance, pupper, plower; printf("Desired pitch (in mm), tolerance (%%)? "); scanf("%e %e", &desired_pitch, &tolerance); plower = pupper = desired_pitch; pupper += 0.01 * tolerance; plower -= 0.01 * tolerance; for (headstock = 0; headstock < Ngears; headstock++) { for (leadscrew = 0; leadscrew < Ngears; leadscrew++) if (leadscrew != headstock) { pitch = leadscrew_pitch * gear[headstock] / gear[leadscrew]; if ((pitch >= plower) && (pitch <= pupper)) printf("%dX%d %e (mm) %e (tpi)\n", gear[headstock], gear[leadscrew], pitch, 25.4 / pitch); for (stud1l = 1; stud1l < Ngears; stud1l++) if ((stud1l != headstock) && (stud1l != leadscrew)) { for (stud1u = 0; stud1u < Ngears; stud1u++) if ((stud1u != headstock) && (stud1u != stud1l) && (stud1u != leadscrew)) { pitch = leadscrew_pitch * gear[headstock] / gear[stud1l] * gear[stud1u] / gear[leadscrew]; if ((pitch >= plower) && (pitch <= pupper)) printf("%dX%d|%dX%d %e (mm) %e (tpi)\n", gear[headstock], gear[stud1l], gear[stud1u], gear[leadscrew], pitch, 25.4 / pitch); for (stud2l = 0; stud2l < Ngears; stud2l++) if ((stud2l != headstock) && (stud2l != stud1l) && (stud2l != stud1u) && (stud2l != leadscrew)) { for (stud2u = 0; stud2u < Ngears; stud2u++) if ((stud2u != headstock) && (stud2u != stud2l) && (stud2u != stud1u) && (stud2u != stud1l) && (stud2u != leadscrew) && (gear[stud1u] + gear[stud2u] > gear[stud1l] + gear[stud2l])) { pitch = leadscrew_pitch * gear[headstock] / gear[stud1l] * gear[stud1u] / gear[stud2u] * gear[stud2l] / gear[leadscrew]; if ((pitch >= plower) && (pitch <= pupper)) printf("%dX%d|%dX%d|%dX%d %e (mm) %e (tpi)\n", gear[headstock], gear[stud1l], gear[stud1u], gear[stud2u], gear[stud2l], gear[leadscrew], pitch, 25.4 / pitch); } } } } } } } The instructions: Say you wanted to cut an 10tpi thread. This is 1/10" or 2.54mm pitch. Lets have a tolerance of 0.05mm for the sake of argument (and to make the demo work!). Then, running the program, we get: Desired pitch (in mm), tolerance (%)? 2.54 0.05 28X49|84X63|70X42 2.539683e+00 (mm) 1.000125e+01 (tpi) (plus a *lot* more possible combinations) which means we have 28T on the headstock, engaging (X) a 49T driving (on the same shaft as) an 84T (|) on the first idler stud. The 84T engages a 63T, which drives a 70T on the second stud and finally, this gear engages a 42T on the leadscrew. Simple, isn't it! One of my (very) long term projects (and the reason I wrote the program) is to put a set of change wheels on the Unimat 3 I have at home to cut threads, made from an oddball collection of 24dpi gears I picked up (not the set used in this copy of the program - I really mean oddball: 31T etc!). Kevin mentioned the following caveats: "Remember that, even using a computer, it is good practice to check the carriage travel/rev using an indicator, as insurance against mistakes. My machinist friend has a change-gear that came from the factory marked with the wrong number of teeth. Now ground off (well almost..he likes to show people) and re-marked. He caught this with the indicator before scrapping a part. If he had used a computer, he might have been less cautious about checking his calculation. The marking was cast into the blank...guess one got in to the wrong box. This took him a couple days to track down, as he had a lot more faith in the machine (and so the gears) than in his math." -- Dr Adrian Whichello Phone: +61 2 9351 4824 Imaging Science and Engineering Laboratory Fax: +61 2 9351 3847 Sydney University Electrical Engineering Email: adrianw@ee.usyd.edu.au Australia WWW: http://www.ee.usyd.edu.au/~adrianw "I wish to God these calculations had been executed by steam!" - C. Babbage