@ruban2 .
We don't have enough information to know exactly what you want.
(e.g. depth of the component, you want the output in the position it is positioned at the joint, etc.)
We have created these scripts in anticipation.
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
import pathlib
import re
EXPORT_FOLDER = pathlib.Path(r'C:\temp')
def run(context):
ui = core.UserInterface.cast(None)
try:
app: core.Application = core.Application.get()
ui = app.userInterface
des: fusion.Design = app.activeProduct
root: fusion.Component = des.rootComponent
exportMgr: fusion.ExportManager = des.exportManager
app.executeTextCommand(u'Transaction.Start export_step')
set_all_lightbulb(False)
# export root component
root.isBodiesFolderLightBulbOn = True
path = str(EXPORT_FOLDER / get_export_file_name(f'{root.name}') )
stpOptions: fusion.STEPExportOptions = exportMgr.createSTEPExportOptions(
path,
root
)
exportMgr.execute(stpOptions)
root.isBodiesFolderLightBulbOn = False
# export occurrence
for occ in root.occurrences:
occ.isLightBulbOn = True
path = str(EXPORT_FOLDER / get_export_file_name(f'{occ.name}') )
stpOptions = exportMgr.createSTEPExportOptions(path, root)
exportMgr.execute(stpOptions)
occ.isLightBulbOn = False
app.executeTextCommand(u'Transaction.Abort')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def get_export_file_name(fileName: str) -> str:
return re.sub(r'[\\|/|:|?|.|"|<|>|\|]', '_', fileName)
def set_all_lightbulb(isLight: bool) -> None:
app: core.Application = core.Application.get()
des: fusion.Design = app.activeProduct
root: fusion.Component = des.rootComponent
root.isBodiesFolderLightBulbOn = isLight
occ: fusion.Occurrence = None
for occ in root.allOccurrences:
occ.isLightBulbOn = isLight
If it is different from what you want, please attach as simple and specific f3d/f3z files as possible.