- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All 😞
I though I had dropdown lists worked out. but I was wrong.
I gave up on the groupradiobuttons for now and decided to use another dropdown list.\
I have these 4 dropdown controls.
inputs = command.commandInputs
_standard = inputs.addDropDownCommandInput('standard', 'Select Conuntry', adsk.core.DropDownStyles.TextListDropDownStyle)
_ringsizesAustralia = inputs.addDropDownCommandInput('ringsizeAustralia', 'Select Ring Size', adsk.core.DropDownStyles.TextListDropDownStyle)
_ringsizesUSA = inputs.addDropDownCommandInput('ringsizeUSA', 'Select Ring Size', adsk.core.DropDownStyles.TextListDropDownStyle)
_profile = inputs.addDropDownCommandInput('profile', 'Select Ring Profile', adsk.core.DropDownStyles.TextListDropDownStyle)
_Standard has 2 list items, _ringsizesUSA has 15 list items , _ringsizesAustralia has 18 list items and _profile has 2 list items
now in my onexecute event handler I have ..
eventArgs = adsk.core.CommandEventArgs.cast(args)
# Get the root component of the active design.
if _standard.selectedItem.name == 'USA':
ringsizeinput = _ringsizesUSA.selectedItem.name
ringsize = USARINGSIZES[ringsizeinput]
ringstandard = _standard.selectedItem.name
elif _standard.selectedItem.name == 'Australian':
ringsizeinput = _ringsizesAustralia.selectedItem.name
ringsize = OZRINGSIZES[ringsizeinput]
ringstandard = _standard.selectedItem.name
else:
ringsize = '20mm'
ringstandard = 'Custom'
if _profile.selectedItem.name == 'Half Circle':
_selectedprofile = 1
elif _profile.selectedItem.name == 'Full Circle':
_selectedprofile = 2
else:
_selectedprofile = 0
The first group of if,elif,else statements work fine, I have no trouble working with the selected items
But when I try to work with the _profile dropdown list I get a
if _profile.selectedItem.name == 'Half Circle': : AtributeError : 'NoneType' has no attribute 'selectedItem'
Most of the code was copy and paste 😞 what am I doing wrong?
Cheers, Stephen
Solved! Go to Solution.