How to save as USD file with API

How to save as USD file with API

ruk.shan
Observer Observer
596 Views
4 Replies
Message 1 of 5

How to save as USD file with API

ruk.shan
Observer
Observer
There is a way to export STL files with API "utils.export_stl(app, save_dir)"  . Is there a similar way to save as USD files ?
0 Likes
597 Views
4 Replies
Replies (4)
Message 2 of 5

Rushikesh.kadam
Autodesk
Autodesk

@ruk.shan Here is a link that shows how to export to USD format using API. 

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-78B91813-88C3-4777-AEC2-19F5FB438ED2

 

------------------------------------------------------------------------------------------------------------------------------

If my reply was helpful, please click the "Accept as Solution" button. It helps others get the answer quickly! A "Like" is always welcomed.




Rushikesh Kadam
Senior QA Engineer
Quality Assurance
Autodesk, Inc.


0 Likes
Message 3 of 5

ruk.shan
Observer
Observer
Great. Thank you so much
0 Likes
Message 4 of 5

Jorge_Jaramillo
Collaborator
Collaborator

Hi,

With this function you can export the currently open design:

 

def exportToUSD():
    try:
        global _app, _ui

        exportMgr = adsk.fusion.ExportManager.cast(_app.activeProduct.exportManager)
        usdOptions = exportMgr.createUSDExportOptions(tempfile.gettempdir() + "/test.usd")
        return(f'export to USD was: {exportMgr.execute(usdOptions)}')

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
        return(f'error exporting to {tempfile.gettempdir() + "/test.usd"}')

Regards,

Jorge

 

Message 5 of 5

hclmed
Enthusiast
Enthusiast

Thanks for this example. Is there a method that also includes joints, since those are supported by USD?

0 Likes