Revit族和过滤元素
我需要按系列过滤选定的元素。
我们有一个木梁系列,我只需要修改属于木梁系列的选定元素。
//get all instaces if family objects
FilteredElementCollector familyInstanceCollector =
new FilteredElementCollector(doc);
familyInstanceCollector.OfClass(typeof(FamilyInstance))
.WherePasses(new FamilySymbolFilter(new ElementId(140519)));
MessageBox.Show(familyInstanceCollector.Count<Element>().ToString());
foreach (Element element in familyInstanceCollector)
MessageBox.Show(element.Name);
I need to filter the selected elements by family.
We have a timber beam family and I need to modify only selected elements that are part of the timber family.
//get all instaces if family objects
FilteredElementCollector familyInstanceCollector =
new FilteredElementCollector(doc);
familyInstanceCollector.OfClass(typeof(FamilyInstance))
.WherePasses(new FamilySymbolFilter(new ElementId(140519)));
MessageBox.Show(familyInstanceCollector.Count<Element>().ToString());
foreach (Element element in familyInstanceCollector)
MessageBox.Show(element.Name);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定创建这样的新 ElementId 是否有效,并且我不确定您是否可以预测跨项目的 ElementId?最好的方法是先进行过滤器来搜索您要查找的系列符号,然后使用该结果查找实例。
查看 SDK 中的 .chm 文件,以下是其中的示例:
I'm not sure if creating a new ElementId like that will work, and I"m not sure if you can predict the ElementId across projects anyhow? Best way would be to do a filter to search for the family symbol you are looking for first, then use that result to find the instances.
Check out the .chm file that comes in the SDK, here's a sample from it: