Skip to content

Instantly share code, notes, and snippets.

@0xc0392b
Last active December 4, 2022 23:22
Show Gist options
  • Select an option

  • Save 0xc0392b/0b0320050d694f9d792838eb49322e9b to your computer and use it in GitHub Desktop.

Select an option

Save 0xc0392b/0b0320050d694f9d792838eb49322e9b to your computer and use it in GitHub Desktop.
Calculate bike wheel spoke length
from math import sin, cos, sqrt, pi
PI2 = pi * 2
spoke_count = 36
cross_pattern = 2
spoke_hole_diameter = 2 # in mm
DL = 89.8 # diameter of all the spoke holes in the left flange, measured centre to centre
LFO = 17.5 # distance from the lock nut to the centre of the left flange
OLD = 90 # measurement from lock nut to lock nut
ERD = 430 # effective rim diameter
a = (DL / 2 * sin(PI2 * cross_pattern / (spoke_count / 2))) ** 2
b = (ERD / 2 - ((DL / 2) * cos(PI2 * cross_pattern / (spoke_count / 2)))) ** 2
c = ((OLD / 2) - LFO + OSB) ** 2
spoke_length = round(sqrt(a + b + c) - spoke_hole_diameter / 2, 2)
print(spoke_length)
# result : 183.95mm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment