Getting imperial or metric drawing units

Nov 2, 2015 at 3:34 PM

Thanks for this fantastic library.

I need to find out if a dxf is using imperial or metric units, which I understand is given in the 'MEASUREMENT' header variable. However, I can't find this in the DrawingVariables.

I'm wondering if anyone can tell me how I can find out what units the dxf is using?
Nov 3, 2015 at 6:36 AM
Yes, there is a variable that specifies if the units are metric or imperial, and perhaps I should add it. There is also the drawing variable LUnits that should supersede that since is there where you can exactly say the specific metric or imperial unit to use, or a Unitless that is neither metric nor imperial. Try it out to see if with that variable is enough for you; in any case, I will need to test them in case contradictory information is supplied by those two variables and check which one overrides the other. That MEASUREMENT header variable should be useless, perhaps it is just a remnant of old versions, I don't know, but this duplicity of information only leads you to confusion.

Nov 16, 2015 at 2:14 PM
Hi Daniel,

In my test file using .net dxf the LUnits variable just reads 'decimal' which could be either metric or imperial. On the other hand the measurement parameter (when I read the text in the file), has a value of 0 which according to the spec at indicates that it's in imperial units.

The only thing I can find in the DrawingVariables which seems to indicate metric or imperial in the INSUNITS, which is inches in my case. However, as I understand it this parameter is only about blocks, and besides I think my example dxf is in feet.

It would definitely be very useful if a parameter could be added to indicate what units the overall drawing is in.

Thanks Again
Nov 17, 2015 at 6:10 PM
Sorry if I am not being very precise or even making mistakes, but I do not have Internet connection from the last couple of months and I am writing from memory, and I do not always have my stuff at hand.

The LUnits header variable is just used by the length dimensions to write the measurement, sorry. It is the InsUnits variable the one that defines the drawing units, this variable you really need to check. This variable is not only used by blocks but by whole drawings, bear in mind that you are able to insert drawing into another drawings as you do with blocks.

The drawing units by themselves do no say much, as long as you are being consistent, they can be whatever you like. It is when you start to mix different mediums when this value kicks in, and by medium I mean your paper when you are printing, or the drawing you are inserting your file into. And, I guess, that is why it is called InsUnits in the dxf.

I think, I cannot check it right now, when you set your drawing to use imperial units, by default the drawing units are set to inches, since this is what the length dimensions assumes when using an imperial LUnits type (Architectural or Engineering).