- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am creating a UI where the user picks an item from the first dropdown list.
That makes visible the second dropdown list and then reads a csv file and compare the two choices to create a selection for the third dropdown list.
The problem I am having is how to assign the list variable items to the dropdown list for the third TextListDropDown
It creates a list that looks like this:
getGLpin['2.25,
'2.75',
'3.75']
=======================================================================================
# Define the command dialog.
# Define Nominal Size dropdown box
inputs.addImageCommandInput('glPinImage', '', 'commands/resources/command_icons/SGP/SGP.png')
_inputSelectNominalDiam = inputs.addDropDownCommandInput('nominalDiam', 'Nominal Diam', adsk.core.DropDownStyles.TextListDropDownStyle)
_inputSelectNominalDiam.isVisible = True
dropdown1Items = _inputSelectNominalDiam.listItems
dropdown1Items.add('Pick Nominal Diameter', True, '')
dropdown1Items.add('3/4', False, '')
dropdown1Items.add('1', False, '')
dropdown1Items.add('1 1/4', False, '')
# Define Shoulder Length dropdown box
_inputSelectShoulderLength = inputs.addDropDownCommandInput('shoulderLength', 'Shoulder Length', adsk.core.DropDownStyles.TextListDropDownStyle)
_inputSelectShoulderLength.isVisible = False
dropdown2Items = _inputSelectShoulderLength.listItems
dropdown2Items.add('Pick Shoulder Length', True, '')
dropdown2Items.add('7/8', False, '')
dropdown2Items.add('1 3/8', False, '')
dropdown2Items.add('1 7/8', False, '')
# Define Pin Length dropdown box
_inputSelectPinLength = inputs.addDropDownCommandInput('pinLength', 'Pin Length', adsk.core.DropDownStyles.TextListDropDownStyle)
_inputSelectPinLength.isVisible = False
dropdown3Items = _inputSelectPinLength.listItems
dropdown3Items.add(getGLpin, False)
=====================================================================================
This is the code that creates the third list.
getGLpin.clear
filePath = os.path.dirname(os.path.realpath(__file__))
fileCsv = open(filePath + '\\resources\\InchShoulderGuidePins.csv')
for line in fileCsv:
# Get the values from the csv file.
glPinLength = line.split(',')
if glPinLength[0] == strResult and glPinLength[1] == strResult1:
getGLpin.append(glPinLength[2])
_inputSelectPinLength.isVisible = True
Brad Bylls
Solved! Go to Solution.