The harmonic components of electromagnetic force induce structure vibration and noise in electrical machines. There are many ways to calculate the harmonic force components. A general method is proposed to calculate the harmonic force components on teeth in this paper (it is available in ANSYS Maxwell v16). The period of data collection is based on rotating speed instead of the frequency of applied source. The nonuniform discrete Fourier transform (NDFT), which is a DFT with a non-uniform time interval, is applied to deal with the data transformation. Finally, the calculated harmonic force spectrums are applied to the harmonic response to determine the vibration of the structure. Validation and calculation results are also showed.