c++ – OBJ file has more vertices than normals

See this page for a great analysis of the OBJ format. In an OBJ file, vertex normals are associated with vertices where the faces are defined. Faces are defined along the bottom of the file, on lines starting with f, e.g.

f 632/996/280 638/997/280 637/971/280

Each triplet consists of a vertex index, texture vertex index, and vertex normal index. So that answers how normals are mapped to vertices. So this example face has three vertices (a triangle).

The first part of your question I’m not 100% certain about. Since the vertex normals and vertices are referenced by index, we could reduce the file size by merging any duplicates into a single index. So for example, if this vertex normal appeared in the file 5 times

vn -0.66051400 -0.44590101 -0.60406399

we could prune the 4 duplicates and remap their indices to the first index. However, your OBJ file does still contain some duplicate vertex normals, so either duplicates are not pruned at all, or SolidWorks just doesn’t do it thoroughly.