A new method for dynamics of mechanical systems has been established and the new use of the optimum software has been shown in this paper. Gauss’ principle in the theory of mechanics has been employed to transform the dynamical control and simulation into the quadratic programming problems, which makes it possible that the optimum software developed in CAD systems is applied to obtain the dynamics of mechanical systems. Such a method is significant for systems which contain complex motion and constraints, since there is no longer necessity of reducing the analytical dynamic models, which are tedious and even impossible to obtain. Morever, it gives a new way of applying the optimum software package. The dynamics of a robot with sliding and revolving joints has been demonstrated in detail.