UnitSystem

Returns or sets the document's units system.  See Rhino's DocumentProperties command (Units and Page Units windows) for details.

Syntax

rhinoscriptsyntax.UnitSystem (unit_system=None, scale=False, in_model_units=True)

rhinoscript.document.UnitSystem (unit_system=None, scale=False, in_model_units=True)

Parameters

unit_system

Optional.  Number.  The units system.  The available units systems are as follows:

Value

Description

0

No unit system

1

Microns (1.0e-6 meters)

2

Millimeters (1.0e-3 meters)

3

Centimeters (1.0e-2 meters)

4

Meters

5

Kilometers (1.0e+3 meters)

6

Microinches (2.54e-8 meters, 1.0e-6 inches)

7

Mils (2.54e-5 meters, 0.001 inches)

8

Inches (0.0254 meters)

9

Feet (0.3408 meters, 12 inches)

10

Miles (1609.344 meters, 5280 feet)

11

* Reserved for Custom Unit System *

12

Angstroms (1.0e-10 meters)

13

Nanometers (1.0e-9 meters)

14

Decimeters (1.0e-1 meters)

15

Dekameters (1.0e+1 meters)

16

Hectometers (1.0e+2 meters)

17

Megameters (1.0e+6 meters)

18

Gigameters (1.0e+9 meters)

19

Yards (0.9144  meters, 36 inches)

20

Printer point (1/72 inches, computer points)

21

Printer pica (1/6 inches, (computer picas)

22

Nautical mile (1852 meters)

23

Astronomical (1.4959787e+11)

24

Lightyears (9.46073e+15 meters)

25

Parsecs (3.08567758e+16)

scale

Optional.  Boolean.  Scale existing geometry based on the new unit system.  If not specified, any existing geometry is not scaled (False).

in_model_units

Optional.  Boolean.  Return or modify the document's model units (True) or the document's page units (False). The default is True.

Returns

Number

If unit_system is not specified, then the current unit system if successful.

Number

If unit_system is not specified, then the previous unit system if successful.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

rhUnitMillimeters = 2

rhUnitInches = 8

current_system = rs.UnitSystem()

if current_system==rhUnitMillimeters:

    rs.UnitSystem(rhUnitInches, True)

Also See

UnitAbsoluteTolerance

UnitAngleTolerance

UnitCustomUnitSystem

UnitDistanceDisplayMode

UnitDistanceDisplayPrecision

UnitRelativeTolerance