您的位置:首页 > 其它

Revit开发之参数详解

2016-09-07 12:33 225 查看
在Revit里所有的参数值可以分为5中类型:

NoneNone represents an invalid storage type. This value should not be used.
IntegerThe internal data is stored in the form of a signed 32 bit integer.
DoubleThe data will be stored internally in the form of an 8 byte floating point number.
StringThe internal data will be stored in the form of a string of characters.
ElementIdThe data type represents an element and is stored as the id of the element. 
每个Paramter的参数值类型可以通过Parameter.StorageType来判断

StorageType是一个枚举包含了上面5中参数值类型,

对于StorageType为StorageType.None的参数,不能通过Parameter.Set()来设置,

也不能重Parameter直接获取到它的值。

对于Integer可以通过Parameter.AsInteger()来获取它们的值

对于Double可以通过Parameter.AsDouble()来获取他们的值,这个返回的是一个英尺单位的值,

还可以通过Parameter.AsValueString(),获取它对于的毫米单位值对应的String。

(比如有一个200.0,你通过AsDouble()得到的是200.0转换的英尺的值,而用AsValueString()得到一个为 “200.0“  的string)

对于String可以通过Parameter.AsString()来获取他们的值

对于ElementId 可以通过Parameter.AsElementId()来获取他们的值

在Set值的时候

传入的参数一定要个Parameter的StorageType对应起来

博主会经常更新一些技术文章,请大家多多关注,多多交流

更多技术交流,请加qq群480950299
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: