I have been playing with the code if I run it to open a .csv with just the 3 lines you did it works if I try one taken from a sketch it does nothing.
this is the code I am useing to get the paramaters
#Author-Brian Ekins
#Description-Dumps out parameter info to a specified csv file.
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Get the name of the file to write to.
fileDialog = ui.createFileDialog()
fileDialog.isMultiSelectEnabled = False
fileDialog.title = "Specify result filename"
fileDialog.filter = 'CSV files (*.csv)'
fileDialog.filterIndex = 0
dialogResult = fileDialog.showSave()
if dialogResult == adsk.core.DialogResults.DialogOK:
filename = fileDialog.filename
else:
return
des = app.activeProduct
result = 'Name,Expression,Units,Value (database units),Comment,Type,Component\n'
# Get the data for all user parameters.
for userParam in des.userParameters:
result += (userParam.name + ',' + userParam.expression + ',' + userParam.unit + ',' +
str(userParam.value) + ',' + userParam.comment + ',User\n')
for comp in des.allComponents:
for modelParam in comp.modelParameters:
result += (modelParam.name + ',' + modelParam.expression + ',' + modelParam.unit +
',' + str(modelParam.value) + ',' + modelParam.comment + ',Model,' + comp.name + '\n')
output = open(filename, 'w')
output.writelines(result)
output.close()
ui.messageBox('File written to "' + filename + '"')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
do i need to change this bit, parameters = design.userParameters to something like below
# Get the data for all user parameters.
for userParam in des.userParameters:
result += (userParam.name + ',' + userParam.expression + ',' + userParam.unit + ',' +
str(userParam.value) + ',' + userParam.comment + ',User\n')
for comp in des.allComponents:
for modelParam in comp.modelParameters:
result += (modelParam.name + ',' + modelParam.expression + ',' + modelParam.unit +
',' + str(modelParam.value) + ',' + modelParam.comment + ',Model,' + comp.name + '\n')