Unable to read all parameters with

Unable to read all parameters with

Anonymous
Not applicable
676 Views
2 Replies
Message 1 of 3

Unable to read all parameters with

Anonymous
Not applicable

I like to get all values of the parameters which are stored in an iLogic model. After collecting the values I like to generate all variants which are available with these parameters.

 

I have a strange problem with the function expressionlist.item()

 

Public Function getParamValues() As Collection
    Dim ParamName As String
    ParamName = "BOX1"
    
    Dim oParameters As Parameters
    Dim colParamValues As New Collection
    Dim intCount As Integer
    Set getParamValues = colParamValues
    Set oParameters = ThisApplication.ActiveDocument.ComponentDefinition.Parameters
    
    For intCount = 1 To oParameters.UserParameters.Item(ParamName).ExpressionList.Count
        colParamValues.Add oParameters.UserParameters.Item(ParamName).ExpressionList.Item(intCount)
    Next intCount
End Function

The part has a parameter "BOX1" which is a multi-value list. It contains the values "EDF1" "EDF2" and "EDF3".  The first element is always ???? after reading.

 The watch window shows the correct item() values. But colParamValues.Add recieves ????? values.

 

What am I overlooking here?

 

best regards,

 

Maarten Weers

Perker Hannifin b.v.

The Netherlands

0 Likes
Accepted solutions (1)
677 Views
2 Replies
Replies (2)
Message 2 of 3

MjDeck
Autodesk
Autodesk
Accepted solution

  There is a problem with accessing ExpressionList items by index.  We should be able to get this fixed in a service pack for Inventor 2011.  

 Here is a workaround, using another method to get the ExpressionList items:

 

 

Public Function getParamValues() As Collection
    Dim ParamName As String
    ParamName = "BOX1"
    
    Dim oParameters As Parameters
    Dim colParamValues As New Collection
    Set getParamValues = colParamValues
    Set oParameters = ThisApplication.ActiveDocument.ComponentDefinition.Parameters
    
    Dim listValue As Variant
    For Each listValue In oParameters.UserParameters.Item(ParamName).ExpressionList
        colParamValues.Add listValue
    Next
End Function
Public Function getParamValues() As Collection
    Dim ParamName As String
    ParamName = "BOX1"
    
    Dim oParameters As Parameters
    Dim colParamValues As New Collection
    Set getParamValues = colParamValues
    Set oParameters = ThisApplication.ActiveDocument.ComponentDefinition.Parameters
    
    Dim listValue As Variant
    For Each listValue In oParameters.UserParameters.Item(ParamName).ExpressionList
        colParamValues.Add listValue
    Next
End Function

 

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 3

MjDeck
Autodesk
Autodesk

This is fixed in Inventor 2011 SP1, which is available at

 http://support.autodesk.com/getdoc.asp?id=DL15506670

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes