Read the drawing units

Read the drawing units

Anonymous
Not applicable
2,213 Views
7 Replies
Message 1 of 8

Read the drawing units

Anonymous
Not applicable

Hi,

 

Is there a way to read the drawing units (the value set with the -DWGUNITS command)? I could not find any API or variable holding this information.

0 Likes
2,214 Views
7 Replies
Replies (7)
Message 2 of 8

Ed__Jobe
Mentor
Mentor

You can use ThisDrawing.GetVariable and ThisDrawing.SetVariable to read/change these 3 variables:

INSUNITS, INSUNITSDEFTARGET, & INSUNITSDEFSOURCE

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 8

Anonymous
Not applicable

Thanks for the reply.

 

Unfortunately we already tried that, and is not what we are looking for. The value in INSUNITS* can be different from the one set with -DWGUNITS

0 Likes
Message 4 of 8

Jedimaster
Collaborator
Collaborator

Are you looking for LUNITS AUNITS?

0 Likes
Message 5 of 8

Jedimaster
Collaborator
Collaborator

Look into class AcUnits under AutoCAD library

 

acArchitectural
acDecimal
acDefaultUnits
acEngineering
acFractional
acScientific

On second though that is still not what your looking for

0 Likes
Message 6 of 8

Anonymous
Not applicable

Yep, still not what I am looking for. To make clarify it further:

 

When running the -DWGUNITS command, the following text is displayed in the command window:

Command: -DwgUnits

Drawing units:
1. Inches
2. Feet
3. Millimeters
4. Centimeters
5. Decimeters
6. Meters
Unit for length <3>:

[...]

 

We're interrested in reading that <3> value.

0 Likes
Message 7 of 8

martijn
Explorer
Explorer

It's an old topic, but I was looking for the same and I've found it.

<code>
Dim DWGUnits As Integer
DWGUnits = ThisDrawing.GetVariable("INSUNITS")
</code>

Hope this helps any people looking for the same in the future

0 Likes
Message 8 of 8

Jedimaster
Collaborator
Collaborator

Was just working with INSUNITS... weird.

0 Likes