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: 

Setting MultiValue List to a paramter

2 REPLIES 2
Reply
Message 1 of 3
fakeru
447 Views, 2 Replies

Setting MultiValue List to a paramter

Hello

I have the following rule:


If OD=900 mm And Filter_Type = "Aerob" Then
MultiValue.SetList("FilterSize", 0.2, 0.3, 0.4, 0.5, 2.2, 2.3, 2.4, 2.5)
End If

If OD=900 mm And Filter_Type = "Donaldson DLM" Then
MultiValue.SetList("FilterSize", V3/7S, V4/7S, V8/7S)
End If

 For first condition everything is ok. But when the second one is valid it gives error:

Conversion from string "V3/7" to type 'Double' is not valid.

Maybe I should add that the parameter "FilterSize" was made as Text and multi-value.

And of course I not familiar at all with programming...

What would be the solution?

 

Thanks

Autodesk Inventor 2015 Certified Professional
2 REPLIES 2
Message 2 of 3
MegaJerk
in reply to: fakeru

I noticed that you are using a variable called '7S'. Could you give me the rest of the code so that I can see how those variables are being initialized? Being that you can't begin an Inventor parameter using a number I assume that it is being declared via a DIM inside of your iLogic. No matter, it may be causing the problem.

 

 

I ran a test (switching that to S7) with the below code, and ran into no problems.

 

'' Here is a test to perform. 
'' The parameter type of all the INVENTOR parameters are as follows. 

' Filter_Type --- Text - Multivalue w/(2) values : ("Filter1", "Filter2") 
' FilterSize --- mm - Multivalue w/(?) values : Is assigned by iLogic below
' OD --- mm - Single Value : currently 900mm 

'Notice that 7S has been changed to S7!
Dim V3, V4, V8, S7 As Double


V3 = 300 mm 
V4 = 400 mm 
V8 = 800 mm
S7 = 7 ul  

If OD=900 mm And Filter_Type = "Filter1" Then
MultiValue.SetList("FilterSize", 0.2, 0.3, 0.4, 0.5, 2.2, 2.3, 2.4, 2.5)
End If

If OD=900 mm And Filter_Type = "Filter2" Then
MultiValue.SetList("FilterSize", V3/S7, V4/S7, V8/S7)
End If

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 3 of 3
fakeru
in reply to: MegaJerk

Sorry, I was not precise with my description and the code. I have found the mistake.

I will simplify my initial code:

If OD=900 mm And Filter_Type = "Donaldson DLM" Then
MultiValue.SetList("Filter_Size", "V3/7S", "V4/7S")
End If

If OD=900 mm And Filter_Type = "Aerob" Then
MultiValue.SetList("Filter_Size", "0.2", "0.3")
End If

If Filter_Size= 0.2 Then
d1= 100 mm
d2= 200 mm
End If

If Filter_Size= 0.3 Then
d1= 100 mm
d2= 300 mm
End If

If Filter_Size= "V3/7S" Then
d1= 150 mm
d2= 200 mm
End If

If Filter_Size= "V4/7S" Then
d1= 250 mm
d2= 100 mm
End If

 Just because I didn't use double quote in line 9 and 14 for the value of Filter_Size I had this error.

So it should be like this:

If Filter_Size= "0.2" Then

and

If Filter_Size= "0.3" Then

 

In my first post I didn't wrote the other code which was using the same "Filter_Size". So it was hard to understand.

 

Thanks anyway for your try!

Autodesk Inventor 2015 Certified Professional

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

Post to forums  

Autodesk Design & Make Report