Revit开发在链接模型中使用ISelectionFilter
2016-09-19 17:06
309 查看
在链接模型中使用ISelectionFilter,
关键代码:
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
IList<Reference> refs = uidoc.Selection.PickObjects(ObjectType.LinkedElement, new LinkSelectionFilter());
TaskDialog.Show("数量:", refs.Count().ToString());
public class LinkSelectionFilter : ISelectionFilter
{
RevitLinkInstance rvtIns = null;
public bool AllowElement(Element elem)
{
if (elem is RevitLinkInstance)
{
rvtIns = elem as RevitLinkInstance;
return true;
}
return false;
}
public bool AllowReference(Reference reference, XYZ position)
{
Document doc = rvtIns.GetLinkDocument();
Element elm = doc.GetElement(reference.LinkedElementId);
if (elm is Pipe)
return true;
return false;
}
}
博主会经常更新一些技术文章,请大家多多关注,
源码下载请加qq群480950299
关键代码:
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
IList<Reference> refs = uidoc.Selection.PickObjects(ObjectType.LinkedElement, new LinkSelectionFilter());
TaskDialog.Show("数量:", refs.Count().ToString());
public class LinkSelectionFilter : ISelectionFilter
{
RevitLinkInstance rvtIns = null;
public bool AllowElement(Element elem)
{
if (elem is RevitLinkInstance)
{
rvtIns = elem as RevitLinkInstance;
return true;
}
return false;
}
public bool AllowReference(Reference reference, XYZ position)
{
Document doc = rvtIns.GetLinkDocument();
Element elm = doc.GetElement(reference.LinkedElementId);
if (elm is Pipe)
return true;
return false;
}
}
博主会经常更新一些技术文章,请大家多多关注,
源码下载请加qq群480950299
相关文章推荐
- Revit开发之选择链接模型中的构件
- MDD:使用模型驱动开发方式进行快速开发(多图预警)
- iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
- 使用C++开发动态链接库的过程总结
- ios开发网络学习二:URL转码以及字典转模型框架MJExtension的使用
- 使用Revit 2015+VS2013搭建开发环境并实现helloWorld插件的小例子
- Revit开发之内建模型
- 【Python开发】python使用urllib2抓取防爬取链接
- Revit开发设置模型线颜色
- 【汇编语言/底层开发】4、使用masm编译、链接汇编源文件
- iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
- RevitAPI: 如何获取RevitLinkInstance链接模型的位置?
- php 5X 使用自带的sqlite3链接数据库,PDO链接sqlite(低成本开发)(一)
- iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
- chrome开发人员工具使用链接整理
- iOS开发中的使用kvc快速将字典模型转换成model模型。
- OS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
- 火云开发课堂 - 《Shader从入门到精通》系列 第十六节:在Shader中对3D模型使用纹理
- Android开发之如何在WebView中点击链接使用自身打开(解决出现的选择使用第三方应用的问题)
- ArcGIS API for javascript开发笔记(五)——GP服务调用之GP模型的发布及使用详解