Procedure GetUnits returns the current units settings of the document.
{| class="wikitable_c" |+ Table - Units Formats ! Units Format
| ! Constant |
|---|
| Decimal |
| style="text-align:center" |
| - |
| Fractional |
| style="text-align:center" |
| - |
| Decimal Ft/Inches |
| style="text-align:center" |
| - |
| Fractional Ft/Inches |
| style="text-align:center" |
| } |
More extensive Units information is available using the [[VS:GetPref]] routines with the selectors shown in the tables of the [[VS:Function Reference Appendix#Primary Units Selectors|VectorScript Appendix]].
PROCEDURE GetUnits(
VAR fraction : LONGINT;
VAR display : LONGINT;
VAR format : INTEGER;
VAR upi : REAL;
VAR name : STRING;
VAR squareName : STRING);def vs.GetUnits():
return (fraction, display, format, upi, name, squareName)| Name | Type | Description |
|---|---|---|
| fraction | LONGINT | Approximate WorldCoords per drawing unit. Use GetPrefReal(150) instead. |
| display | LONGINT | Returns display accuracy. |
| format | INTEGER | Returns units format setting. |
| upi | REAL | Returns units per inch value. |
| name | STRING | Returns unit mark. |
| squareName | STRING | Returns square unit mark. |
Another way to get the UPI is to use: UPI := GetPrefReal(152);
==== VectorScript ====
PROCEDURE Example;
VAR
fraction :LONGINT;
display :LONGINT;
format :INTEGER;
upi :REAL;
name :STRING;
squareName :STRING;
BEGIN
GetUnits(fraction, display, format, upi, name, squareName);
Message(fraction, ' ', display, ' ', format, ' ', upi, ' ', name, ' ', squareName);
END;
RUN(Example);==== Python ====
def Example():
fraction, display, format, upi, name, squareName = vs.GetUnits()
vs.Message(fraction, ' ', display, ' ', format, ' ', upi, ' ', name, ' ', squareName)
Example()Availability: from All Versions
- Units