I recently found out that within a multivalue list you can also use formulas instead of only a numeric value. I used this for a couple of parameters and an example of one of my multivalue lists is:
0 mm
0,5 mm
Breedte_Regel_L1_Helft
Breedte_Regel_L1_Helft + 0,5 mm
-Breedte_Regel_L1_Helft
(Breedte_Regel_L1_Helft being another parameter)
This seems to work perfectly when I choose the values manually, but I'd like to set some of these using iLogic. When I try to set the parameter value as 0 mm or 0,5 mm, this works perfectly, but I'm struggling to set it to one of the formula's. If I type in the formula, the value itsself is correct, but it's not a formula anymore. If I type in the formula between "" I get an error because it can't seem to deal with strings.
Is there some way to do this easily?
Solved! Go to Solution.
Solved by JhoelForshav. Go to Solution.
Hi @mat_hijs
In order to set the Expression for the parameter (Formula) you must change the parameters expression property.
See this example:
Dim oParameter As Inventor.Parameter = Parameter.Param("ParameterName") 'Use name of the parameter you want to change oParameter.Expression = "Breedte_Regel_L1_Helft + 0,5" 'Some expression (formula) - To set the expression 'This is just an example to display all expressions in the multivalueparameter Dim Msg As String = "Parameter Name: " & vbCrLf & oParameter.Name & vbCrLf & "Parameter Expressions:" For Each oExpression As String In oParameter.ExpressionList Msg = Msg & vbCrLf & oExpression Next MsgBox(Msg)
I also included some code at the end of the rule to show you that you can access the parameters multivaluelist.
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
I can't test this right now, but this seems like it's exactly what I need, thanks a lot for that!
I'm guessing I can use this same method to set a numeric value?
That's right @mat_hijs
You can set numeric values as well 🙂
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
Can't find what you're looking for? Ask the community or share your knowledge.