© 2010 Autodesk
Introduction to Revit 2011 API
要素フィルタ
 要素タイプのインスタンス
§
<VB.NET>
''  Find a list of element with the given Class, family type and Category (optional).
Function FindInstancesOfType(ByVal targetType As Type, _
     ByVal idFamilyType As ElementId, _
     Optional ByVal targetCategory As BuiltInCategory = Nothing) As IList(Of Element)
   ''  narrow down to the elements of the given type and category
   Dim collector = New FilteredElementCollector(m_rvtDoc).OfClass(targetType)
   If Not (targetCategory = Nothing) Then
        collector.OfCategory(targetCategory)
   End If
   ''  parse the collection for the given family type id. using LINQ query here.
   Dim elems = _
        From element In collector _
        Where element.Parameter(BuiltInParameter.SYMBOL_ID_PARAM). _ 
              AsElementId.Equals(idFamilyType) _
        Select element
   ''  put the result as a list of element for accessibility.
   Return elems.ToList()
End Function
</VB.NET>
§タイプを指定してその全ての要素インスタンスを見つける
§
これは、特定のタイプのインスタンスをタイプの要素IDで判定して見つけている例です。

まず、定義クラスでフィルタし、次にカテゴリでフィルタし、そして、LINQクエリでタイプ名を指定して全ての要素インスタンスを見つけています。