haplokuon / netDxf

.net dxf Reader-Writer
MIT License
995 stars 405 forks source link

Moved the exception for angular units being surveyor units #306

Closed framlingham closed 3 years ago

framlingham commented 3 years ago

I encountered a DXF with the setting, but no angular measurements (or at least I wasn't writing a DXF). I wanted to be able to read it, so I moved the exception from DimensionStyle.DimAngularUnits to DimensionBlock.FormatDimensionText. It could be done with a setting, but this way seemed cleanest. Please let me know if you'd like a different approach.

haplokuon commented 3 years ago

The root of the problem is that you cannot define the angular units as "Surveyor Units" for a dimension style, there is no option for that in the AutoCad UI; and, although, that option is available in its equivalent DIMAUNIT according to the official DXF documentation for the header variables. In the AutoCad reference documentation that option is nowhere to be found but you can change that value through the command line. So, who to trust.

In any case you cannot use surveyor units to create angular dimensions, so my only suggestion is to change that value to the default Decimal Degrees when reading the dimension styles, or perhaps to Degrees, Minutes, and Seconds; since it is closet thing to the surveyor units description shown in the documentation for the AUNITS system variable.

framlingham commented 2 years ago

I agree that it's a problem that Surveyor Units got in there, and that there's probably no option in the AutoCad UI. Yet somehow this file had it selected. I am unsure how to do that when calling public static DxfDocument Load(string file, IEnumerable<string> supportFolders) with a file given by a customer. I'd really like to be able to read the rest of the file, so would you please reconsider or suggest an alternative?