' ...
Public Sub Show_Parameters_Of_Element_By_Id(ByVal Id As String)
Dim uiApp As Autodesk.Revit.UI.UIApplication = myCD.Application
Dim App As Autodesk.Revit.ApplicationServices.Application = uiApp.Application
Dim uiDoc As UIDocument = uiApp.ActiveUIDocument
Dim Doc As Document = uiDoc.Document
Dim coll As FilteredElementCollector = New FilteredElementCollector(Doc).OfClass(GetType(DB.Family))
Me.ListView2.Clear()
Me.ListView2.Columns.Add("№") '0
Me.ListView2.Columns.Add("Designation") '1
Me.ListView2.Columns.Add("Value") '2
Me.ListView2.Columns.Add("Additional value") '3
Dim acElNum As Integer = 1
For Each acEl As DB.Element In coll
Dim acElId As Integer = acEl.Id.IntegerValue
Select Case acElId
Case Id
Dim acElFam As DB.Family = CType(acEl, DB.Family)
Add_New_Element_ListView2(CType(acElNum, String), _
"Местоположение семейства", IIf(acElFam.IsInPlace, "Местный", "Загруженный"), "Family.IsInPlace") : acElNum += 1
Add_New_Element_ListView2(CType(acElNum, String), _
"Имя семейства", acEl.Name.ToString, "Family.Name") : acElNum += 1
Add_New_Element_ListView2(CType(acElNum, String), _
"Семейство рукотворное", IIf(acElFam.IsOwnerFamily, "Да", "Нет"), "Family.IsOwnerFamily") : acElNum += 1
Add_New_Element_ListView2(CType(acElNum, String), _
"ID", acEl.Id.IntegerValue.ToString, "Family.Id.IntegerValue.ToString") : acElNum += 1
Add_New_Element_ListView2(CType(acElNum, String), _
"GUID", acEl.UniqueId.ToString, "Family.UniqueId.ToString") : acElNum += 1
Add_New_Element_ListView2(CType(acElNum, String), _
"Тип элемента", acEl.GetType.Name.ToString, "Family.GetType.Name.ToString") : acElNum += 1
Dim s As String = String.Empty
If Not Nothing Is acEl.Category Then
s = acEl.Category.Name
End If
If 0 = s.Length AndAlso TypeOf acEl Is Family AndAlso Not Nothing Is DirectCast(acEl, Family).FamilyCategory Then
s = DirectCast(acEl, Family).FamilyCategory.Name
End If
If 0 = s.Length Then
s = "unknown"
End If
Add_New_Element_ListView2(CType(acElNum, String), _
"Имя категории", s, "Family.Category.Name") : acElNum += 1
If TypeOf acEl Is Wall Then
s = "Wall (Стена)"
ElseIf TypeOf acEl Is Floor Then
s = "Floor (Пол)"
ElseIf TypeOf acEl Is RoofBase Then
s = "Roof (Крыша)"
ElseIf TypeOf acEl Is FamilyInstance Then
If acEl.Category.Id.IntegerValue = _
BuiltInCategory.OST_Doors Then
s = "Door (Дверь)"
ElseIf acEl.Category.Id.IntegerValue = _
BuiltInCategory.OST_Windows Then
s = "Window (Окно)"
ElseIf acEl.Category.Id.IntegerValue = _
BuiltInCategory.OST_Furniture Then
s = "Furniture (Фурнитура)"
Else
s = "Component family instance (Компонент экземпляра семейства)"
End If
ElseIf TypeOf acEl Is HostObject Then
s = "System family instance (Системный экземпляр семейства)"
Else
s = "Другой"
End If
Add_New_Element_ListView2(CType(acElNum, String), _
"Тип семейства", s, "TypeOf Family Is ...") : acElNum += 1
' Параметры семейства
Dim params As ParameterSet = acEl.Parameters
Dim nump As Integer = 1
For Each param As DB.Parameter In params
Dim name As String = param.Definition.Name
Dim val As String = ParameterToString(param)
Add_New_Element_ListView2(CType(acElNum, String), _
"Параметр #" & nump & " [" & name & "]", val, "Family.Definition.Name / ParamToString[Parameter]") : acElNum += 1
nump += 1
Next
Dim acPars As Object = acEl.GetOrderedParameters
For j As Integer = 0 To acPars.count - 1
Dim acParsVal As DB.Parameter = CType(acPars(j), DB.Parameter)
Add_New_Element_ListView2(CType(acElNum, String), _
"Параметр #" & nump & " map #" & j + 1 & " [" & acPars(j).Definition.Name & "]", ParameterToString(acParsVal), "Family.Parameter.Definition.Name / ParamToString[Parameter]") : acElNum += 1
nump += 1
Next
Case Else
End Select
Next
For i As Integer = 0 To Me.ListView2.Columns.Count - 1
Me.ListView2.Columns(i).AutoResize(Windows.Forms.ColumnHeaderAutoResizeStyle.ColumnContent)
Next i
End Sub
Public Sub Add_New_Element_ListView2(ByVal element1 As String, ByVal element2 As String, ByVal element3 As String, ByVal element4 As String)
Dim acElNewLVI As New ListViewItem
With acElNewLVI
For i As Long = 0 To 3
.SubItems.Add("")
Next
.SubItems(0).Text = element1
.SubItems(1).Text = element2
.SubItems(2).Text = element3
.SubItems(3).Text = element4
End With
Me.ListView2.Items.Add(acElNewLVI)
End Sub