<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to upload local image into active project? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-upload-local-image-into-active-project/m-p/6372917#M19808</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;SPAN&gt;Marshal!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Works like a charm!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jun 2016 15:21:19 GMT</pubDate>
    <dc:creator>MiWaNiZa</dc:creator>
    <dc:date>2016-06-08T15:21:19Z</dc:date>
    <item>
      <title>How to upload local image into active project?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-upload-local-image-into-active-project/m-p/6362336#M19806</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to upload image file (e.g. in PNG file format) into active project via API?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regasrds!&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/244476iB286985073CCA18B/image-size/medium?v=v2&amp;amp;px=-1" alt="2016-06-02 18_54_49-Autodesk Fusion 360.png" title="2016-06-02 18_54_49-Autodesk Fusion 360.png" align="left" border="0" /&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/244477iBE62FABC47A942EC/image-size/medium?v=v2&amp;amp;px=-1" alt="2016-06-02 18_54_03-Autodesk Fusion 360.png" title="2016-06-02 18_54_03-Autodesk Fusion 360.png" align="left" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 15:57:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-upload-local-image-into-active-project/m-p/6362336#M19806</guid>
      <dc:creator>MiWaNiZa</dc:creator>
      <dc:date>2016-06-02T15:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload local image into active project?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-upload-local-image-into-active-project/m-p/6369706#M19807</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately data.activeProject API wasn't implemented yet. If you know which project you are going to upload your image file to, there would be a workaround for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following codes would demo how to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;#Author-
#Description-

import adsk.core, adsk.fusion, adsk.cam, traceback
import time

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        activeProject = None
        for project in app.data.dataProjects:
            if project.name == "Marshal's First Project":
                activeProject = project
                break
            
        uploadfuture = activeProject.rootFolder.uploadFile('/Users/tum/Desktop/My Picture.png')
        while uploadfuture.uploadState == adsk.core.UploadStates.UploadProcessing:
            time.sleep(1)
            adsk.doEvents()
        
        if uploadfuture.uploadState == adsk.core.UploadStates.UploadFinished: 
            ui.messageBox('Upload succeeded {}'.format(activeProject.name))
        else:
            ui.messageBox('Upload failed.')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/PRE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Marshal&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 09:02:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-upload-local-image-into-active-project/m-p/6369706#M19807</guid>
      <dc:creator>marshaltu</dc:creator>
      <dc:date>2016-06-07T09:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload local image into active project?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-upload-local-image-into-active-project/m-p/6372917#M19808</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;SPAN&gt;Marshal!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Works like a charm!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2016 15:21:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-upload-local-image-into-active-project/m-p/6372917#M19808</guid>
      <dc:creator>MiWaNiZa</dc:creator>
      <dc:date>2016-06-08T15:21:19Z</dc:date>
    </item>
  </channel>
</rss>

