# Lo-Fi's dividing head calculator



## Lo-Fi (Jan 22, 2020)

Not your usual project here, I know, but I got fed up with using incomplete charts and manually figuring out what I can and can't divide with the plates I have, so I've been coding up a calculator! 

You feed it a list of hole patterns you have available and the ratio of your dividing head, then what you want to divide and it'll tell you if it's possible, which plate to choose and how many turns/holes. If there are multiple solutions, it'll list them. The really clever stuff is yet to come - it'll calculate differential dividing too for divisions you can't get with plates alone if fed a list of change gears.

Windows only, as I'm already familiar with C# and Visual Studio, but it ought to be easy enough to port if someone feels like it. I'll open source it with a free pre-compiled executable once I'm happy that it's at least good enough for an initial release. Hooray for these wonderful software development tools being FREE! 

Excellent video on differential dividing here:






I'm really excited to get cutting some gears  

Stay tuned!


----------



## Lo-Fi (Jan 22, 2020)

Quick screen grab. Early stages yet, but it's working for simple dividing.


----------



## middle.road (Jan 22, 2020)

Whoa...Cool!


----------



## Lo-Fi (Feb 11, 2020)

Just realised a few posts in this thread got lost in the great forum outage, and I've developed it further from there anyway.

You can manually add your hole patterns, or import from a CSV file. Same with gears if you've got a dividing head that takes change gears for differential indexing like mine:




You can set your dividing head ratio, though it defaults to 40:1 as that seems most common.

Enter what you'd like to index by and it'll do all the calcs based on what you've told it you have and show what's possible. The row in bold shows that we need to use the 31 hole plate, rotating one full turn and 9 holes to achieve that:




If multiple solutions are possible, it'll show that too:




We can use the 21 or 33 hole plate to index 30 divisions.

Here's a case which can't be simple indexed. But it can be differential indexed with the available plates and gears:




The "Approx" field shows what we'd set up for as approximate simple indexing, with the gear setup outlined in the bottom right. The reverse rotation field shows if an extra idler is needed to reverse the rotation between the spindle and plate.

Kinda cool, but laborious if you're trying to figure out what you can and can't do. So here comes the clever stuff. Clicking on the "gear info" button brings up another form where you can specify a range of gear sizes (though you can ignore that they're "gears" if you're indexing something else) and a table will be generated showing in bold those tooth counts that can be simple indexed and bold italic for those that can't, but can be differential indexed.




It's set up to show info for metric gears, so you can change the module field and the table gets updated with the relevant info. I should probably add a few more fields in.

Selecting two rows will give the correct centre distance for those two gears.




Double clicking on a row will set the first form up with info for that indexing job.

I'm working on getting it to suggest which plates might be most helpful for plugging the gaps in your current collection.

Still double checking it, but I'll release it soon open source once I'm happy I'm not giving out garbage info. It's been spot on for me so far! All but one of these (the one that came with the dividing head) has been cut with info out of the app. 




Including the 39 tooth which was differential indexed!




Tables now seem very tedious...

TTFN


----------



## dewbane (Sep 28, 2020)

So whatever happened to this? I was just sitting down to code one of these things myself, because I'm tired of using spreadsheets of unknown provenance that aren't designed well.


----------



## Lo-Fi (Sep 28, 2020)

It verks!

Happy to send over. Code is super hacky as I've not got round to doing anything about that, but you're very welcome to it.


----------



## Lo-Fi (Sep 28, 2020)

Actually, you'll appreciate this, @dewbane ... That 39 tooth wheel turns out to be a 41 tooth wheel because I forgot to add an idler gear while differential indexing, so it added 1/40 of a turn each time, rather than subtracting.


----------



## dewbane (Sep 28, 2020)

Lo-Fi said:


> Actually, you'll appreciate this, @dewbane ... That 39 tooth wheel turns out to be a 41 tooth wheel because I forgot to add an idler gear while differential indexing, so it added 1/40 of a turn each time, rather than subtracting.



