明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1012|回复: 1

【RevitAPI】过滤器,只选择与参考管段管材一致的管道

[复制链接]
发表于 2021-12-19 15:37 | 显示全部楼层 |阅读模式
本帖最后由 luowy 于 2021-12-19 15:41 编辑

  1. //注意这个收集器可以是一个文档,也可以是一个view,也可以是一个选择集,具体用哪个需要根据实际情况选取。这里以整个文档为例。
  2. FilteredElementCollector pipes = new FilteredElementCollector(m_document);
  3. BuiltInParameter pipesegmentPara = BuiltInParameter.RBS_PIPE_SEGMENT_PARAM;

  4. //这里生成一个Equal的规则,revitAPI提供了很多规则,比如大于,小于等等,还有混合的逻辑规则,下面的代码使用的是相同
  5. //与参数是管道管段相同的规则
  6. FilterRule fPipesegmentrRule = ParameterFilterRuleFactory.CreateEqualsRule(new ElementId((int)pipesegmentPara), m_pipe.get_Parameter(BuiltInParameter.RBS_PIPE_SEGMENT_PARAM).AsValueString(), false);
  7. ElementParameterFilter paraPipesegmentFilter = new ElementParameterFilter(fPipesegmentrRule);
  8. pipes = pipes.WherePasses(paraPipesegmentFilter);
复制代码

这样pipes就剩下与提供参数一致的管道了。
总结
这个ElementParameterFilter 是一个慢过滤器,需要结合快过滤器使用。
发表于 2022-2-11 07:10 | 显示全部楼层
且放白鹿青崖间 须行即骑访名山?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-29 15:34 , Processed in 0.226029 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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