This paper describes an algorithm for automatic mesh generation based on the advancing front method. Within its framework, an original solution for updating the front has been developed. It has been shown that updating, after forming a new element using an existing front node, can be reduced in practice to only four possible cases. Procedures after the occurrence of each of them have been presented. Using the developed algorithm, appropriate software support for automatic mesh generation has been developed, which can be used to solve various problems using the numerical finite element method. Discretization of the machine cross-section is critical for the accuracy of the numerical procedure for nonlinear electromagnetic calculation of a switched reluctance motor, performed using the finite element method. The paper also develops a procedure for renumbering nodes and elements, as well as its associated software support, because the generation of the mesh of the aforementioned segments needs to be integrated into a single mesh of the entire machine cross-section. Finally, a nonlinear electromagnetic calculation and characteristics of a laboratory prototype of a switched reluctance motor, necessary for the creation of its mathematical model, have been performed. The developed software support, together with a program for nonlinear motor calculation, enables the design and analysis of SRM operation, regardless of its nominal data, number of poles or dimensions.