gdsestimating / dxf-parser

A javascript parser for DXF files. It reads DXF file strings into one large javascript object with more readable properties and a more logical structure.
MIT License
462 stars 143 forks source link

final vertex of 3DFACE not being added to entity vertex list when encountering a code other than 0 #112

Open Vykaash opened 1 year ago

Vykaash commented 1 year ago

In some dxf, especially when revit is involved, data might be contained like the following:

3DFACE
... removed for brevity
 13
511577.6488682699
 23
1365679.835179607
 33
80.42828687855729
1001 <<<<< REVIT DATA - EXPECTED 0
REVIT

parse3DFaceVertices will collect 13,23,33 as expected but because the following code is 1001 instead of 0, it leaves the function without pushing that final vertex into vertices. due to this many quads end up as triangles.

I propose adding one final check for vertexIsStarted and pushing that vertex in so that quads will be formed properly.

Thanks!