Hi All,
I have a lifting lug which is sized according to the weight it is able to lift. The lugs size parameters are controlled by one multivalue parameter "Tank_Lifting_Lug_WWL_Tonnes". I am currently selecting these size parameters by using Case Select, but wanted to know if there is a more efficient way it could be done? Possible by getChoice = Choose(index, "first", "second", "third")? Below is a list of the values for each instance of the lug. If for example you were to choose: "Tank_Lifting_Lug_WWL_Tonnes" 3 then
"Tank_Lifting_Lug_Hole_DIA" would = 36
"Tank_Lifting_Lug_Hole_to_Base" would = 44 etc
List of Values:
MultiValue.List("Tank_Lifting_Lug_WWL_Tonnes", 2, 3, 4, 5, 6, 8, 10)
("Tank_Lifting_Lug_Hole_DIA", 28, 36, 39, 42, 46, 57, 60)
("Tank_Lifting_Lug_Hole_to_Base", 36, 44, 50, 54, 62, 67, 76)
("Tank_Lifting_Lug_Edge_Flat_Length", 14, 17, 22, 22, 24, 28, 31)
("Tank_Lifting_Lug_Base_Width", 100, 127, 141, 151, 184, 203, 215)
("Tank_Lifting_Lug_Plate_THK", 16, 20, 25, 25, 28, 32, 36)
("Tank_Lifting_Lug_Outside_RAD", 42, 54, 59, 63, 69, 86, 90)
Thanks
Solved! Go to Solution.
Solved by adam.nagy. Go to Solution.
I personally prefer Array.IndexOf method:
'our data lists Dim Tank_Lifting_Lug_WWL_Tonnes() As Integer = { 2, 3, 4, 5, 6, 8, 10} Dim Tank_Lifting_Lug_Hole_DIA() As Integer = { 28, 36, 39, 42, 46, 57, 60} Dim Tank_Lifting_Lug_Hole_to_Base() As Integer = { 36, 44, 50, 54, 62, 67, 76} Dim Tank_Lifting_Lug_Edge_Flat_Length() As Integer = { 14, 17, 22, 22, 24, 28, 31} Dim Tank_Lifting_Lug_Base_Width() As Integer = { 100, 127, 141, 151, 184, 203, 215} Dim Tank_Lifting_Lug_Plate_THK() As Integer = { 16, 20, 25, 25, 28, 32, 36} Dim Tank_Lifting_Lug_Outside_RAD() As Integer = { 42, 54, 59, 63, 69, 86, 90} 'find values for the given input weight Dim weight As Integer = 5 'index in array. Start from 0. Returns -1 if value is not found. Dim n As Integer = Array.IndexOf(Tank_Lifting_Lug_WWL_Tonnes, weight) MsgBox( "WWL_Tonnes = " & weight & vbNewLine & _ "Hole_DIA = " & Tank_Lifting_Lug_Hole_DIA(n) & vbNewLine & _ "Hole_to_Base = " & Tank_Lifting_Lug_Hole_to_Base(n) & vbNewLine & _ "Edge_Flat_Length = " & Tank_Lifting_Lug_Edge_Flat_Length(n) & vbNewLine & _ "Base_Width = " & Tank_Lifting_Lug_Base_Width(n) & vbNewLine & _ "Plate_THK = " & Tank_Lifting_Lug_Plate_THK(n) & vbNewLine & _ "Outside_RAD = " & Tank_Lifting_Lug_Outside_RAD(n) )
See MSDN for additional information on Array class methods.
Hope this helps.
Cheers,
Hi Vladimir,
Thanks for your reply. The rule returns the correct value for all the parameters listed, via the value specified in the following line: Dim weight As Integer = 5, as a MsgBox on the screen. Is there a way of:
1. Setting the value of the Integer via the multi value parameter Tank_Lifting_Lug_WLL_Tonnes directly, instead of manually typing it in?
2. Forcing all the parameters to change to that integer? As they seem to stay at their current value, even though the MsgBox appears with the correct values.
Thanks or your help,
James
>>> Setting the value of the Integer via the multi value parameter <<<
Answer: Yes, of course, this is much more friendly way.
>>> Forcing all the parameters to change to that integer?<<<
Answer: If input mass is not changed then nothing should be recalculated. Scenario is entirely defined by you.
cheers,
Hi James,
So if I understand correctly, you have a main parameter (Tank_Lifting_Lug_WWL_Tonnes) and you just want to make sure that whenever that is changed, the other values update automatically, right?
So I created a part with all those multivalue parameters. Then created a rule that fills those with values:
MultiValue.SetList("Tank_Lifting_Lug_WWL_Tonnes", 2, 3, 4, 5, 6, 8, 10) MultiValue.SetList("Tank_Lifting_Lug_Hole_DIA", 28, 36, 39, 42, 46, 57, 60) MultiValue.SetList ("Tank_Lifting_Lug_Hole_to_Base", 36, 44, 50, 54, 62, 67, 76) MultiValue.SetList("Tank_Lifting_Lug_Edge_Flat_Length", 14, 17, 22, 22, 24, 28, 31) MultiValue.SetList ("Tank_Lifting_Lug_Base_Width", 100, 127, 141, 151, 184, 203, 215) MultiValue.SetList ("Tank_Lifting_Lug_Plate_THK", 16, 20, 25, 25, 28, 32, 36) MultiValue.SetList("Tank_Lifting_Lug_Outside_RAD", 42, 54, 59, 63, 69, 86, 90)
Then I have another rule named "Tank_Lifting_Lug_WWL_Tonnes" that will update the other parameters whenever any parameter changes:
' This returns an array of strings Dim weights As ArrayList = MultiValue.List("Tank_Lifting_Lug_WWL_Tonnes") ' Get back current value as a string Dim weight As String = Tank_Lifting_Lug_WWL_Tonnes ' Find its index in the list Dim n As Integer = weights.IndexOf(weight) ' Set the given index for all parameters Tank_Lifting_Lug_Hole_DIA = MultiValue.List("Tank_Lifting_Lug_Hole_DIA")(n) Tank_Lifting_Lug_Hole_to_Base = MultiValue.List("Tank_Lifting_Lug_Hole_to_Base")(n) Tank_Lifting_Lug_Edge_Flat_Length = MultiValue.List("Tank_Lifting_Lug_Edge_Flat_Length")(n) Tank_Lifting_Lug_Base_Width = MultiValue.List("Tank_Lifting_Lug_Base_Width")(n) Tank_Lifting_Lug_Plate_THK = MultiValue.List("Tank_Lifting_Lug_Plate_THK")(n) Tank_Lifting_Lug_Outside_RAD = MultiValue.List("Tank_Lifting_Lug_Outside_RAD")(n)
This seems to do what I think you want.
Cheers,
Hello,
I would like to know how to use and its application of getChoice = Choose(index, "first", "second", "third") in inventor ilogic.
please share any example file if you have any.