Importing Image as Canvas Using API?

Importing Image as Canvas Using API?

Anonymous
906 Views
6 Replies
Message 1 of 7

Importing Image as Canvas Using API?

Anonymous
Not applicable

Hello all. Is there any way to import a .jpg or .png image to a plane using the API? Trying to insert a reference image to go alongside our 3D model. So far we have found out how to insert an .svg onto a construction plane, however the image quality is extremely poor after the conversion (from .jpg to .svg) thus it no longer has landmarks that serve our purpose. If there is any way to get a .jpg with a canvas onto a plane using the API that would be exactly what we are looking for! 

 

Thank you for your help!

0 Likes
907 Views
6 Replies
Replies (6)
Message 2 of 7

BrianEkins
Mentor
Mentor

Unfortunately, that capability is not supported by the API. Hopefully, at some point in the future, but I don't know.

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

Anonymous
Not applicable

Ah, too bad to hear. Thank you for the response! My team and I hope to see this feature implemented sometime in the future.

0 Likes
Message 4 of 7

mitgandhi
Observer
Observer

import adsk.core, adsk.fusion, traceback

def run(context😞

try:

app = adsk.core.Application.get()

ui = app.userInterface

# Get the active design.

product = app.activeProduct

design = adsk.fusion.Design.cast(product)

root = design.rootComponent

# Get the path to the image file.

file_path = r"C:\path\to\image.png"

# Import the image into Fusion 360.

import_manager = design.importManager

import_options = import_manager.createImportOptions(file_path)

imported = import_manager.importToRootComponent(import_options)

ui.messageBox("Image imported successfully!", "Success")

except:

ui.messageBox("Failed to import image:\n{}".format(traceback.format_exc()), "Error")

0 Likes
Message 5 of 7

mitgandhi
Observer
Observer

The emoji has me posted by mistake.

0 Likes
Message 6 of 7

mitgandhi
Observer
Observer

import adsk.core, adsk.fusion, traceback

def run(context)

try:

app = adsk.core.Application.get()

ui = app.userInterface

# Get the active design.

product = app.activeProduct

design = adsk.fusion.Design.cast(product)

root = design.rootComponent

# Get the path to the image file.

file_path = r"C:\path\to\image.png"

# Import the image into Fusion 360.

import_manager = design.importManager

import_options = import_manager.createImportOptions(file_path)

imported = import_manager.importToRootComponent(import_options)

ui.messageBox("Image imported successfully!""Success")

except:

ui.messageBox("Failed to import image:\n{}".format(traceback.format_exc()), "Error")

0 Likes
Message 7 of 7

BrianEkins
Mentor
Mentor

What is this sample supposed to be? It doesn't work and is calling a function that doesn't exist.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes