28 lines
706 B
C#
28 lines
706 B
C#
|
|
using Autodesk.Revit.DB;
|
|||
|
|
using Autodesk.Revit.UI.Selection;
|
|||
|
|
|
|||
|
|
namespace Szmedi.Toolkit.RvAssists
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 参考选择过滤过滤器
|
|||
|
|
/// </summary>
|
|||
|
|
public class ReferenceSelectionFilter : ISelectionFilter
|
|||
|
|
{
|
|||
|
|
private readonly ElementReferenceType referenceType;
|
|||
|
|
|
|||
|
|
public ReferenceSelectionFilter(ElementReferenceType referenceType)
|
|||
|
|
{
|
|||
|
|
this.referenceType = referenceType;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool AllowElement(Element elem)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool AllowReference(Reference reference, XYZ position)
|
|||
|
|
{
|
|||
|
|
return referenceType == reference.ElementReferenceType;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|