Public Class myfilter
Implements ISelectionFilter
Public Function AllowElement(e As Element) As Boolean Implements ISelectionFilter.AllowElement
Return SolidboxAndMetka(e)
End Function
Public Function AllowReference(refer As Reference, point As XYZ) As Boolean Implements ISelectionFilter.AllowReference
Return False
End Function
Public Shared Function SolidboxAndMetka(ByVal e As Element) As Boolean
Dim rc As Boolean = False
Dim cat As Category = e.Category
Dim doc As Document = e.Document
If (Not (cat) Is Nothing) Then
If cat.Id.IntegerValue.Equals(CInt(BuiltInCategory.OST_GenericModel)) Then
Dim fi As FamilyInstance = CType(e, FamilyInstance)
If (Not (fi) Is Nothing) Then
Dim fname As String = fi.Symbol.Family.Name
If fname = "solidboxn" Then rc = True
End If
End If
If cat.Id.IntegerValue.Equals(CInt(BuiltInCategory.OST_GenericModelTags)) Then
Dim tagobj As IndependentTag = CType(e, IndependentTag)
If (Not (tagobj) Is Nothing) Then
Dim elt As ElementType = TryCast(doc.GetElement(tagobj.GetTypeId()), ElementType)
If elt.FamilyName = "metkaSB" Then rc = True
End If
End If
End If
Return rc
End Function
End Class