haplokuon / netDxf

.net dxf Reader-Writer
MIT License
986 stars 400 forks source link

Add support to skip Leaders that don't have enough points. #304

Closed framlingham closed 3 years ago

framlingham commented 3 years ago

I really appreciate your library, and would love to see another update. Towards that end, I have tried to read a DXF file made with a converter, and it had some single point leaders in it. The rest of the file had good data when I skipped the bad leaders. I previously attempted to fix the issue by allowing single point leaders by assuming a horizontal text angle, but that changed a lot more code and might not be wanted, since (I think) AutoCad doesn't like leaders with just 1 point either.

I'm not sure if I added the option the right way - If that's wrong somehow, please let me know how you'd like it and I will have a go at it.

Example file: Civil Drawings AutoCAD2000.zip

haplokuon commented 3 years ago

Fair enough, but it does not require so many changes, just return null in the ReadLeader method when the number of vertexes is less than two. Having the option to skip those leaders is not necessary since the Leader constructor will not allow to create them hence the exception when trying to load the file.