I'm trying to read (and ultimately, to change) the "structural usage" parameter for a beam. In going through the SDK examples, as well as the handouts from AU07, here are a couple of code snippets I've tried.
1. First, I tried simply listing ALL of the parameters:
.......... If TypeOf elem Is FamilyInstance Then
.......... If elem.Category.Name.Equals("Structural Framing") Then
.................... 'Print the element ID
.................... sMsg = "ID=" + elem.Id.Value.ToString()
.................... 'MsgBox(sMsg, MsgBoxStyle.Exclamation, "Selection Info")
.................... frm.Text = sMsg
.................... 'Print out all of the available parameters
.................... sMsg = ""
.................... For Each param In elem.Parameters
.............................. sMsg = param.Definition.Name + " = "
.............................. Select Case param.StorageType
........................................ Case StorageType.Double
........................................ sMsg += param.AsDouble.ToString '+ vbCrLf
........................................ Case StorageType.Integer
.................................................. sMsg += param.AsInteger.ToString '+ vbCrLf
........................................ Case StorageType.String
.................................................. sMsg += param.AsString '+ vbCrLf
........................................ Case StorageType.ElementId
.................................................. sMsg += param.AsElementId.Value.ToString '+ vbCrLf
........................................ Case StorageType.None
.................................................. sMsg += "?NONE?" '+ vbCrLf
........................................ Case Else
.................................................. sMsg += "?ELSE?" '+ vbCrLf
.............................. End Select
.............................. frm.lstParams.Items.Add(sMsg)
.................... Next
.................... MsgBox(sMsg)
Although it did, in fact, print out a bunch of parameter names, only a few of them seemed to have values.
2. Then, I tried this:
.......... Try
.................... param = elem.Parameter(BuiltInParameter.INSTANCE_STRUCT_USAGE_PARAM)
.................... If Not param Is Nothing Then
.............................. Dim parInBuiltName As String = param.Definition.Name
.............................. Dim parInBuiltType As String = GetParamStorageType(param).ToString
.............................. Dim parInBuiltValue As String = GetParamAsString(param)
.............................. MsgBox("INSTANCE_STRUCT_USAGE_PARAM: Name=" & parInBuiltName & "; Type=" & parInBuiltType & "; Value=" & parInBuiltValue)
.................... Else
.............................. MsgBox("?ELSE?")
.................... End If
.......... Catch
.................... MsgBox("?CATCH?")
.......... End Try
This always gives me the "?ELSE?" message box.
So, can anyone offer me some direction? TIA for your help.