Skip to main content

A Python package, with no dependencies, producing SVG images of Slide Rule scales

Project description

slideruleimages

Python package to produce Slide Rule SVG images

A typical example might be:

from slideruleimages import Rule

# xvalue is where the C scale index is placed over the D value
# right is True if the mid scale is moved to the right
# right is False if the mid scale is moved to the left
# hairline is where the hairline cursor is placed over the D value,
# or zero if no hairline is used 

rl = Rule(xvalue = 2.0, right = True, hairline=6.0,
          topruleheight = 0,                        # No top rule
          midruleheight = 120,                      # middle slider 120px high
          btmruleheight = 120)                      # bottom rule 120 px high

# Add a C scale
rl.addCscale(midrule=20)  # indicates this scale is put on the middle rule
                          # 20 pixels down from the top of the middle rule

# Add a D scale
rl.addDscale(btmrule=0)   # indicates this scale is put on the bottom rule
                          # 0 pixels down from the top of the bottom rule

filename = "twoxthree.svg"

rl.write(filename)

print(f'{filename} created')

This would produce:

example

This package is intended to produce images useful for documents or web sites which illustrate logarithms or Slide Rules. One such web site is available at:

https://bernie-skipole.github.io/sliderule/

The package has one class, Rule, which is illustrated above and has the methods:

write(filename) This saves the image file.

addDscale(btmrule=-1, midrule=-1, toprule=-1)

addCscale(btmrule=-1, midrule=-1, toprule=-1)

addCFscale(btmrule=-1, midrule=-1, toprule=-1)

addDFscale(btmrule=-1, midrule=-1, toprule=-1)

addLL3scale(btmrule=-1, midrule=-1, toprule=-1)

addLL2scale(btmrule=-1, midrule=-1, toprule=-1)

addLL1scale(btmrule=-1, midrule=-1, toprule=-1)

addLL0scale(btmrule=-1, midrule=-1, toprule=-1)

Only one of the arguments btmrule, midrule or toprule should be given a non -1 argument which indicates which rule the scale should appear on, and the integer number of pixels down from the top of that rule.

The package is available on Pypi at:

https://pypi.org/project/slideruleimages/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slideruleimages-0.0.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slideruleimages-0.0.2-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file slideruleimages-0.0.2.tar.gz.

File metadata

  • Download URL: slideruleimages-0.0.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for slideruleimages-0.0.2.tar.gz
Algorithm Hash digest
SHA256 80e9652f7a5d8492ad4562e52ed8e34032e46fe1216ff346e0139a9b3391c691
MD5 56bda58e3ac4aacac7aad299ef0b76a9
BLAKE2b-256 4f146c3c313ef7939aec83618e09164459da65d422142c9c1734b33cdb087b59

See more details on using hashes here.

File details

Details for the file slideruleimages-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for slideruleimages-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1b24c67cf9bc0c0b6ee582f9f1fa9673804d7640e38f27d6567f161dc78a341c
MD5 7f442ff85dac39b915f00fe357ce9b92
BLAKE2b-256 a5e052a356a1411c602ec27829f6c3b5edae07850c1c94501f46d14d26b972b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page