I no longer feel so alone!

If you want to shoot the code to rosegarden.trumpeter@gmail.com I'll take a gander.

Wow. I was going to brag on my "kudo rank" in the open source community, but my reputation has gone swirling down the loo. I used to be second only to Linus Torvalds, and now I'm just a random nobody. I guess they made their algorithm smarter. It correctly recognizes the fact that I am a mere has-been as a code jockey.


----------



## Lo-Fi (Sep 28, 2020)

Lol! I rake it out and send over 

Really should open source it, I suppose. It'll be all the better for it.


----------



## brino (Sep 28, 2020)

Lo-Fi said:


> Really should open source it, I suppose. It'll be all the better for it.



Yes Please!

-brino


----------



## Lo-Fi (Sep 29, 2020)

Here it is, @dewbane @brino 

It rough as rough can be! Literally in "code like stream of consciousness". Apologies for the hacky nature.

But it does work. You'll find compiled versions in the bin/debug folder, though Windows Smartscreen may scream at you. Written in C# targeting .net 4.5 because that's what I know from my days as a Kerbal modder.

Any questions, comments, requests (or abuse for such poor code), feel free to chuck in the thread here. I'll get around to lobbing in a Github repo at some point when I've had time to clean up, comment and understand what the heck I was doing when I wrote it.


----------



## dewbane (Oct 1, 2020)

Lo-Fi said:


> It rough as rough can be! Literally in "code like stream of consciousness". Apologies for the hacky nature.


If it makes you feel better, it's orders of magnitude better done than anything I was going to bang out. I'm going to have to spend some time studying this, since I speak neither C# nor .net, but the gist of it is interesting. WorkyBits. I love it!


----------



## Lo-Fi (Oct 1, 2020)

dewbane said:


> If it makes you feel better, it's orders of magnitude better done than anything I was going to bang out. I'm going to have to spend some time studying this, since I speak neither C# nor .net, but the gist of it is interesting. WorkyBits. I love it!



Feel free to ask. No such thing as stupid questions here!

I've done some very quietionable things passing ListView objects around, for example. They're really for displaying stuff, not running iterative calcs on and passing around in the background like I have. I should have created my own objects to store the data, but that takes time and I was just hacking something together for my own use and amusement. 

Workybits is where you'll find lots of the interesting stuff  One thing to note with the nested iteration while checking for workable ratios for differential dividing: there are other ways to do that, but none I found that elegantly made it possible to check that ratios with two of the _same_ gear are valid because there are _actually_ two of that gear available. A few UI quirks here and there too and much more I'd like to do with it. We could do with more coding stuff on here, I think. Same as having a machine shop: it's just another tool that allows you to think "Hah. I can make that just how I want it" and enjoy doing it. Took me three months to learn enough C# that I didn't feel like I was fumbling around in the dark. Admittedly, I launched myself in at the deep end with a language I didn't know using a totally undocumented API (how bits of code talk to each other) in a game engine. I made it hard for myself!

Ask away, I'll be more than happy to discuss


----------



## dewbane (Oct 1, 2020)

Lo-Fi said:


> Admittedly, I launched myself in at the deep end with a language I didn't know using a totally undocumented API (how bits of code talk to each other) in a game engine. I made it hard for myself!


Strangely enough, the only experience I have with C# is tinkering with Unreal Engine 4. I kept most of my edits to the C++ side of things. My game didn't quite make it off the ground, but I learned a lot in the process. Like if you want to develop a game, you need to hire people, or be prepared to spend 20 years writing it. Lots of hats to wear developing a game. I learned how to do 2D sprite animation inside a 3D world, and other fun stuff, but I was forever tinkering here and not getting anything done there.


----------



## NortonDommi (Oct 1, 2020)

Thank you for making this available.  I have been using ShopCalc but it only does direct dividing. Has a bunch of other useful stuff as well though.


----------

