Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change contents of Multi Value list.

3 REPLIES 3
Reply
Message 1 of 4
GavoGarmo
1000 Views, 3 Replies

Change contents of Multi Value list.

Hi,

 

Is there a way to change the values available in a Multivalue list, based on another parameter?

 

I'd like to achieve:

 

When material is "MDF", available thicknesses are 6,9, 12

When material is "PLY", available thicknesses are 15,18, 25

 

I kinda solved this already but it's not quite right. I basically mad the list a list of custom parameters, and changed the values of these parameters based on the material parameter. :

 

'------iLogic--------------

If Material = "MDF" Then

iProperties.Value("Custom", "Thickness 1") = 6

iProperties.Value("Custom", "Thickness 2") = 9

iProperties.Value("Custom", "Thickness 3") = 12

Else If Material = "PLY" Then

iProperties.Value("Custom", "Thickness 1") = 15

iProperties.Value("Custom", "Thickness 2") = 18

iProperties.Value("Custom", "Thickness 3") = 25

End If

 

MultiValue.SetList("Thicknes",iProperties.Value("Custom", "Thickness 1"),iProperties.Value("Custom", "Thickness 2"),iProperties.Value("Custom", "Thickness 3")

MultiValue.UpdateAfterChange = True

'------------------End----------------------------

 

This works pretty much, when changing between the materials the value currently selected  remains in the list until another is selected from the list. Once another value has been selected, only the correct values are available, but immediately after the material has been changed the thickness for that material is incorrect and could lead to operators specifying an unavailable thickness.

 

Thanks in advance.

 

 

3 REPLIES 3
Message 2 of 4

Hi GavoGarmo,

 

You can try something like this example.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
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

 

 

''get the material in use
oMaterial = iProperties.Material

If oMaterial = "MDF" Then
materialList = new integer(){6,9,12}
Else If oMaterial = "PLY" Then
materialList = new integer(){15,18,25}
End If

myThickness = InputListBox(oMaterial & ":  Select a thickness.", _
materialList, materialList(0), "iLogic", "Availaible Thicknesses")

MessageBox.Show("The thickness is: " & myThickness, "iLogic")

 

Message 3 of 4

HI Curtis,

 

Thaks again for another lighting fast reply.

 

I'm struggling to get it to work. My knowledge of VB is very limited. I seem to be making the iLogic I know stretch quite far., but not far enough to understand the VB.

 

I'm getting an error.

 

Error on Line 5 : Value of type '1-dimensional array of Integer' cannot be converted to 'Double'.

Error on Line 7 : Value of type '1-dimensional array of Integer' cannot be converted to 'Double'.

 

My Parameter name for the thickness is G_T, I'm guessing I should replace the "materialList" with G_T in the code you sent ?

 

Sorry for sounding like a total Noob. 🙂

 

GavoGarmo

 

Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 3403 StartFragment: 314 EndFragment: 3371 StartSelection: 314 EndSelection: 314

oMaterial=MaterialIfoMaterial="MDF"ThenG_T=NewInteger(){6,9,12}ElseIfoMaterial="PLY"ThenG_T=NewInteger(){15,18,25}EndIf

Message 4 of 4

Hi GavoGarmo,

 

I think the issue is with the lines containing "new integer", so changing those to "new double" should resolve this.

 

For example, change:

materialList = new integer(){6,9,12}

to

materialList = new double(){6,9,12}

 

 

'get the material in use
oMaterial = iProperties.Material

If oMaterial = "MDF" Then
materialList = new double(){6,9,12}
Else If oMaterial = "PLY" Then
materialList = new double(){15,18,25}
End If

G_T = InputListBox(oMaterial & ":  Select a thickness.", _
materialList, materialList(0), "iLogic", "Availaible Thicknesses")

MessageBox.Show("The thickness is: " & G_T , "iLogic")

iLogicVb.UpdateWhenDone = True

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

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

Post to forums  

Autodesk Design & Make Report