Support auto detection of unit type when adding imperial units

This commit is contained in:
Dion Moult
2021-10-14 12:44:13 +11:00
parent 464b0c2ebc
commit 1fa1a9e3d3
8 changed files with 216 additions and 0 deletions
@@ -117,6 +117,7 @@ si_type_names = {
"THERMODYNAMICTEMPERATUREUNIT": "KELVIN", # Or, DEGREE_CELSIUS, but this is a quirk of IFC
"TIMEUNIT": "SECOND",
"VOLUMEUNIT": "CUBIC_METRE",
"USERDEFINED": "METRE",
}
# See IfcDimensionalExponents:
@@ -151,6 +152,7 @@ named_dimensions = {
"THERMODYNAMICTEMPERATUREUNIT": (0, 0, 0, 0, 1, 0, 0),
"TIMEUNIT": (0, 0, 1, 0, 0, 0, 0),
"VOLUMEUNIT": (3, 0, 0, 0, 0, 0, 0),
"USERDEFINED": (0, 0, 0, 0, 0, 0, 0),
}
si_conversions = {
@@ -192,6 +194,48 @@ si_conversions = {
"btu": 1055.056,
}
imperial_types = {
"thou": "LENGTHUNIT",
"inch": "LENGTHUNIT",
"foot": "LENGTHUNIT",
"yard": "LENGTHUNIT",
"mile": "LENGTHUNIT",
"square thou": "AREAUNIT",
"square inch": "AREAUNIT",
"square foot": "AREAUNIT",
"square yard": "AREAUNIT",
"acre": "AREAUNIT",
"square mile": "AREAUNIT",
"cubic thou": "VOLUMEUNIT",
"cubic inch": "VOLUMEUNIT",
"cubic foot": "VOLUMEUNIT",
"cubic yard": "VOLUMEUNIT",
"cubic mile": "VOLUMEUNIT",
"litre": "VOLUMEUNIT",
"fluid ounce UK": "VOLUMEUNIT",
"fluid ounce US": "VOLUMEUNIT",
"pint UK": "VOLUMEUNIT",
"pint US": "VOLUMEUNIT",
"gallon UK": "VOLUMEUNIT",
"gallon US": "VOLUMEUNIT",
"degree": "PLANEANGLEUNIT",
"ounce": "MASSUNIT",
"pound": "MASSUNIT",
"ton UK": "MASSUNIT",
"ton US": "MASSUNIT",
"lbf": "FORCEUNIT",
"kip": "FORCEUNIT",
"psi": "PRESSUREUNIT",
"ksi": "PRESSUREUNIT",
"minute": "TIMEUNIT",
"hour": "TIMEUNIT",
"day": "TIMEUNIT",
"btu": "ENERGYUNIT",
}
prefix_symbols = {
"EXA": "E",
"PETA": "P",