Reference refer = uidoc.Selection.PickObject(ObjectType.Face,new FaceFiler(doc), "");
PlanarFace face = doc.GetElement(refer).GetGeometryObjectFromReference(refer) as PlanarFace;
过滤器一般性设置
public class FaceFiler : ISelectionFilter
{
Document doc = null;
public FaceFiler(Document document)
{
doc = document;
}
public bool AllowElement(Element elem)
{
return true;
}
public bool AllowReference(Reference reference, XYZ position)
{
if (doc.GetElement(reference).GetGeometryObjectFromReference(reference) is PlanarFace)
{
return true;
}
return false;
}
}