I've also done some exploring and edited the DumpParameters script written by Brian Ekins, but I still can't output the on-screen names of the 'feature' level of the Parameter Dialog window. Here's the script as I have re-worked it:
#Author-Brian Ekins
#Altered by Stephen Brzykcy
#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 = 'Component,Type,CreatedBy,Role,Expression,Unit,cmORrad,ParamName\n'
# Get the data for all user parameters.
for userParam in des.userParameters:
result += ('UserComp,User,NA,' + userParam.comment + ',' + userParam.expression +
',' + userParam.unit + ',' + str(userParam.value) + ',' + userParam.name + '\n')
for comp in des.allComponents:
for modelParam in comp.modelParameters:
result += (comp.name + ',Model,' + str(modelParam.createdBy) + ',' + modelParam.role + ',' + modelParam.expression +
',' + modelParam.unit + ',' + str(modelParam.value) + ',' + modelParam.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()))
Here is a snippet of the csv output:
This does ok. I would still like to have the on-screen names of the features referenced by their dimensions, not just the component. Can anyone help?
Thanks!
-Stephen