A CAD-based methodology for planar and cylindrical feature recognition