Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using handcalcs with pint #203

Open
av1dm opened this issue Jun 6, 2024 · 1 comment
Open

Using handcalcs with pint #203

av1dm opened this issue Jun 6, 2024 · 1 comment

Comments

@av1dm
Copy link

av1dm commented Jun 6, 2024

Hello,

I wanted to share my default setup for using handcalcs together with pint.

Pint can be a useful alternative to forallpeople, if some "advanced" options are needed.
The main reason, I started using pint is to work with fixed prefixes.
Here is my default setup to achieve this:

from handcals import render
from pint import UnitRegistry

ureg = UnitRegistry(autoconvert_to_preferred = True)
preferred_units = [
    ureg.mm,
    ureg.kg,
    ureg.s, 
    ureg.K,
    ureg.kN,
    ureg.W,
    ureg.MPa
]

ureg.default_preferred_units = preferred_units

mm  = ureg.mm
kN  = ureg.kN
MPa = ureg.MPa

handcalcs.set_option("preferred_string_formatter", "~L")
@connorferster
Copy link
Owner

@av1dm Thanks for posting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants