• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor Customization

    Reply
    Valued Contributor
    Posts: 57
    Registered: ‎03-07-2010

    Setting MultiValue List to a paramter

    55 Views, 2 Replies
    01-21-2013 01:08 AM

    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 2012 SP1
    Windows 7 x64
    Dell Precision T7400 Intel(R) Xeon(R) CPU X5472 @ 3.00GHz (4 CPU's), 8Gb RAM, NVIDIA Quadro FX 5600 1536MB GDDR3
    Please use plain text.
    Mentor
    MegaJerk
    Posts: 189
    Registered: ‎01-26-2011

    Re: Setting MultiValue List to a paramter

    01-21-2013 05:32 AM 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 seems to remedy your problem, please press the Accept Solution button, -
    as it increases my power levels and will eventually help to elevate me towards outer space.

    Check out my iLogic injection tool here : http://goo.gl/ce1Qg
    --------------------------------------------------------------------------------------
    Please use plain text.
    Valued Contributor
    Posts: 57
    Registered: ‎03-07-2010

    Re: Setting MultiValue List to a paramter

    01-21-2013 07:30 AM 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 2012 SP1
    Windows 7 x64
    Dell Precision T7400 Intel(R) Xeon(R) CPU X5472 @ 3.00GHz (4 CPU's), 8Gb RAM, NVIDIA Quadro FX 5600 1536MB GDDR3
    Please use plain text.