Abaqus finite element software can implement three-dimensional excavation design calculation, so authors used Python of Abaqus core language made the 3D design of foundation pit supporting program come ture and also did intensive study of mesh optimization during the process. Authors also did intensive comparison and analysis about grid division of the complex geometry foundation pit, through a regularization partion about a variety of special-shaped pit, we made the automatic division about the structural grid of all kinds of shapes foundation pit successful. On this basis, we achieved better calculation effects of the model. The article will introduce problems about optimization of grid in procedure.