UnitSystem

返回或设置文档的单位系统。详情请参考 Rhino 帮助文档中关于 文档属性 的部分。

语法

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

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

参数

unit_system

可选参数。数字。单位系统。有效的单位系统如下:

描述

0

没有单位系统

1

微米 (1.0e-6 米)

2

毫米 (1.0e-3 米)

3

厘米 (1.0e-2 米)

4

5

千米 (1.0e+3 米)

6

维英尺 (2.54e-8 米, 1.0e-6 英寸)

7

Mils (2.54e-5 米, 0.001 英寸)

8

英寸 (0.0254 米)

9

英尺 (0.3408 米, 12 英寸)

10

Miles (1609.344 米,5280 英尺)

11

* 为自定义单位系统预留 *

12

埃(1.0e-10 米)

13

纳米 (1.0e-9 米)

14

分米 (1.0e-1 米)

15

十米 (1.0e+1 米)

16

百米 (1.0e+2 米)

17

兆米 (1.0e+6 米)

18

百万公里 (1.0e+9 米)

19

码 (0.9144  米, 36 英寸)

20

打印点 (1/72 英寸,计算机点)

21

打印 pica (1/6 英寸,计算机 pica)

22

海里 (1852 米)

23

极大 (1.4959787e+11)

24

光年 (9.46073e+15 米)

25

秒差距 (3.08567758e+16)

scale

可选参数。布尔值。用新的单位系统缩放现有的几何体。如果没有指定,不会缩放任何现有的几何体(False)。

in_model_units

可选参数。布尔值。返回或修改文档的模型单位(True)或文档的页面单位(False)。默认值为 True 。

返回值

数字

如果没有指定 unit_system 参数,返回当前的单位系统。

数字

如果指定了 unit_system 参数,返回先前的单位系统。

None

如果执行不成功或出错,返回空值。

示例

import rhinoscriptsyntax as rs

rhUnitMillimeters = 2

rhUnitInches = 8

current_system = rs.UnitSystem()

if current_system==rhUnitMillimeters:

    rs.UnitSystem(rhUnitInches, True)

同见

UnitAbsoluteTolerance

UnitAngleTolerance

UnitCustomUnitSystem

UnitDistanceDisplayMode

UnitDistanceDisplayPrecision

UnitRelativeTolerance