Skip to content

Lathe change gear calculator (written in rust)

Notifications You must be signed in to change notification settings

carneeki/trainset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trainset

Generate all thread pitches your lathe is capable of using some inputs, with the set of gear trains needed on the banjo!

Building

cargo build --release --features yaml

Running:

Trainset has two modes:

  • generate
  • lookup

Generate will generate a database file, and a plain text file of all the pitches the lathe can produce along with the gears needed to produce that pitch.

Lookup will allow a thread pitch to be entered (after the database is generated), and trainset will search the database for the desired threadpitch showing all values within 2 decimal places of the target. (on the TODO list)

Running a generate:

./trainset generate CQ6125.lib.txt CQ6125.gb.txt 40 60 2 CQ6125.out.txt

These settings are for my lathe, a Chinese "CQ6125". The Grizzly G0602 will be similar, though the library and leadscrew pitch will have different values. The gearbox will be the same however.

  • CQ6125.lib.txt is a library file containing all the gears
  • CQ6125.gb.txt is a list of the gearbox ratios (or gears if known inside the gearbox).
  • 40 is a gear attached to the spindle
  • 60 is a gear driven by the spindle. Typically this will have the "A" gear on the same shaft.
  • 2 is the pitch (in mm) of the leadscrew
  • CQ6125.out.txt is the output text file.

Running a lookup

... on the TODO list. But it'll be something like this:

./trainset lookup CQ6125.db 2.5

to get a listing of all combinations close to 2.50mm pitch.

TODO list items

Some of the TODO stuffs:

  • lookups
  • write a binary file for storing gear combos with fast lookups
  • write the text file to an output rather than to STDOUT (screen)
  • merge the different configuration files (.lib.txt, .gb.txt, and the three magic numbers into a single configuration file)
  • less .clone()s in the code
  • optimise CPU
  • too many .unwrap()s in the code... can I fix this?
  • sqlite is kinda sluggish (about 10x slower) compared to just writing out a text file

Thanks

Many thanks to Mitchell Hunter [mitchicus] for putting up with my troubleshooting of Rust.

About

Lathe change gear calculator (written in rust)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages