Revit二次开发过滤器

门过滤

    public class DoorFilter : ISelectionFilter
    {
        public bool AllowElement(Element elem)
        {
            if (elem is FamilyInstance && elem.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Doors)
            {
                return true;
            }
            return false;
        }

        public bool AllowReference(Reference reference, XYZ position)
        {
            return true;
        }
    }

墙过滤

public class WallFilter : ISelectionFilter
{
    public bool AllowElement(Element elem)
    {
        return elem is Wall;
    }

    public bool AllowReference(Reference reference, XYZ position)
    {
        return true;
    }
}

房间过滤

public class RoomFilter : ISelectionFilter
{
    public bool AllowElement(Element elem)
    {
        if (elem is Room)
        {
            return true;
        }
        return false;
    }

    public bool AllowReference(Reference reference, XYZ position)
    {
        return true;
    }
}

你可能感兴趣的:(Revit二次开发,c#)