Torque Converter
Convert between Newton-meters, foot-pounds, kilogram-force meters, and more torque units.
Häufig gestellte Fragen
Code-Implementierung
# Torque unit conversion in Python
# Conversion factors relative to Newton-metre (Nm)
TORQUE_TO_NM = {
"Nm": 1.0,
"ft_lb": 1.35582, # foot-pound
"in_lb": 0.112985, # inch-pound
"in_oz": 0.00706155, # inch-ounce
"kgf_m": 9.80665, # kilogram-force metre
"kgf_cm": 0.0980665, # kilogram-force centimetre
"dyn_cm": 1e-7, # dyne-centimetre
}
def convert_torque(value: float, from_unit: str, to_unit: str) -> float:
nm = value * TORQUE_TO_NM[from_unit]
return nm / TORQUE_TO_NM[to_unit]
# Practical examples
print(convert_torque(100, "Nm", "ft_lb")) # 73.756 (car wheel nuts)
print(convert_torque(20, "ft_lb", "Nm")) # 27.116 (engine bolt)
print(convert_torque(25, "in_lb", "Nm")) # 2.825 (small fastener)
print(convert_torque(10, "kgf_m", "Nm")) # 98.067Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.