EaBIM一直以来积极响应国家“十二五”推进建筑业信息化的号召,对建筑领域的信息技术开展深入技术交流和探讨!致力于打造“BIM-建筑师-生态技术”三位一体综合资源交流共享平台,希望为BIM与可持续设计理念及技术的普及做出微小的贡献!!!

EaBIM

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 635|回复: 1
打印 上一主题 下一主题

Parameter of Revit API – 2: Find Right BuiltInParameter

[复制链接]

1514

主题

7465

帖子

1万

积分

admin

Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10

积分
12404

社区QQ达人

跳转到指定楼层
楼主
发表于 2014-1-9 12:27:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

In this post, let’s see how Parameter Retriever of RevitAddinWizardcan help find the right BuiltInParameter value in no time and create the parameter retrieving help method accordingly in a class of the current Revit addin project.

Parameter Retriever can be found from both the menu and the toolbar of the Revit Addin Coder:
If the Parameter Retriever is launched it will look like this at first:



All values of the BuiltInParameter enumerator will be found and listed out in the top ListBox. As we know, there are thousands of such values and it is really hard to find the right parameter most of times.

The Parameter Retriever provides three keywords to help filter the huge amount of enumerator values. For example, if we’d like to find the window width parameter as we talked previously, we can specify the WINDOW as the first keyword and click the Update button:


At this moment, the list becomes shorter and every item contains the WINDOW keyword. However, the list is still long enough and it will take time to check one by one to see which may be the one of interest. No worry. We can specify another keyword, WIDTH here, and click the Update button again:


Now it’s good that only three are left and it is very easy to find the right one now, WINDOW_WIDTH. If the element type (FamilySymbol) is highlighted, the method name is given, and a class is chosen, the following code will be created into the class as a help method:

        public static Parameter GetWindowWidthFromFamilySymbol(FamilySymbol e)
        {
            return e.get_Parameter(BuiltInParameter.WINDOW_WIDTH);
            
        }
If necessary, the third keyword can be specified as well to narrow down the list further. In this particular case, it does not make sense, but for many others it really does.
Let’s take another case for example. If we’d like to find the BuiltInParameter value having something to do with room cooling load calculations, we can input ROOM, AREA, and LOAD as the keywords (order is irrelevant):


Since we are not sure which element type may carry this piece of information, we use the generic Element type as the argument type. Now the method will be added into the ExtCmd class like the following:

        public static Parameter GetRoomCoolingLoadPerArea(Element e)
        {
            return e.get_Parameter(BuiltInParameter.ROOM_CALCULATED_COOLING_LOAD_PER_AREA_PARAM);
            
        }
Parameter Retrieve of RevitAddinWizardcan help us find a BuiltInParameter enumerator value of interest and create the help method in no time. However, programmers still have to take the responsibility to figure out which type of Element may carry the parameter and in what situations. It needs quite some testing and inquiries sometimes but at least the BuiltInParameter seeking and the Parameter retrieving is not a big deal anymore.

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 转播转播 分享分享 分享淘帖 支持支持 反对反对
工作时间:工作日的9:00-12:00/13:30-18:00,节假日不在线,请勿留言
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|EaBIM网 ( 苏ICP备2020058923号-1  苏公网安备32011502011255号

GMT+8, 2024-11-16 17:41

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表