PPT_LOGO_4b
Revit Programming Introduction <#>
Copyright © 2009 Autodesk Inc.
全要素のマップを作成
»' First extract and group the data from Revit in a convenient Map class:
»' (Key=category name, Val=Set of Elements)
»' In Revit 2009, we use an element filter instead ... see updated Labs code
»Dim sortedElements As Autodesk.Revit.Collections.Map = revitApp.Create.NewMap()
»Dim iter As IEnumerator = doc.Elements
»Do While (iter.MoveNext())
»  ' We look for all non-Symbol Elements which have a Category
»  Dim element As Revit.Element = iter.Current
»  If Not (TypeOf element Is Symbol) Then
»    Dim category As Category = element.Category
»    If Not (category Is Nothing) Then
»      Dim elementSet As ElementSet
»      ' If we already have this Key, get its Value (Set)
»      ' Otherwise, create the new Key and Value
»      If sortedElements.Contains(category.Name) Then
»        elementSet = sortedElements.Item(category.Name)
»      Else
»        elementSet = revitApp.Create.NewElementSet()
»        sortedElements.Insert(category.Name, elementSet)
»      End If
»      ' Add the elemnt to the Set
»      elementSet.Insert(element)
»    End If
»  End If
»Loop
パラメーター