Hellow fellows. I´m experieced in CAD 2D & 3D, and familarized with AutoCAD, Inventor, SolidWorks, CATIA 5 modelling and customization, and a bit of NX11 APT and Cimatron GPP. But new in Fusion environment and AI. I know "chongas" (nothing) of Python coding, but I learnt Fortran in past, and a bit of C procedural, CATIA customization and Inventor Ilogic. I observed that Fusion don´t have way of put dropbox itens for text variables, directly in the "Change Parameters" command, and I feel lack of it. Then I ask Cloude Online (acess 01.08.2026) and asked it to generate a Python code for permit a text user variable to be selected by a dropbox list. After a first creation bugged, and a 2nd creation ok, it generated the list bellow/attached. Please test it and inform me if it´s ok for u or supply any need of yours. RegardsCarlos -------------------- init------- import adsk.core, adsk.fusion, traceback# Nome do parametro de usuario que sera alteradoPARAM_NAME = 'Material_peca'# Opcoes que aparecerao no dropdownOPCOES = ['Aço', 'Madeira', 'Alumínio']# Handlers precisam ser mantidos em memoria (referencia global)handlers = []app = adsk.core.Application.get()ui = app.userInterfacedef get_user_param(design: adsk.fusion.Design, name: str):"""Retorna o UserParameter pelo nome, ou None se nao existir."""for p in design.userParameters:if p.name == name:return preturn Noneclass CommandExecuteHandler(adsk.core.CommandEventHandler):def notify(self, args):try:cmd = args.commandinputs = cmd.commandInputsdropdown = inputs.itemById('materialDropdown')selecionado = dropdown.selectedItem.namedesign = adsk.fusion.Design.cast(app.activeProduct)if not design:ui.messageBox('Nenhum documento de Design ativo.')returnparam = get_user_param(design, PARAM_NAME)if not param:ui.messageBox(f'Parâmetro "{PARAM_NAME}" não encontrado no arquivo.')return# Parametros de texto usam a propriedade textValue, NAO expression/valueparam.textValue = selecionadoui.messageBox(f'Parâmetro "{PARAM_NAME}" atualizado para: {selecionado}')except:if ui:ui.messageBox('Falhou:\n{}'.format(traceback.format_exc()))class CommandCreatedHandler(adsk.core.CommandCreatedEventHandler):def notify(self, args):try:cmd = args.commandinputs = cmd.commandInputsdesign = adsk.fusion.Design.cast(app.activeProduct)valor_atual = Noneif design:param = get_user_param(design, PARAM_NAME)if param:# Le o valor atual usando textValue (parametro de texto)valor_atual = param.textValuedropdown = inputs.addDropDownCommandInput('materialDropdown','Material da Peça',adsk.core.DropDownStyles.TextListDropDownStyle)for opcao in OPCOES:is_selected = (opcao == valor_atual)dropdown.listItems.add(opcao, is_selected)# Se o valor atual nao estiver na lista de opcoes, seleciona o primeiroif valor_atual not in OPCOES and dropdown.listItems.count > 0:dropdown.listItems.item(0).isSelected = Trueon_execute = CommandExecuteHandler()cmd.execute.add(on_execute)handlers.append(on_execute)except:if ui:ui.messageBox('Falhou:\n{}'.format(traceback.format_exc()))def run(context):try:cmd_defs = ui.commandDefinitions# Remove definicao antiga, se existir, para evitar duplicidadeold_cmd_def = cmd_defs.itemById('cmdAlterarMaterialPeca')if old_cmd_def:old_cmd_def.deleteMe()cmd_def = cmd_defs.addButtonDefinition('cmdAlterarMaterialPeca','Alterar Material da Peça','Define o valor do parâmetro Material_peca a partir de uma lista.')on_created = CommandCreatedHandler()cmd_def.commandCreated.add(on_created)handlers.append(on_created)cmd_def.execute()# Mantem o script "vivo" ate o comando ser concluidoadsk.autoTerminate(False)except:if ui:ui.messageBox('Falhou:\n{}'.format(traceback.format_exc()))---------- end ------
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | How to create multiple of same object with different text from a list or table | 0 | 5.16 | 02-08-2026 |
| 2 | What free online tools would help your Fusion 360 workflow? | 0 | 14.24 | 02-08-2026 |
| 3 | Issue? Offset curves cannot properly identify internal profiles | 0 | 19.45 | 02-08-2026 |
| 4 | BASIC FEATURES DON'T WORK --UNLOCK | 0 | 20.02 | 02-08-2026 |
| 5 | Betreff: Sweeping unter Form bearbeiten | 0 | 13.66 | 25-07-2026 |
| 6 | Tool Break Detection - Incorrect Tool Number | 0 | 7.17 | 02-08-2026 |
| 7 | Useful ideas | 5 | 6 | 27-06-2026 |
| 8 | [BUG] "Align to" on a UCS plane orients the view to the Default Coordinate System instead of UCS | 0 | 6.94 | 25-07-2026 |
| 9 | Shared View does not respect the redefined ViewCube Top orientation | 0 | 5.16 | 02-08-2026 |
| 10 | What's New? Rule-Driven Architectural Products in the Browser with Informed Design's APS Viewer Extension | 5 | 6 | 18-03-2026 |