Automatic recognition of features from CAD models is one of the key technologies for mesh generation. This paper studies the algorithm for automatic recognition of features from CAD models in STL data format. Firstly, a new STL data file with topological connection is constructed for the calculation. Secondly, the coplanar relationships among all the triangle facets are constructed initially. The third step is to determine whether all the boundary edges on the same face can make up an end to end closed circle. And the boundary edges are filled out by combining the edge-based method and the face-based method. Fourthly, the solid model face, feature lines and feature point are recognized. Finally, two examples are given to prove the feasibility and validity of the algorithm.