A novel pre-process method is proposed for magnetic field approximation based on neural networks. The process of calculating magnetic field based on neural network is presented in Figure 1. In order to save the training time and reduce the estimation error, an excitation distance function (EDF), which is inspired by an analytical formula of magnetic potential, is proposed to integrate the input data, such as the geometry, excitations, and boundaries. This pre-processor roughly reduces the dimension of the input layer by three quarters, while the training process is accelerated by a more integrated input layer. Two types of neural network architectures, namely, multi-layer perception (MLP) and modified U-Net [1] (see Figure 2), are investigated. Preliminary experiments on nonlinear transformer problem show that predicted results by the proposed pre-processing method is close to the ground truth (see Figure 3), with a significant reduction of computation time compared with the traditional finite element method.