In order to measure a rim you have to find its effective diameter. The effective rim diameter is the diameter to which the ends of the fully engaged spokes will extend (flush with the end of the spoke nipple). Drop a nipple into a rim hole and find how far its head lies below the outer edge of the rim. This value should be doubled and subtracted from the outer rim diameter. Count the holes to find opposed points on the rim.
Note that a spoke under full tension can stretch up and the rim, depending on its strength, can also shrink in diameter. Therefore, the computed spoke length should always be rounded down to the nearest available size. But do not allow the difference between the calculated and actual length more than 2mm.
The hub flange diameter is the distance from center to center of the spoke holes. And see the figure to understand linear dimensions.