multi value list giving me trouble

multi value list giving me trouble

Anonymous
Not applicable
445 Views
2 Replies
Message 1 of 3

multi value list giving me trouble

Anonymous
Not applicable

so I'm trying to set up a text parameter that tells the boys in the shop which machine to use to cut out the part I've designed when I hand the design off to them. I WAS using a boolean parameter for a while and it worked but now I need to have more than 2 options on the list to choose from and that's where things get weird. I'm trying to have a multi value list that opens up when I launch the file so I can tell it which machine we're using (plasma, shear or saw) and so far the iLogic code isn't cooperating...  i keep getting this error: 

'Error in rule: ProcessRule, in document: Part10

Object reference not set to an instance of an object.'

 

here is my code so far. please help?

 

SyntaxEditor Code Snippet

MultiValue.SetList("Machine", Plasma, Shear, Saw)

Machine_Process = InputListBox("Select Process", MultiValue.List("Machine"), Machine, Title := "Process", ListName := "List")
0 Likes
Accepted solutions (1)
446 Views
2 Replies
Replies (2)
Message 2 of 3

martin.jacko
Autodesk
Autodesk
Accepted solution

Hi,

 

I think your code should be

MultiValue.SetList("Machine", "Plasma", "Shear", "Sawer")

 

Martin

0 Likes
Message 3 of 3

j.romo
Advocate
Advocate

First you have to create a External Rule to run a rule to add the multivalue parameter with this code

SyntaxEditor Code Snippet

'THIS WILL CREATE A MULTIVALUE USER PARAMETER
oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
''THIS WORKS NOTE PARAMETERS WILL BE ADDED IN THE EXACT ORDER THEY ARE GENERATED IN THIS LIST


oParameter = oMyParameter.AddByValue("Machine", "Plasma", UnitsTypeEnum.kTextUnits)
MultiValue.SetList("Machine", "Plasma", "Shear", "Saw")

and a second rule with this code to run the input list

SyntaxEditor Code Snippet

Machine = InputListBox("Prompt", MultiValue.List("Machine"), Machine, Title := "Title", ListName := "List") 

 Or you can combine them but if you run the rule to create the Multivalue parameter but each time you run the rule to change the machine parameter it will create a new parameter **_1

So use 2 rules instead