Fusion doesn't support that in the UI, but here's a script that will write all selected bodies into a single STL file. It maintains their current position. The bodies need to be selected before running the script.
Fusion does support exporting a component, which can have any number of bodies. This takes advantage of that by creating a new design, copying the selected bodies into the root component of the new design, and then exporting the root component. It then closes the new design without saving.
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Get the currently selected bodies.
bodies = []
tempBRep = adsk.fusion.TemporaryBRepManager.get()
for selection in ui.activeSelections:
if isinstance(selection.entity, adsk.fusion.BRepBody):
# Create a temporary B-Rep copy of the body and add it to the list.
# Creating a copy maintains the current position of the body.
bodies.append(tempBRep.copy(selection.entity))
# Create a new design.
newDoc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
des: adsk.fusion.Design = newDoc.products.itemByProductType('DesignProductType')
# Make it a direct modeling design. No parametrics are needed so this is faster.
des.designType = adsk.fusion.DesignTypes.DirectDesignType
# Add the bodies to the root component of the new design.
root = des.rootComponent
for body in bodies:
root.bRepBodies.add(body)
# Export the root component as STL.
exportMgr = des.exportManager
stlOptions = exportMgr.createSTLExportOptions(root, 'C:/Temp/MultiBody.stl')
stlOptions.sendToPrintUtility = False
exportMgr.execute(stlOptions)
# Close the document, without saving.
newDoc.close(False)
ui.messageBox('Finished.')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
---------------------------------------------------------------
Brian EkinsInventor and Fusion 360 API Expert
Website/Blog:
https://EkinsSolutions.com