Is there a Unit Conversion API in Autocad .NET ?

Is there a Unit Conversion API in Autocad .NET ?

Anonymous
Not applicable
1,858 Views
1 Reply
Message 1 of 2

Is there a Unit Conversion API in Autocad .NET ?

Anonymous
Not applicable

Hello,

 

I know that autocad drawings do use "units" internally and are not bound to a milimeters or whatever other specific unit. But you can set the drawings units in the format menu, which I suppose is like saying "Hey, you should interpret the "units" as "milimeters/meters/inches/miles...".

 

AFAIK in the API I can get "Aunits" and "Insunits" which I suppose are the units that should be used in the interpretation of tha drawing. What is the difference between both?

 

Does Autocad .NET provide any conversion APIs so that I can transform, for example, a line length, from the current unit to another one? I see there is a UnitConverter class but I can't figure out how to use it and I can't find any documentation or examples about this.

 

Thank you very much.

0 Likes
1,859 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I found it, just in case someone has the same problem:

 

UnitsConverter.GetConversionFactor(UnitsValue from, UnitsValue to);

 

This method gives you the required multiplier to do the conversion. Building a conversion class is trivial now.