Does the Fusion 360 Personal API Version have stl export limitations?

Does the Fusion 360 Personal API Version have stl export limitations?

lancejordanmills
Explorer Explorer
626 Views
2 Replies
Message 1 of 3

Does the Fusion 360 Personal API Version have stl export limitations?

lancejordanmills
Explorer
Explorer

Hi all,

 

I've been trying to run to modify text and export the body as an stl. The text changes and the message box at the end displays that "it's finished", however the stl does not export. I would like to export one body or the root body of the project. Are there limitations using the API with the personal version or am I missing something? Any help would be appreciated.

 

 

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        design = app.activeProduct
        rootComp = design.rootComponent
        exportMgr = design.exportManager
        
        # Get the sketch named "ChangeText"
        sk = rootComp.sketches.itemByName('ChangeText')
        
        # Get the first sketch text.
        skText = sk.sketchTexts.item(0)

        #Prompts the user for the new Text   
        (returnValue, cancelled) = ui.inputBox('Enter text:', 'New text:', )
        
        # Grab the sketch and first text entity 
        sk = rootComp.sketches.itemByName('ChangeText') 
        skText = sk.sketchTexts.item(0)

        # Change the text.
        skText.text = returnValue

        # Write in the path to the folder where you want to save STL's
        folder = 'C:/Users/millsl/Documents/BobbinSTL'
        
        # Construct the output filename. Name will be the same as you‘ve changed    the text into.
        filename = folder +skText.text + '.stl'


        # Save the file as STL.
        exportMgr = design.exportManager
        stlOptions = exportMgr.createSTLExportOptions(rootComp)
        stlOptions.meshRefinement = adsk.fusion.MeshRefinementSettings.MeshRefinementMedium
        stlOptions.filename = filename
        exportMgr.execute(stlOptions)
        ui.messageBox('Finished.')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))​

 

0 Likes
Accepted solutions (1)
627 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

From this page, you can see what export and import file types are supported by the Personal version of Fusion.  There are a few that are not supported, however, STL is supported in the Personal version.

 

Looking at your code, I think it is working but is writing the STL file to a location you're not looking. You are missing the "/" between the path and filename so you'll be creating the STL files one folder higher than you expect with a name made up of both the folder and filename.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

lancejordanmills
Explorer
Explorer

Good catch! Thank you.

- Lance

0 Likes