如何选择链接文件中的实例

来源:互联网 发布:沈阳淘宝网店推广 编辑:程序博客网 时间:2024/05/17 04:12

1、过滤

public class Filter : ISelectionFilter    {        public Document doc = null;        public bool AllowElement(Element elem)        {            return true;        }        public bool AllowReference(Reference reference, XYZ position)        {            Element elem = doc.GetElement(reference.ElementId);            RevitLinkInstance rvtLinkInstance = elem as RevitLinkInstance;            Document linkDoc = rvtLinkInstance.GetLinkDocument();            if (linkDoc != null)            {                Element element = linkDoc.GetElement(reference.LinkedElementId);                if (//条件判断)                {                    return true;                }            }            return false;        }    }
2、选择器

uiDoc.Selection.PickObjects(ObjectType.LinkedElement, new Filter() { doc = doc });





0 0