ixmilia / dxf

MIT License
203 stars 65 forks source link

Don't allow invalid values to be set. #58

Closed brettfo closed 7 years ago

brettfo commented 8 years ago

This is a larger issue encompassing many smaller items, specifically, but not necessarily limited to:

During all of this, I'd like to follow the idea that this library will be able to open nearly any DXF file, valid or otherwise to avoid the situation that AutoCAD is in, namely that it's the most complete/correct implementation but it's rather fussy about what it will accept and easy to make crash.

arendvw commented 7 years ago

For the sanity checks on e.g. leaders and polylines, Rhino and RhinoCommon have the solution to add a IsValid method to each entity / kind of geometry. This allows for files to be read and written, but also allows the developers using this library to check themselves what to do with these potentially invalid cases.

The IsValid logic can be added / extended for each entity, e.g. having values to check if certain Radii in arcs are =< 360, or other sanity checks on geometry.

brettfo commented 7 years ago

My thinking for the last two items is something like this:

brettfo commented 7 years ago

As a quick follow-up, I've fixed the line-type issue. The only remaining item for this issue is the LEADER and POLYLINE vertex counts.

brettfo commented 7 years ago

All cases mentioned by this issue should have now been addressed.