How to grab command input data from DropDown list?

How to grab command input data from DropDown list?

Six1Seven1
Advocate Advocate
699 Views
1 Reply
Message 1 of 2

How to grab command input data from DropDown list?

Six1Seven1
Advocate
Advocate

Hi,

 

Forgive me, I am still trying to figure out how to use and read the object reference manual. I can't figure out how to grab the data from a dropdown list.

 

Here is my command input:

qty = inputs.addDropDownCommandInput('qty','Quantity',1)
list_items1 = qty.listItems
list_items1.add('2',True,' ')
list_items1.add('4',False,' ')

Then in the execute handler, do i grab the selected item with this code?...

qty = inputs.itemById('qty').selectedItem

 

I want to return the selected item value. I want to use the integer 2 or 4 in my program input. How to?

 

 

 

Regards,

 

0 Likes
700 Views
1 Reply
Reply (1)
Message 2 of 2

marshaltu
Autodesk
Autodesk

Hello,

 

You can probably get the name of selected item. It should be "2" or "4". You have to convert the string to integer before using it.

 

itemname = inputs.itemById('qty').selectedItem.name
inputvalue = int(itemname)

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes