Try it this way. I'm showing multiple different options within this rule. I usually prefer to work with a List over an Array, because they are usually much easier to deal with. And you can easily convert between both types.
You can have a List that contains other Lists, and you can also have multi-dimensional arrays (like an array of arrays), so if you wanted to keep each list seperate, yet all stored in one variable, either of those would be an option. However, if you really just want them all in one long list, that is easily done with a simple 3-line loop.
Here's the code:
Dim oDocType As DocumentTypeEnum = ThisApplication.ActiveDocumentType
Dim oParams As Parameters
If oDocType = DocumentTypeEnum.kPartDocumentObject Or _
oDocType = DocumentTypeEnum.kAssemblyDocumentObject Then
oParams = ThisApplication.ActiveDocument.ComponentDefinition.Parameters
ElseIf oDocType = DocumentTypeEnum.kDrawingDocumentObject Then
oParams = ThisDrawing.Document.Parameters
End If
Dim oParam As Inventor.Parameter
Dim oAllOptions As New List(Of List(Of String))
Dim oOptions As New List(Of String)
For Each oParam In oParams
If oParam.ExpressionList.Count > 0 Then
oOptions = oParam.ExpressionList.GetExpressionList.ToList
oAllOptions.Add(oOptions)
End If
Next
'now you have a Lisf of all the Lists in one object reference (oAllOptions)
'Lists are usually easier to work with than Arrays
'For Each oSList As List(Of String) In oAllOptions
' InputListBox(" ", oSList) 'just shows you that it worked
'Next
'but if you want just one long list of all the options, we can do this
Dim oAll As New List(Of String)
For Each oList As List(Of String) In oAllOptions
oAll.AddRange(oList)
Next
'InputListBox(" ", oAll) 'just to show that it worked
'convert the List back into an Array
Dim oAllArray() As String = oAll.ToArray
InputListBox(" ", oAllArray) 'just to show that it worked
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you have time, please... Vote For My IDEAS 💡or you can Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield

(Not an Autodesk Employee)