Object detection function of turnout and switch mechanism is one of an important function for safety of railway system. An object between a tongue rail and a stock rail on a turnout is detected by a lock mechanism of a switching machine and circuit controllers, which are applied on high-speed railway. Designer of switch mechanism has checks his detecting function design by experiments, which were sole way to check it, using real turnout and switch mechanism. In this paper, we described an equation of motion of the switch mechanism and the turnout using multi-body dynamics and flexible multi-body. Moreover, we described a method, which calculate shape of tongue rails inserted an object between rails. By results of calculations, we confirmed that the proposed method could simulates the shape of rails, which is affected by object. Computing time is 40% shorter than an experiment, however, the result includes an error which causes that the model was assumed deformation of tongue rails as 2-d deformation.