briantrice / Slide-Rule

Slide Rule Programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slide-Rule

This Python 3 application helps generate complete slide rule patterns.

This is via:

Python application

Running

To run the program, you can download the one file as:

  • Download SlideRule.py
  • Install PIL via:
python3 -m pip install Pillow
  • Install TOML via:
python3 -m pip install toml

Or clone this git repository locally and install per the requirements file as:

python3 -m pip install -r requirements.txt

An installation of two fonts: cmuntt.ttf and cmunit.ttf (part of the infamous LaTeX fonts)

usage: SlideRule.py [-h] [--mode {render,diagnostic,stickerprint}]
                    [--model {Demo,MannheimOriginal,Ruler,MannheimWithRuler,Aristo868,Aristo965,PickettN515T,FaberCastell283,FaberCastell283N,Graphoplex621,Hemmi153,UltraLog}]
                    [--suffix SUFFIX] [--test] [--cutoffs] [--debug]

optional arguments:
  -h, --help            show this help message and exit
  --mode {render,diagnostic,stickerprint}
                        What to render
  --model {Demo,MannheimOriginal,Ruler,MannheimWithRuler,Aristo868,Aristo965,PickettN515T,FaberCastell283,FaberCastell283N,Graphoplex621,Hemmi153,UltraLog}
                        Which sliderule model
  --suffix SUFFIX       Output filename suffix for variations
  --test                Output filename for test comparisons
  --cutoffs             Render the metal cutoffs
  --debug               Render debug indications (corners and bounding boxes)

The program has 3 rendering modes for any of the slide rule models defined:

  • render: Prints a rendering of the full size scales in their correct positions
  • diagnostic: Prints a rendering containing each available scale arranged in rows
  • stickerprint: Prints an image which can be scaled to 677.33 ppi in Gimp and then Print+Cut in Silhouette Studio

There are multiple slide rule models available, mostly defined in TOML:

  • Demo is the original slide rule made for instruction.
  • MannheimOriginal is the simplest model, with just 4 scales along the edges.
  • Ruler and MannheimWithRuler show the ruler scales, which can be set along the edge of a slide rule.
  • PickettN515T is made for electronics engineering calculations.
  • Aristo868 and Graphoplex621 are European slide rules with a moderate number of compact scales.
  • FaberCastell283 and FaberCastell283N have the large number of scales.

The produced images are also saved. The images in examples are refreshed by generate_example_outputs.py, a wrapper script you can run on new models, or to check for changes after making source code updates.

Troubleshooting

  • If you have trouble finding them, look in the location where your program is (that seemed to work for me)
  • render and diagnostic modes takes around 2 seconds to run, but the stickerprint mode usually takes 3 seconds to run.
  • If you run across issues, comment on Javier Lopez Instructables article or here, and I will attempt to explain myself.

To understand changes, the imgdiff tool can highlight differences in image outputs (ignoring color changes with -t 0.6):

imgdiff -t 0.6 <original_image>.png <updated_image>.png <original_image>.diff.png

The included Excel file can help convert between pixels, inches, and millimeters when the slide rule is being built out of physical material.

Enjoy!

About

Slide Rule Programs


Languages

Language:Python 100.0%