PPT_LOGO_4b
Revit Programming Introduction <#>
Copyright © 2009 Autodesk Inc.
全ての床タイプをリスト
»' Find ALL Floor Types ... see updated code and more comments for Revit 2009 API in Labs code
»Dim newFloorType As FloorType = Nothing ' at the same time store the last one to use to change the floor type later
»sMsg = "ALL FLOOR Types in the model:"
»' There is no dedicated property to get floor types, so need to iterate all elements again
»Dim iter As ElementIterator = doc.Elements
»Do While (iter.MoveNext())
»  Dim elem As Revit.Element = iter.Current
»  If TypeOf elem Is Symbols.FloorType Then
»    Dim ft As Symbols.FloorType = elem
»    sMsg += vbCrLf & "  Type=" & ft.Name & ", Id=" & ft.Id.Value.ToString
»    ' In 9.0, it looks like "Foundation Slab" system family from "Structural Foundations" category
»    ' ALSO contains FloorType class instances. Exclude those as choices for standard floor types
»    Dim famName As String
»    Try
»      famName = ft.Parameter(Parameters.BuiltInParameter.SYMBOL_FAMILY_NAME_PARAM).AsString
»    Catch
»      famName = "?"
»    End Try
»    Dim cat As Category = ft.Category
»    sMsg += ", Family=" & famName & ", Category=" & cat.Name
»    ' store only if proper Floors category
»    If doc.Settings.Categories.Item(BuiltInCategory.OST_Floors).Equals(cat) Then
»      newFloorType = ft
»    End If
»  End If
»Loop
»MsgBox(sMsg)
»MsgBox( "Stored FloorType " & newFloorType.Name & " (Id=" & newFloorType.Id.Value.ToString & ") for later use")
ファミリーとタイプ
lab3-5-4 lab3-5-3
今度は、ドキュメントのElementsから床タイプのSymbolを全て取得し、ファミリー名やカテゴリー名を表示します。