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;
    }
}

猜你喜欢

转载自blog.csdn.net/ultramand/article/details/130592592
今日推荐