Save selected dropdown item in class item

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Fusion-Community
For my semesterthesis I am creating an automated order tool for additive manufacturing parts directly out of Fusion. Therefore, I implemented a user-interface where the designer can select the body in Fusion and then he can choose from own defined properties like material, finishing, supplier etc from a dropdown list.
After having all properties selected, I want to save all selected properties in a class. Therefore I used "Bolt" sample code and changed it accordingly. Since I use other CommandInputs (like dropdownlists) than in the sample, I struggle with saving the selected item of the drowdown list in the right data format. The output of code used below (input.selectedItem) is "<adsk.core.ListItem; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::core::ListItem > *' at 0x14f6906f0> >", but I want to have the value of the selected item.
Many thanks in advance for your support!
Daniel
class OrderCommandExecuteHandler(adsk.core.CommandEventHandler): def __init__(self): super().__init__() def notify(self, args): try: #unitsMgr = app.activeProduct.unitsManager command = args.firingEvent.sender inputs = command.commandInputs order = Order() for input in inputs: #print(input.name) if input.id == 'orderName': order.orderName = input.value print(order.orderName) elif input.id == 'Quotation': order.Quotation = input.text print(order.Quotation) elif input.id == 'Anzahl': order.Anzahl = input.valueOne print(order.Anzahl) elif input.id == 'Material': order.Material = input.selectedItem print(order.Material) elif input.id == 'Prozess': order.Prozess = input.selectedItem print(order.Prozess) elif input.id == 'Ausrichtung': order.Ausrichtung = input.text print(order.Ausrichtung) elif input.id == 'Oberflaeche': order.Oberflaeche = input.selectedItem print(order.Oberflaeche) elif input.id == 'Farbe': order.Farbe = input.selectedItem print(order.Farbe) elif input.id == 'Typ': order.Typ = input.selectedItem print(order.Typ) elif input.id == 'Projekt': order.Projekt = input.selectedItem print(order.Projekt) elif input.id == 'KTI': order.KTI = input.value print(order.KTI) elif input.id == 'Lieferant': order.Lieferant = input.selectedItem print(order.Lieferant) elif input.id == 'Versanddatum': order.Versanddatum = input.text print(order.Versanddatum)