A method was proposed,which can generate the working principle animation automatically based on SolidWorks.With the application programming interface(API) of SolidWorks and advanced language,the relative links between the static assembly relationship of parts and their regular movement were established.The method realizes the automatic generation of the interactive animation of working principle.It improves the efficiency of the establishment of virtual training system.