Here's a little script that demonstrates doing what you need. You'll need to modify the path and the logic for the numbering. I've attached the model I used to test. The thing that's special about it is that it contains a sketch that I named "Text". The script finds that sketch and the text box inside it and continues to edit the text. For each edit, it exports the file as STL.
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
des = adsk.fusion.Design.cast(app.activeProduct)
root = adsk.fusion.Component.cast(des.rootComponent)
# Find the sketch that contains the text to edit.
numSketch = root.sketches.itemByName('Text')
# Iterate through, editing the value and exporting.
path = 'C:\\Temp'
for i in range(1, 5):
# Get the first textbox from the sketch. It uses the first
# one because there's an assumption it's the only one.
skText = numSketch.sketchTexts.item(0)
# Update the text to the current number.
skText.text = str(i)
# Export the file as stl.
filename = os.path.join(path, 'Export_' + str(i) + '.stl')
stlExportOptions = des.exportManager.createSTLExportOptions(root, filename)
stlExportOptions.meshRefinement = adsk.fusion.MeshRefinementSettings.MeshRefinementMedium
des.exportManager.execute(stlExportOptions)
ui.messageBox('Finished exporting files to ' + path)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
---------------------------------------------------------------
Brian EkinsInventor and Fusion 360 API Expert
Website/Blog:
https://EkinsSolutions.com