Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LWPOLYLINE, is closed, one vertex = error #20

Closed
verner-lall opened this issue Feb 9, 2018 · 3 comments
Closed

LWPOLYLINE, is closed, one vertex = error #20

verner-lall opened this issue Feb 9, 2018 · 3 comments

Comments

@verner-lall
Copy link

I have a dxf file exported from autocad. For some reason there's like 9 lwpolylines in there that have only one vertex and the closed attribute.
{ type: 'LWPOLYLINE', vertices: [ { x: 294.598692, y: 168.66373 } ], layer: '0', colorNumber: 7, closed: true, transforms: [] }
Now I understand this could be a pointless entity, but it throws an error in entityToPolyline.js on line 110, because the resulting polyline array is empty, so no polyline[0][0] or [0][1] values exist.

Should we catch this sort of error in this library? LibreCAD and AutoCAD have no problems opening this file.

@bjnortier
Copy link
Collaborator

I'll add a test case for this. I think the policy should be that warnings are generated for these kind of "illegal" entities, but that it shouldn't fail

@bjnortier
Copy link
Collaborator

Published as 3.1.0. You can close this issue is you're satisfied

@bjnortier
Copy link
Collaborator

FYI there's been a fix for another issue, #21, which will change the behaviour for this case slightly.

From 3.1.1, if a "closed" polyline with one vertex is encountered, the result will be a polyline with two vertices at the same position. I believe this is better than returning an empty polyline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants