It's the same with me. I've tried adding each of those codes (100, 5, etc.), but to no avail. My .dxf file opens fine and displays other shapes, solids, points, etc. However, if I add the LWPOLYLINE code, the .dxf file will no longer open successfully. What am I missing? What am I doing wrong? Here's my LWPOLYLINE code:
0
LWPOLYLINE
8
SHP
90
4
10
2.0
20
2.0
10
4.0
20
2.0
10
4.0
20
4.0
10
2.0
20
4.0
70
1
39
2.0
Is your dxf file an entities only file (i..e only has an ENTITIES section) like that of the original poster? If so, then that won't work because AutoCAD considers entities only dxf files to be R12 version files and R12 didn't have lwpolylines.
Also, for lwpolyline you must have the group 100s - they are necessary for all entity types that are new since R12.
You shouldn't need the classes section. You also should not need the 330 in the lwpolyline. But, you absolutely need the group 5 which is the polyline's handle. Also, within the polyline's data you need to be sure that you have the right group codes after the right group 100s. The group 100s tell the dxf parser which C++ object class owns the data that follows so that class is then used to read in that data.
The best way to find out what is required and what is not is to use AutoCAD to create a dxf file of a polyline and then take that dxf file and start removing certain group codes and try to read the file back into AutoCAD. If the group code isn't required, the file will read in, but if the group code is required, then the file won't read in.