2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 10:05:39 +00:00

[Feature] Engineering Units (#6539)

* Conversion: Support conversion from "engineering notation"

* Add unit tests for scientific notation

* Update docs for unit conversion
This commit is contained in:
Oliver
2024-02-22 10:22:23 +11:00
committed by GitHub
parent 8bf614607c
commit 6e713b15ae
3 changed files with 144 additions and 25 deletions

View File

@ -11,6 +11,33 @@ Support for real-world "physical" units of measure is implemented using the [pin
- Enforce use of compatible units when creating part parameters
- Enable custom units as required
### Unit Conversion
InvenTree uses the pint library to convert between compatible units of measure. For example, it is possible to convert between units of mass (e.g. grams, kilograms, pounds, etc) or units of length (e.g. millimeters, inches, etc). This is a powerful feature that ensures that units are used consistently throughout the application.
### Engineering Notation
We support the use of engineering notation for units, which allows for easy conversion between units of different orders of magnitude. For example, the following values would all be considered *valid*:
- `10k3` : `10,300`
- `10M3` : `10,000,000`
- `3n02` : `0.00000000302`
### Scientific Notation
Scientific notation is also supported, and can be used to represent very large or very small numbers. For example, the following values would all be considered *valid*:
- `1E-3` : `0.001`
- `1E3` : `1000`
- `-123.45E-3` : `-0.12345`
!!! tip "Case Sensitive"
Support for scientific notation is case sensitive. For example, `1E3` is a valid value, but `1e3` is not.
### Case Sensitivity
The pint library is case sensitive, and units must be specified in the correct case. For example, `kg` is a valid unit, but `KG` is not. In particular, you need to pay close attention when using SI prefixes (e.g. `k` for kilo, `M` for mega, `n` for nano, etc).
## Unit Support
Physical units are supported by the following InvenTree subsystems: