VS:GetUnits

From Vectorworks Developer
Revision as of 14:33, 12 August 2013 by Root (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure GetUnits returns the current units settings of the document.

Table - Units Formats
Units Format Constant
Decimal 0
Fractional 1
Decimal Ft/Inches 2
Fractional Ft/Inches 3

More extensive Units information is available using the VS:GetPref routines with the selectors shown in the tables of the 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)

Parameters

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.

Remarks

Another way to get the UPI is to use:

UPI := GetPrefReal(152);

Example

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()

Version

Availability: from All Versions