The guts of how to do this is fairly simple and can be pieced together from existing samples. By "guts" I mean the basic operations that will be happening; edit one or more parameters, export the model to stl. Where it gets more difficult, mainly because there are so many options and it's easy to get carried away with options, is defining the user interface. You could have a fairly complex dialog that lets the user specify which parameters will be changing and the range of values over the changes, the number of steps, the naming scheme for the output files, and the output folder. You could spend a few minutes on the basic functionality and a few days on the UI. Another option would be for the program to consume an Excel file (easiest would be CSV) where each row would have the values and output filename to use. That would be easier and provide more flexibility because each iteration could be completely different but it would require more work to set up the CSV file.
Below is a simple program with the "guts". It's hard-coded to do what you described originally.
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
design = adsk.fusion.Design.cast(app.activeProduct)
# Get the root component of the active design
rootComp = design.rootComponent
# Specify the folder to write out the results.
folder = 'C:/Temp/STLExport/'
# Get the parameters named "Length" and "Width" to change.
lengthParam = design.allParameters.itemByName('Length')
widthParam = design.allParameters.itemByName('Width')
for i in range(1,11):
for j in range(1,11):
length = i * 10
width = j * 10
lengthParam.expression = str(length)
widthParam.expression = str(width)
# Let the view have a chance to paint just so you can watch the progress.
adsk.doEvents()
# Construct the output filename.
filename = folder + str(length) + 'x' + str(width) + '.stl'
# Save the file as STL.
exportMgr = adsk.fusion.ExportManager.cast(design.exportManager)
stlOptions = exportMgr.createSTLExportOptions(rootComp)
stlOptions.meshRefinement = adsk.fusion.MeshRefinementSettings.MeshRefinementMedium
stlOptions.filename = filename
exportMgr.execute(stlOptions)
ui.messageBox('Finished.')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))