iLogic - New Array form issues

iLogic - New Array form issues

Anonymous
Not applicable
2,050 Views
6 Replies
Message 1 of 7

iLogic - New Array form issues

Anonymous
Not applicable

Hello All

I am having a bit of trouble hope someone can help me. I am trying to use a form to control my designs sizes. So I have a panel the has two linear patterns of hole in it. The one is for the amount of holes deep (RD) and the other one for the rows high (RH). I am trying to use the form to do my selection of each of the sizes. The catch is depending on the RH you can only have a set selection on your RD.

I used Curtis Waguespack example rule and tried to butcher it to work for me. I get it to work but the second part of it to only show a set selection, that part does not work.

http://inventortrenches.blogspot.co.za/

If someone can perhaps help me let me know. Below is my version of Curtis rule.

 

SyntaxEditor Code Snippet

'reset List B list to default
MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)

Dim RD As New ArrayList
RD = MultiValue.List("FORM_RD_SECTION")

Dim Temp_List As New ArrayList

Temp_List.Clear
For Each oItem in RD
    If FORM_RH_SECTION = 6 Then
    Temp_List.Add(oItem)
    End If
    Next
    MultiValue.List("FORM_RD_SECTION") = Temp_List
Temp_List.Clear
For Each oItem in RD
    If FORM_RH_SECTION = 8 Then
        MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10)
    End If
    Next
    MultiValue.List("FORM_RD_SECTION") = Temp_List
Temp_List.Clear
For Each oItem in RD
    If FORM_RH_SECTION = 10 Then
        MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10, 11)
    End If
    Next
    MultiValue.List("FORM_RD_SECTION") = Temp_List
Temp_List.Clear
For Each oItem in RD
    If FORM_RH_SECTION = 12 Then
        MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10, 11)
    End If
    Next
    MultiValue.List("FORM_RD_SECTION") = Temp_List
Temp_List.Clear
For Each oItem in RD
    If FORM_RH_SECTION = 14 Then
        MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
    End If
    Next
    MultiValue.List("FORM_RD_SECTION") = Temp_List

 

0 Likes
Accepted solutions (1)
2,051 Views
6 Replies
Replies (6)
Message 2 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous,

 

See the attached 2017 Inventor file to see if it does what you are after. Your intended result wasn't completely clear to me, so if I guessed wrong, feel free to post back.

 

Note too that there is an Inventor Customization forum which is dedicated to programming questions of this sort, so you might use that forum for these types of questions in the future:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
 

'reset List RD list to default
d1 = FORM_RH_SECTION*d15
d0 = FORM_RD_SECTION*d18
MultiValue.SetList("FORM_RH_SECTION", 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)

Dim RD As New ArrayList
RD = MultiValue.List("FORM_RD_SECTION")

Dim Temp_List As New ArrayList

Temp_List.Clear
For Each oItem in RD
	'if item in RB list is less than or equal to RD
	'then add it to temp list
    If FORM_RH_SECTION >= oItem Then
    	Temp_List.add(oItem)
    End If
Next
'set RD list to use the temp list
MultiValue.List("FORM_RD_SECTION") = Temp_List

EESignature

0 Likes
Message 3 of 7

Anonymous
Not applicable

Hello @Curtis_Waguespack thank you for the help. The way your rule works is fine but my issue that I have is.

Say I select 6RH then in my RD selection it must only show 3,4,5,6,7,8

If I select 10RH then in my RD it must only show 3,4,5,6,7,8,9,10,11

If I select 14RH then in my RD it must only show 3,4,5,6,7,8,9,10,11,12

 

And so on, whereas in your code it says >= on my code it needs to be only those numbers. 

Please see my attached table that governs the selections.

0 Likes
Message 4 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous,

 

Oh, well in that case just an if/then such as this should work.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'reset List RD list to default
MultiValue.SetList("FORM_RH_SECTION", 4, 6, 8, 10) 'add complete list of RH values here

If FORM_RH_SECTION = 4 Then
	MultiValue.SetList("FORM_RD_SECTION",3,5,6)
ElseIf FORM_RH_SECTION = 6 Then
	MultiValue.SetList("FORM_RD_SECTION",3,4,5,6,8)
ElseIf FORM_RH_SECTION = 8 Then
	MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10)
ElseIf FORM_RH_SECTION = 10 Then
    MultiValue.SetList("FORM_RD_SECTION", 3, 4, 5, 6, 7, 8, 9, 10, 11) 
'And so On...	
End If

EESignature

Message 5 of 7

Anonymous
Not applicable

Hello @Curtis_Waguespack

 

So the rule works 100%. BUT I think I have gremlins in my PC at work. I have attached my three rules and screenshots. On the form all of the single numbers for my selections are blank (missing) and if you click on it it give a error message of "Conversion from string "" to type 'Double' is not valid."  I have no idea what this could be I have tried to look it up but the reasons does not make sense to me.

 

My patterns in my part is staggered, the way that I link my patterns with the selection is where I think I have a problem even thou it does not say that there is a problem? I wish I could send the part file but my work would not allow that so I hope the info that I send will help?

0 Likes
Message 6 of 7

Anonymous
Not applicable

@Curtis_Waguespack

 

Here are the rules as well

0 Likes
Message 7 of 7

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous.

 

In order to ensure that when the list is changed, that the RD parameter is set to a value that is indeed in the list you can add a line of code to the beginning as shown:

 

'ensure value is set to a value in the list, default of 0 chooses first in list
MultiValue.SetValueOptions(True, DefaultIndex := 0)

'reset List RD list to default
MultiValue.SetList("FORM_RH_SECTION", 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32) 

'set list based on RH value
If FORM_RH_SECTION = 4 Then
	MultiValue.SetList("FORM_RD_SECTION", 4, 5, 6)
ElseIf FORM_RH_SECTION = 6 Then

'rest of if/then condition here ........

I'm really not sure about the missing numbers in the form, I've not ever experienced that. What version of Inventor are you using? Maybe its a known bug for your version.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature