PPT_LOGO_4b
Revit Programming Introduction <#>
Copyright © 2009 Autodesk Inc.
名前の付いたパラメーターにアクセス
»'Helper to get *specific* parameter by name
»Shared Function GetElemParam(ByVal elem As Revit.Element, ByVal name As String) As Parameter
»  Dim parameters As Autodesk.Revit.ParameterSet = elem.Parameters
»  Dim parameter As Autodesk.Revit.Parameter
»  For Each parameter In parameters
»    If (parameter.Definition.Name = name) Then
»      Return parameter
»    End If
»  Next
»  Return Nothing
»End Function
»
»
»' C) use GetElemParam utilty to get it by hard coded-name
»' (this works for either standard or shared!):
»Const csParamToFind As String = "Base Offset"
»Dim parByName As Parameter = LabUtils.GetElemParam(elem, csParamToFind)
»If parByName Is Nothing Then
»  MsgBox(csParamToFind & " is NOT available for this element")
»Else
»  Dim parByNameName As String = parByName.Definition.Name
»  Dim parByNameType As String = LabUtils.GetParamStorageType(parByName).ToString
»  Dim parByNameValue As String = LabUtils.GetParamAsString(parByName)
»  MsgBox(csParamToFind & ": Name=" & parByNameName & "; Type=" & parByNameType & "; Value=" & parByNameValue)
»End If
パラメーター
lab4-1-3
名前を用いた判別例となります。