Hi @Fliegende-Rehe
Apart form native and few neutral formats the file needs to be translated before using it in fusion, so you have to use an upload method to upload the file to the team and use it here is the little script
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc: adsk.core.Document = app.activeDocument
folder: adsk.core.DataFolder = app.data.activeFolder
uploadFolder = folder.uploadFile(r'C:\Users\somepart.CATPart')
isUploading = True
while isUploading:
if uploadFolder.uploadState == adsk.core.UploadStates.UploadFinished:
isUploading = False
elif uploadFolder.uploadState == adsk.core.UploadStates.UploadFailed:
ui.messageBox('Upload failed.')
isUploading = False
adsk.doEvents()
uploadedFile = uploadFolder.dataFile
des: adsk.fusion.Design = doc.products.itemByProductType('DesignProductType')
if doc.isSaved:
des.rootComponent.occurrences.addByInsert(uploadedFile, adsk.core.Matrix3D.create(), True)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
The script will upload the file to active fusion team folder and wait for the upload to complete and once the upload is done then it will insert it into the current document if it is saved.
Boopathi Sivakumar
Senior Technology Consultant