Revit API相交过滤BoundingBoxIntersectsFilter
2011-10-13 08:41
357 查看
根据一线条,过滤与之相交的元素。
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdFilter : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Transaction ts = new Transaction(uiDoc.Document, "revit.5d6d.com");
ts.Start();
//与outLine相交的元素,比较多,有相机,测试点,项目基点,墙,风管,只要是相交的。
Outline outLine = new Outline(new XYZ(0, 0, 0), new XYZ(100, 100, 100));
BoundingBoxIntersectsFilter filter = new BoundingBoxIntersectsFilter(outLine);
FilteredElementCollector collector = new FilteredElementCollector(uiDoc.Document);
IList<Element> elems = collector.WherePasses(filter).ToElements();
foreach (Element el in elems)
{
TaskDialog.Show("all", el.Name + "|" + el.Category.Name);
}
//与outLine相关的墙,第二个参数为false可以得到相交的墙,为true得不到,有待研究。
BoundingBoxIntersectsFilter invertFilter = new BoundingBoxIntersectsFilter(outLine, false);
collector = new FilteredElementCollector(uiDoc.Document);
IList<Element> noIntersectWalls = collector.OfClass(typeof(Wall)).WherePasses(invertFilter).ToElements();
foreach (Element el in noIntersectWalls)
{
TaskDialog.Show("wall", el.Name + "|" + el.Category.Name);
}
//
TaskDialog.Show("count", elems.Count + "|" + noIntersectWalls.Count);
ts.Commit();
return Result.Succeeded;
}
}from:http://revit.5d6d.com/thread-1270-1-1.html
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdFilter : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Transaction ts = new Transaction(uiDoc.Document, "revit.5d6d.com");
ts.Start();
//与outLine相交的元素,比较多,有相机,测试点,项目基点,墙,风管,只要是相交的。
Outline outLine = new Outline(new XYZ(0, 0, 0), new XYZ(100, 100, 100));
BoundingBoxIntersectsFilter filter = new BoundingBoxIntersectsFilter(outLine);
FilteredElementCollector collector = new FilteredElementCollector(uiDoc.Document);
IList<Element> elems = collector.WherePasses(filter).ToElements();
foreach (Element el in elems)
{
TaskDialog.Show("all", el.Name + "|" + el.Category.Name);
}
//与outLine相关的墙,第二个参数为false可以得到相交的墙,为true得不到,有待研究。
BoundingBoxIntersectsFilter invertFilter = new BoundingBoxIntersectsFilter(outLine, false);
collector = new FilteredElementCollector(uiDoc.Document);
IList<Element> noIntersectWalls = collector.OfClass(typeof(Wall)).WherePasses(invertFilter).ToElements();
foreach (Element el in noIntersectWalls)
{
TaskDialog.Show("wall", el.Name + "|" + el.Category.Name);
}
//
TaskDialog.Show("count", elems.Count + "|" + noIntersectWalls.Count);
ts.Commit();
return Result.Succeeded;
}
}from:http://revit.5d6d.com/thread-1270-1-1.html
相关文章推荐
- osgEarth相交过滤 19. intersect_filter.earth
- Revit二次开发——加快过滤速度,以及对ElementIntersectsSolidFilter的API的Bug的处理办法
- Revit API之BoundingBoxXYZ的用法和剖面框(Section Box)
- 过滤器(Filter)应用之------设置页面缓存、用户的自动登录和敏感词过滤
- Filter 过滤程序 过滤非法ip地址
- 3D空间中的AABB(轴向平行包围盒, Aixe align bounding box)的求法
- Cocos2d-x之getVisibleSize,getContentSize,boundingBox,getContentSizeInPixels,convertToGL,convertToUI
- 用于过滤IP的Filter
- php中filter_var后面的过滤选项
- filter(过滤不合法字符)(param)(textarea)(indexof("晕"))(form)
- Elasticsearch 2.3 查询与过滤(query and filter)
- scrapy 爬虫过滤相同的url,Filtered duplicate request,dont_filter
- Bounding box 回归
- tf.image.crop_to_bounding_box的用法
- 目标检测算法中的bounding box regression
- php-Arrays 函数-array_filter-用回调函数过滤数组中的单元
- EditTextPreference InputFilter过滤字符串及限制长度的实现
- 在SpringMVC中使用过滤器(Filter)过滤容易引发XSS的危险字符
- 安装事件过滤器(installEventFilter) ,过滤子控件事件,截获控件按键、鼠标事件
- File System Minifilter Drivers(文件系统微型过滤驱动)入门