UnitSystem¶
- class opstool.pre.UnitSystem(length='m', force='kn', time='sec')[source]¶
Bases:
objectA class for unit conversion.
Parameters¶
- length: str, default=”m”
Length unit base. Optional [“inch”, “ft”, “mm”, “cm”, “m”, “km”].
- force: str, default=”kN”
Force unit base. Optional [“lb”(“lbf”), “kip”, “n”, “kn”, “mn”, “kgf”, “tonf”].
- time: str, default=”sec”
Time unit base. Optional [“sec”].
Note
Mass and stress units can be automatically determined based on length and force units, optional mass units include [“mg”, “g”, “kg”, “ton”(“t”), “slug”], and optional stress units include [“pa”, “kpa”, “mpa”, “gpa”, “bar”, “psi”, “ksi”, “psf”, “ksf”].
You can enter any uppercase and lowercase forms, such as
knandkN,mpaandMPaare equivalent.You can add a number (int) after the unit to indicate a power, such as
m3form*m*m.
Methods
get_unit_ratioShow all unit conversion coefficients with colorful output
Attributes
forcelengthtime