Message 1 of 2
Import Manager Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
import adsk.core, adsk.fusion, traceback
import os.path, sys
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Get import manager
importManager = app.importManager
# Get step import options
stpFileName = 'C:\\Users\Phartman.hartprecision\Desktop\WAGDE-MB723291S-S.STEP'
stpOptions = importManager.createSTEPImportOptions(stpFileName)
stpOptions.isViewFit = False
# Get active design
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
# Get root component
rootComp = design.rootComponent
# Import step file to root component
importManager.importToTarget(stpOptions, rootComp)
# Close the new created document
doc = app.activeDocument
doc.close(False)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))SAMPLE CODE:
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-3f24e9e8-422d-11e5-937b-f8b156d7cd97
Trying to run the sample code from the link attached. Getting error "AttributeError: "NoneType" object has no attribute 'rootComponent' . When uploading the file from my computer without the add-in it works fine. Why is this happening? Any would be greatly appreciated!