public static IList<Element> GetManyRefByRectangle(UIDocument doc)
{
ReferenceArray ra = new ReferenceArray();
ISelectionFilter selFilter = new MassSelectionFilter();
IList<Element> eList = doc.Selection.PickElementsByRectangle(selFilter,
"Select multiple faces") as IList<Element>;
return eList;
}
//重写两个方法,添加过滤条件。
public class MassSelectionFilter : ISelectionFilter
{
public bool AllowElement(Element element)
{
if (element.Category.Name == "Mass")
{
return true;
}
return false;
}
public bool AllowReference(Reference refer, XYZ point)
{
return false;
}
}
from:http://revit.5d6d.com/thread-1220-1-1.html