Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Choose parameter value from multivalue list with iLogic

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
mat_hijs
1019 Views, 3 Replies

Choose parameter value from multivalue list with iLogic

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?

3 REPLIES 3
Message 2 of 4
JhoelForshav
in reply to: mat_hijs

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.

Message 3 of 4
mat_hijs
in reply to: JhoelForshav

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?

Message 4 of 4
JhoelForshav
in reply to: mat_hijs

That's right @mat_hijs

You can set numeric values as well 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report