<?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: Run on startup in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/run-on-startup/m-p/7229615#M17842</link>
    <description>&lt;P&gt;In previous message I forgot to say that actual code was in branch AddIn (I have already merged that branch into master).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Frankly, I have found my mistake, I tried to call that lines:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;design = adsk.fusion.Design.cast(product)
&amp;nbsp;rootComp = design.rootComponent&lt;/PRE&gt;
&lt;P&gt;out of methods, as global paremeters.&lt;/P&gt;
&lt;P&gt;When it was &lt;EM&gt;Script&lt;/EM&gt;, everything worked fine, but when it became &lt;EM&gt;AddIn -&amp;nbsp;&lt;/EM&gt;we got Run On Startup error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tnx for your time and help.&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jul 2017 21:37:30 GMT</pubDate>
    <dc:creator>copypastestd</dc:creator>
    <dc:date>2017-07-14T21:37:30Z</dc:date>
    <item>
      <title>Run on startup</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/run-on-startup/m-p/7226109#M17840</link>
      <description>&lt;P&gt;Hello there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Me and my buddy working on some Addin - &lt;A href="https://github.com/PhilippNox/NiceBox-360" target="_blank"&gt;https://github.com/PhilippNox/NiceBox-360&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First version almost done, but we have problem with feature Run on startup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Run Startup.PNG" style="width: 404px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/377544i54F7F450A37A513C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Run Startup.PNG" alt="Run Startup.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Our AddIn just do not wonna start by in self with Fusion, and every time user have to go Scripts and Addin to run it manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where here could be a problem? Is in Fusion any special code lines for Run on startup feature?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 15:03:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/run-on-startup/m-p/7226109#M17840</guid>
      <dc:creator>copypastestd</dc:creator>
      <dc:date>2017-07-13T15:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Run on startup</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/run-on-startup/m-p/7229466#M17841</link>
      <description>&lt;P&gt;I'm not sure why your program is showing up on the Add-Ins tab but I took a look at your code and it's a script, not an add-in.&amp;nbsp; There are two things that make it a script.&amp;nbsp; The first is the contents of the .manifest file.&amp;nbsp; You can see in there that the type is defined as "script".&amp;nbsp; Looking at your code itself, you also have script specific code.&amp;nbsp; In the run function you're creating the command definition and then executing it, and setting the autoTerminate so the script doesn't stop running.&amp;nbsp; That's all correct when implementing a command within a script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For an add-in you can still re-use almost all of your code.&amp;nbsp; The main difference will be in the run function where you'll need to add a button to somewhere into Fusion's toolbar.&amp;nbsp; You don't need to set the autoTerminate because an add-in doesn't automatically terminate.&amp;nbsp; When the user&amp;nbsp;clicks the button you created that will result in the command created event being fired to your add-in and your command will run like it does now.&amp;nbsp; An add-in also has a stop function that is called when your add-in is unloaded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend using the Script and Add-Ins command to create a new add-in and then copy and paste most of your code from your script into the add-in.&amp;nbsp; Most of your existing code in the run function can still be used but you'll need to add the code to create the button.&amp;nbsp; You'll also need to add code to the stop function to clean up the ui when your add-in is unloaded.&amp;nbsp; This topic from the online help should help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-F31C76F0-8C74-4343-904C-68FDA9BB8B4C" target="_blank"&gt;http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-F31C76F0-8C74-4343-904C-68FDA9BB8B4C&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 20:10:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/run-on-startup/m-p/7229466#M17841</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2017-07-14T20:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Run on startup</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/run-on-startup/m-p/7229615#M17842</link>
      <description>&lt;P&gt;In previous message I forgot to say that actual code was in branch AddIn (I have already merged that branch into master).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Frankly, I have found my mistake, I tried to call that lines:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;design = adsk.fusion.Design.cast(product)
&amp;nbsp;rootComp = design.rootComponent&lt;/PRE&gt;
&lt;P&gt;out of methods, as global paremeters.&lt;/P&gt;
&lt;P&gt;When it was &lt;EM&gt;Script&lt;/EM&gt;, everything worked fine, but when it became &lt;EM&gt;AddIn -&amp;nbsp;&lt;/EM&gt;we got Run On Startup error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tnx for your time and help.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 21:37:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/run-on-startup/m-p/7229615#M17842</guid>
      <dc:creator>copypastestd</dc:creator>
      <dc:date>2017-07-14T21:37:30Z</dc:date>
    </item>
  </channel>
</rss>

