Replying to my own post:
I have figured out how to use component.saveCopyAs and have pasted the code below. I still would like to know how I could have it linked to the original component file because it appears to be just a copy. Is this possible?
Eric
#Author-Bunn
#Description-Select Entities on screen and return the filtered selection. Does one at a time only.
import adsk.core, adsk.fusion, adsk.cam, traceback
def selectEnt(msg: str,filtterStr: str) -> adsk.core.Selection:
try:
app = adsk.core.Application.get()
ui = app.userInterface
sel = ui.selectEntity(msg, filtterStr)
#get the BRep from the selection (Programming Interface Fusion 360 API User's Manual Selection Filters)
if filtterStr == 'Faces':
face = adsk.fusion.BRepFace.cast(sel.entity)
return face
elif filtterStr == 'Bodies':
body = adsk.fusion.BRepBody.cast(sel.entity)
return body
elif filtterStr == 'SolidBodies':
body = adsk.fusion.BRepBody.cast(sel.entity)
return body
elif filtterStr == 'Edges':
body = adsk.fusion.BRepEdge.cast(sel.entity)
return body
else:
return sel
except:
return None
def getDataFolder():
# get active datafile
actDataFile: adsk.core.DataFile = app.activeDocument.dataFile
if actDataFile:
# get the unique data file
dataFolder: adsk.core.DataFolder = app.activeDocument.dataFile.parentFolder
return dataFolder
else:
return None
ui = None
app = adsk.core.Application.get()
ui = app.userInterface
root = app.activeProduct.rootComponent
parentName = root.name
ui.messageBox('Select Body')
targetBody: adsk.fusion.BRepFace = selectEnt('Select Body','SolidBodies')
comp = targetBody.parentComponent
name = comp.name
#get dataFolder
dataFolder = getDataFolder()
if not dataFolder:
ui.messageBox('Save file first.')
else:
comp.saveCopyAs(parentName + " " + name + "Tray Design",dataFolder,"","")