Revit中如何通过柱子找到他连接的所有墙?


问题:如何通过柱子找到他连接的所有墙?


柱子和墙之间的关系无法直接通过API来获得,只能通过相交过滤间接来获得。

你可以直接用 ElementIntersectsElementFilter 或ElementIntersectsSolidFilter 这两个过滤条件类来实现。


这两个类的用法请参考RevitAPI.chm文档。


ElementIntersectsSolidFilter需要你给定一个Solid,然后就会找到与指定Solid相交的其他构件。

示例代码如下:

// Find intersections between family instances and a selected element
Reference reference = uidoc.Selection.PickObject(ObjectType.Element, "Select element that will be checked for intersection with all family instances");
Element element = doc.GetElement(reference);
GeometryElement geomElement = element.get_Geometry(new Options());
Solid solid = null;
foreach (GeometryObject geomObj in geomElement)
{
    solid = geomObj as Solid;
    if (solid != null) break;
}

FilteredElementCollector collector = new FilteredElementCollector(doc);
collector.OfClass(typeof(FamilyInstance));
collector.WherePasses(new ElementIntersectsSolidFilter(solid)); // Apply intersection filter to find matches

TaskDialog.Show("Revit", collector.Count() + " family instances intersect with the selected element (" + element.Category.Name + " id:" + element.Id + ")");


如此类推,你可以获取柱子的Solid,传给ElementIntersectsSolidFilter的实例来获取与柱子相交的构件,过滤出墙即可。


作者:叶雄进, Autodesk特聘二次开发咨询专家, 橄榄山软件首席研发

转载请注明原文出处:http://blog.csdn.net/joexiongjin/article/details/41090861

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值