在Revit里所有的参数值可以分为5中类型:
None | None represents an invalid storage type. This value should not be used. |
Integer | The internal data is stored in the form of a signed 32 bit integer. |
Double | The data will be stored internally in the form of an 8 byte floating point number. |
String | The internal data will be stored in the form of a string of characters. |
ElementId | The 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