<?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 add a button in the Fusion 360 &amp;quot;navigation toolbar&amp;quot; in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13096333#M1614</link>
    <description>&lt;P&gt;I spent quite a lot of time trying to get buttons and icons working—probably several hours in total.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to promote a custom button to the toolbar from my Add-In, but it wouldn't work without an icon. Finding the correct paths to the icon felt like higher science!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code that finally worked for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmd_definitions = ui.commandDefinitions
button = cmd_definitions.itemById('updateTextCommand')
if not button:
        button = cmd_definitions.addButtonDefinition('updateTextCommand', 'ButtonText', 'ButtonDescription', './Resources/Command')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Initially, I tried putting the images in the same folder as my Python code within the Add-In folder, but that didn't work. Eventually, I created a subfolder called &lt;EM&gt;Resources&lt;/EM&gt; and another subfolder inside that named &lt;EM&gt;Command&lt;/EM&gt;. I placed the images there for testing, and the file names that worked were: 32x32-normal.svg or 32x32-normal.png.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Important note&lt;/STRONG&gt;: Fusion 360 seems to load all resources when it starts up. I wasted a lot of time before realizing that&amp;nbsp;&lt;SPAN&gt;I needed to restart Fusion for the changes to take effect. Once I did that, everything worked fine. I tried so many different things that it's possible other setups would have worked after a restart—but I don't have the energy to test them all again!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm still unsure if the file naming is exactly right, but it seems to work. If you're looking for more info, you might want to check this reference: &lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-F31C76F0-8C74-4343-904C-68FDA9BB8B4C#IconsForCommands" target="_new" rel="noopener"&gt;&lt;SPAN&gt;Fusion&lt;/SPAN&gt;&lt;SPAN&gt; 360&lt;/SPAN&gt;&lt;SPAN&gt; Icon&lt;/SPAN&gt;&lt;SPAN&gt; Reference&lt;/SPAN&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just wanted to share my experience for anyone else struggling with the same issue. Hope this helps!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 20 Oct 2024 19:27:25 GMT</pubDate>
    <dc:creator>juha2008</dc:creator>
    <dc:date>2024-10-20T19:27:25Z</dc:date>
    <item>
      <title>How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12708029#M1605</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I want to add a button in the Fusion 360 "navigation toolbar" that could simulate pressing the "Escape" key.&lt;BR /&gt;I thank you in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Apr 2024 20:58:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12708029#M1605</guid>
      <dc:creator>jean-jacques_juille</dc:creator>
      <dc:date>2024-04-14T20:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12708807#M1606</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;you can add a button to the NavBar like so:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; //declare constants
 std::string NavBarBtnID = "NavBarBtn";
 std::string NavBarBtnName = "NavBarBtn";

 //add commmand def
 Ptr&amp;lt;CommandDefinition&amp;gt; NavBarBtnCmdDef;
 NavBarBtnCmdDef = ui-&amp;gt;commandDefinitions()-&amp;gt;itemById(NavBarBtnID);
 if (!NavBarBtnCmdDef)
     NavBarBtnCmdDef = ui-&amp;gt;commandDefinitions()-&amp;gt;addButtonDefinition(NavBarBtnID, NavBarBtnName, "Sample btn", "");

 // add btn to the toolbar
 Ptr&amp;lt;Toolbar&amp;gt; navToolbar = ui-&amp;gt;toolbars()-&amp;gt;itemById("NavToolBar");
 Ptr&amp;lt;ToolbarControls&amp;gt; navToolbarControls = navToolbar-&amp;gt;controls();
 bool wasAdded = navToolbarControls-&amp;gt;addCommand(NavBarBtnCmdDef, "", false);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 08:27:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12708807#M1606</guid>
      <dc:creator>j4n.vokurka</dc:creator>
      <dc:date>2024-04-15T08:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12709046#M1607</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I'm really sorry but I forgot to specify that I want this add-in in Python&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 10:26:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12709046#M1607</guid>
      <dc:creator>jean-jacques_juille</dc:creator>
      <dc:date>2024-04-15T10:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12709083#M1608</link>
      <description>&lt;P&gt;For the most part (there are some language specific differences), it's just about transcribing the syntax since you still work with the same API. For that you can use AI if you are lazy like me, but here you go:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;# Declare constants
navBarBtnID = "NavBarBtn"
navBarBtnName = "NavBarBtn"
# Add command definition
navBarBtnCmdDef = ui.commandDefinitions.itemById(navBarBtnID)
if not navBarBtnCmdDef:
    navBarBtnCmdDef = ui.commandDefinitions.addButtonDefinition(navBarBtnID, navBarBtnName, "Sample btn", "")

# Add button to the toolbar
navToolbar = ui.toolbars.itemById("navToolBar")
navToolbarControls = navToolbar.controls
wasAdded = navToolbarControls.addCommand(navBarBtnCmdDef, "", False)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 10:48:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12709083#M1608</guid>
      <dc:creator>j4n.vokurka</dc:creator>
      <dc:date>2024-04-15T10:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12709659#M1609</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I created a new add-in in Python that I named "EscapeBtn", I edited the "EscapeBtn.py" file, I pasted your Python code just below the try def run(context) but apparently nothing is happening, I don't see a button added to my navigation toolbar (bottom). Forgive me but I'm a beginner and wonder if I pasted the code in the right place. Can you continue to help me?&lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 14:21:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12709659#M1609</guid>
      <dc:creator>jean-jacques_juille</dc:creator>
      <dc:date>2024-04-15T14:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12711150#M1610</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;paste in the code please so I can check it.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 06:34:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12711150#M1610</guid>
      <dc:creator>j4n.vokurka</dc:creator>
      <dc:date>2024-04-16T06:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12711389#M1611</link>
      <description>&lt;P&gt;Below is the code for my Escapebtn.py file,&amp;nbsp;Thank you for your patient :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# Assuming you have not changed the general structure of the template no modification is needed in this file.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; . &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;commands&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; .&lt;/SPAN&gt;&lt;SPAN&gt;lib&lt;/SPAN&gt; &lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;fusion360utils&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;futil&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;context&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Declare constants&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnID&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"NavBarBtn"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnName&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"NavBarBtn"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Add command definition&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnCmdDef&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.commandDefinitions.itemById(&lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnID&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; &lt;SPAN&gt;not&lt;/SPAN&gt; &lt;SPAN&gt;navBarBtnCmdDef&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnCmdDef&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.commandDefinitions.addButtonDefinition(&lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnID&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnName&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Sample btn"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Add button to the toolbar&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;navToolbar&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.toolbars.itemById(&lt;/SPAN&gt;&lt;SPAN&gt;"navToolBar"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;navToolbarControls&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;navToolbar&lt;/SPAN&gt;&lt;SPAN&gt;.controls&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;wasAdded&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;navToolbarControls&lt;/SPAN&gt;&lt;SPAN&gt;.addCommand(&lt;/SPAN&gt;&lt;SPAN&gt;navBarBtnCmdDef&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;False&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# This will run the start function in each of your commands as defined in commands/__init__.py&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;commands&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;start&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;futil&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;handle_error&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'run'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;stop&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;context&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Remove all of the event handlers your app has created&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;futil&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;clear_handlers&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# This will run the start function in each of your commands as defined in commands/__init__.py&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;commands&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;stop&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;futil&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;handle_error&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'stop'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 08:38:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12711389#M1611</guid>
      <dc:creator>jean-jacques_juille</dc:creator>
      <dc:date>2024-04-16T08:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12712917#M1612</link>
      <description>&lt;P&gt;I have written the whole add-in from start, here's the code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import traceback
import adsk.fusion
import adsk.core

# Declare constants
_app: adsk.core.Application = None
_ui: adsk.core.UserInterface = None
_handlers = []
_navBarBtnID = "NavBarBtn"
_navBarBtnName = "NavBarBtn"
_toolbar = "NavToolbar"

def run(context):
    try:
        global _app, _ui, _handlers, _navBarBtnID, _navBarBtnName, _toolbar
        _app = adsk.core.Application.get()
        _ui = _app.userInterface   

        # Add command definition
        navBarBtnCmdDef = _ui.commandDefinitions.itemById(_navBarBtnID)
        if not navBarBtnCmdDef:
            navBarBtnCmdDef = _ui.commandDefinitions.addButtonDefinition(_navBarBtnID, _navBarBtnName, "Sample btn", "Resources")

        # Connect to the command created event.
        sampleCommandCreated = SampleCommandCreatedEventHandler()
        navBarBtnCmdDef.commandCreated.add(sampleCommandCreated)
        _handlers.append(sampleCommandCreated)

        
        # for toolbar in _ui.toolbars:
        #     _app.log(toolbar.id)

        # Add button to the toolbar
        navToolbar = _ui.toolbars.itemById(_toolbar)
        navToolbarControls = navToolbar.controls
        escapeBtn = navToolbarControls.addCommand(navBarBtnCmdDef, "", False)
    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

# Event handler for the commandCreated event.
class SampleCommandCreatedEventHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
        cmd = eventArgs.command

        global _app, _handlers

        _ui.messageBox("Implement your logic here.")          


def stop(context):
    try:
        global _app, _ui, _handlers, _navBarBtnID, _navBarBtnName, _toolbar
        _app = adsk.core.Application.get()
        _ui = _app.userInterface
        
        # Clean up the UI.  
        navToolbar = _ui.toolbars.itemById(_toolbar)
        navToolbarControls = navToolbar.controls

        cntrl = navToolbarControls.itemById(_navBarBtnID)
        if cntrl:
            cntrl.deleteMe()

        navBarBtnCmdDef = _ui.commandDefinitions.itemById(_navBarBtnID)
        if not navBarBtnCmdDef:
            navBarBtnCmdDef.deleteMe()

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;&lt;P&gt;Don't forget to adjust the path to icon to your own on line 22.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 20:17:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12712917#M1612</guid>
      <dc:creator>j4n.vokurka</dc:creator>
      <dc:date>2024-04-16T20:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12713053#M1613</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;I just tried your code and it works great. I just had a problem with the icon path. I had to replace the relative path of the icons with the absolute path. I am really pleased with your help and thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 21:51:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/12713053#M1613</guid>
      <dc:creator>jean-jacques_juille</dc:creator>
      <dc:date>2024-04-16T21:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13096333#M1614</link>
      <description>&lt;P&gt;I spent quite a lot of time trying to get buttons and icons working—probably several hours in total.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to promote a custom button to the toolbar from my Add-In, but it wouldn't work without an icon. Finding the correct paths to the icon felt like higher science!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code that finally worked for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmd_definitions = ui.commandDefinitions
button = cmd_definitions.itemById('updateTextCommand')
if not button:
        button = cmd_definitions.addButtonDefinition('updateTextCommand', 'ButtonText', 'ButtonDescription', './Resources/Command')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Initially, I tried putting the images in the same folder as my Python code within the Add-In folder, but that didn't work. Eventually, I created a subfolder called &lt;EM&gt;Resources&lt;/EM&gt; and another subfolder inside that named &lt;EM&gt;Command&lt;/EM&gt;. I placed the images there for testing, and the file names that worked were: 32x32-normal.svg or 32x32-normal.png.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Important note&lt;/STRONG&gt;: Fusion 360 seems to load all resources when it starts up. I wasted a lot of time before realizing that&amp;nbsp;&lt;SPAN&gt;I needed to restart Fusion for the changes to take effect. Once I did that, everything worked fine. I tried so many different things that it's possible other setups would have worked after a restart—but I don't have the energy to test them all again!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm still unsure if the file naming is exactly right, but it seems to work. If you're looking for more info, you might want to check this reference: &lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-F31C76F0-8C74-4343-904C-68FDA9BB8B4C#IconsForCommands" target="_new" rel="noopener"&gt;&lt;SPAN&gt;Fusion&lt;/SPAN&gt;&lt;SPAN&gt; 360&lt;/SPAN&gt;&lt;SPAN&gt; Icon&lt;/SPAN&gt;&lt;SPAN&gt; Reference&lt;/SPAN&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just wanted to share my experience for anyone else struggling with the same issue. Hope this helps!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 20 Oct 2024 19:27:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13096333#M1614</guid>
      <dc:creator>juha2008</dc:creator>
      <dc:date>2024-10-20T19:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101062#M1615</link>
      <description>&lt;P&gt;i just created a button, but now how can i add a script to run when pushing the new botton?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 17:16:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101062#M1615</guid>
      <dc:creator>nubrandao</dc:creator>
      <dc:date>2024-10-22T17:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101207#M1616</link>
      <description>&lt;P&gt;Here is my full Add-In code for reference. Please note to create Add-In instead of Script.&lt;BR /&gt;&lt;BR /&gt;I have a model with user parameter which I could increase and decrease by 5 mm. Then if I change HeightQ paramter manually, then I have button to refresh certain sketch with text to have the dimension in it. For example parameter value is 15 mm, then sketch will have text in it "15 mm".&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
import adsk.core, adsk.fusion

app = adsk.core.Application.get()
ui = app.userInterface
handlers = []

# Funktiot, joilla kasvatetaan ja pienennetään parametriarvoa ja päivitetään teksti
def change_height_param(increment):
    try:
        design = app.activeProduct
        if not design:
            ui.messageBox('Ei aktiivista suunnittelua')
            return

        userParams = design.userParameters
        heightParam = userParams.itemByName('HeightQ')

        if heightParam:
            new_value = heightParam.value + (increment / 10)  # Muutos senttimetreissä
            heightParam.value = new_value
            update_text_with_height_param()  # Päivitetään luonnoksen teksti
        else:
            ui.messageBox('Parametri HeightQ ei löytynyt')
    except Exception as e:
        ui.messageBox(f'Virhe parametrin muuttamisessa: {str(e)}')

# Tekstin päivitystoiminto (sama kuin ennen)
def update_text_with_height_param():
    try:
        design = app.activeProduct
        if not design:
            ui.messageBox('Ei aktiivista suunnittelua')
            return

        rootComp = design.rootComponent
        if not rootComp:
            ui.messageBox('Ei komponenttia saatavilla')
            return

        sketches = rootComp.sketches
        for sketch in sketches:
            if sketch.name == 'HeightText':
                userParams = design.userParameters
                heightParam = userParams.itemByName('HeightQ')

                if heightParam:
                    heightValue = int(heightParam.value * 10)  # Muunna senttimetreistä millimetreiksi
                    sketchTexts = sketch.sketchTexts
                    if sketchTexts.count &amp;gt; 0:
                        textElement = sketchTexts.item(0)
                        textElement.text = str(heightValue) + ' mm'
                    else:
                        ui.messageBox('Ei tekstielementtejä luonnoksessa')
                else:
                    ui.messageBox('Parametri HeightQ ei löytynyt')
    except Exception as e:
        ui.messageBox(f'Virhe tekstin päivityksessä: {str(e)}')

# Käsittelijät eri komennoille ilman ID-viittauksia
class IncreaseCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
            command = eventArgs.command
            onExecute = IncreaseCommandExecuteHandler()
            command.execute.add(onExecute)
            handlers.append(onExecute)
        except Exception as e:
            ui.messageBox(f'Virhe Increase-komennon luonnissa: {str(e)}')

class IncreaseCommandExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            change_height_param(5)  # Kasvatetaan 5 mm
        except Exception as e:
            ui.messageBox(f'Virhe Increase-komennossa: {str(e)}')

class DecreaseCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
            command = eventArgs.command
            onExecute = DecreaseCommandExecuteHandler()
            command.execute.add(onExecute)
            handlers.append(onExecute)
        except Exception as e:
            ui.messageBox(f'Virhe Decrease-komennon luonnissa: {str(e)}')

class DecreaseCommandExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            change_height_param(-5)  # Pienennetään 5 mm
        except Exception as e:
            ui.messageBox(f'Virhe Decrease-komennossa: {str(e)}')

class RefreshCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
            command = eventArgs.command
            onExecute = RefreshCommandExecuteHandler()
            command.execute.add(onExecute)
            handlers.append(onExecute)
        except Exception as e:
            ui.messageBox(f'Virhe Refresh-komennon luonnissa: {str(e)}')

class RefreshCommandExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            update_text_with_height_param()  # Päivitä tekstielementti luonnoksessa
        except Exception as e:
            ui.messageBox(f'Virhe Refresh-komennossa: {str(e)}')

# Komennon luonti
def create_adjustment_buttons():
    try:
        # Selvitä Add-Inin hakemisto ja muodosta oikea polku kuvakkeille
        addin_path = os.path.dirname(os.path.realpath(__file__))
        resources_path = os.path.join(addin_path, 'Resources')

        # Lisää Increase-nappula
        increase_button = ui.commandDefinitions.itemById('increaseHeightCommand')
        if not increase_button:
            increase_button = ui.commandDefinitions.addButtonDefinition(
                'increaseHeightCommand', 'Increase Height', 'Kasvattaa Height-parametrin arvoa 5 mm',
                os.path.join(resources_path, 'Plus')
            )

        # Lisää Decrease-nappula
        decrease_button = ui.commandDefinitions.itemById('decreaseHeightCommand')
        if not decrease_button:
            decrease_button = ui.commandDefinitions.addButtonDefinition(
                'decreaseHeightCommand', 'Decrease Height', 'Pienentää Height-parametrin arvoa 5 mm',
                os.path.join(resources_path, 'Minus')
            )

        # Lisää Refresh-nappula
        refresh_button = ui.commandDefinitions.itemById('refreshHeightCommand')
        if not refresh_button:
            refresh_button = ui.commandDefinitions.addButtonDefinition(
                'refreshHeightCommand', 'Refresh', 'Päivitä tekstielementti parametrin perusteella',
                os.path.join(resources_path, 'Refresh')
            )

        # Rekisteröi Increase-komento
        onIncreaseCreated = IncreaseCommandCreatedHandler()
        increase_button.commandCreated.add(onIncreaseCreated)
        handlers.append(onIncreaseCreated)

        # Rekisteröi Decrease-komento
        onDecreaseCreated = DecreaseCommandCreatedHandler()
        decrease_button.commandCreated.add(onDecreaseCreated)
        handlers.append(onDecreaseCreated)

        # Rekisteröi Refresh-komento
        onRefreshCreated = RefreshCommandCreatedHandler()
        refresh_button.commandCreated.add(onRefreshCreated)
        handlers.append(onRefreshCreated)

        # Lisää nappulat Modify-paneeliin ja promoted-tilaan
        workspace = ui.workspaces.itemById('FusionSolidEnvironment')
        toolbar_tab = workspace.toolbarTabs.itemById('SolidTab')
        modify_panel = toolbar_tab.toolbarPanels.itemById('SolidModifyPanel')

        if modify_panel:
            increase_control = modify_panel.controls.itemById('increaseHeightCommand')
            if not increase_control:
                increase_control = modify_panel.controls.addCommand(increase_button)
            increase_control.isPromoted = True

            decrease_control = modify_panel.controls.itemById('decreaseHeightCommand')
            if not decrease_control:
                decrease_control = modify_panel.controls.addCommand(decrease_button)
            decrease_control.isPromoted = True

            refresh_control = modify_panel.controls.itemById('refreshHeightCommand')
            if not refresh_control:
                refresh_control = modify_panel.controls.addCommand(refresh_button)
            refresh_control.isPromoted = True

    except Exception as e:
        ui.messageBox(f'Virhe komennon luomisessa: {str(e)}')

# Komennon käynnistys
def run(context):
    try:
        create_adjustment_buttons()  # Luo Increase, Decrease ja Refresh -nappulat käyttöliittymään
    except Exception as e:
        ui.messageBox(f'Virhe run-funktiossa: {str(e)}')

# Komennon lopetus
def stop(context):
    try:
        # Poista kaikki komennot ja tapahtumakäsittelijät
        cmd_definitions = ui.commandDefinitions

        # Poista Increase-nappula
        increase_button = cmd_definitions.itemById('increaseHeightCommand')
        if increase_button:
            increase_button.deleteMe()

        # Poista Decrease-nappula
        decrease_button = cmd_definitions.itemById('decreaseHeightCommand')
        if decrease_button:
            decrease_button.deleteMe()

        # Poista Refresh-nappula
        refresh_button = cmd_definitions.itemById('refreshHeightCommand')
        if refresh_button:
            refresh_button.deleteMe()

        workspace = ui.workspaces.itemById('FusionSolidEnvironment')
        toolbar_tab = workspace.toolbarTabs.itemById('SolidTab')
        modify_panel = toolbar_tab.toolbarPanels.itemById('SolidModifyPanel')

        if modify_panel:
            increase_control = modify_panel.controls.itemById('increaseHeightCommand')
            if increase_control:
                increase_control.deleteMe()

            decrease_control = modify_panel.controls.itemById('decreaseHeightCommand')
            if decrease_control:
                decrease_control.deleteMe()

            refresh_control = modify_panel.controls.itemById('refreshHeightCommand')
            if refresh_control:
                refresh_control.deleteMe()

        global handlers
        handlers = []
    except Exception as e:
        ui.messageBox(f'Virhe stop-funktiossa: {str(e)}')&lt;/LI-CODE&gt;&lt;P&gt;I made this partly by help of ChatGPT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Screenshot what kind of parameter model I have to update height and text on top surface of it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="juha2008_0-1729620233489.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1424624i19788F2E4011636D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="juha2008_0-1729620233489.png" alt="juha2008_0-1729620233489.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get it all english, here is same code translated by ChatGPT (I cannot validate whether this is working or not, upper one is working for sure).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
import adsk.core, adsk.fusion

app = adsk.core.Application.get()
ui = app.userInterface
handlers = []

# Functions to increase and decrease the parameter value and update the text
def change_height_param(increment):
    try:
        design = app.activeProduct
        if not design:
            ui.messageBox('No active design')
            return

        userParams = design.userParameters
        heightParam = userParams.itemByName('HeightQ')

        if heightParam:
            new_value = heightParam.value + (increment / 10)  # Change in centimeters
            heightParam.value = new_value
            update_text_with_height_param()  # Update the sketch text
        else:
            ui.messageBox('Parameter HeightQ not found')
    except Exception as e:
        ui.messageBox(f'Error changing parameter: {str(e)}')

# Text update function (same as before)
def update_text_with_height_param():
    try:
        design = app.activeProduct
        if not design:
            ui.messageBox('No active design')
            return

        rootComp = design.rootComponent
        if not rootComp:
            ui.messageBox('No component available')
            return

        sketches = rootComp.sketches
        for sketch in sketches:
            if sketch.name == 'HeightText':
                userParams = design.userParameters
                heightParam = userParams.itemByName('HeightQ')

                if heightParam:
                    heightValue = int(heightParam.value * 10)  # Convert from centimeters to millimeters
                    sketchTexts = sketch.sketchTexts
                    if sketchTexts.count &amp;gt; 0:
                        textElement = sketchTexts.item(0)
                        textElement.text = str(heightValue) + ' mm'
                    else:
                        ui.messageBox('No text elements in the sketch')
                else:
                    ui.messageBox('Parameter HeightQ not found')
    except Exception as e:
        ui.messageBox(f'Error updating text: {str(e)}')

# Handlers for different commands without ID references
class IncreaseCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
            command = eventArgs.command
            onExecute = IncreaseCommandExecuteHandler()
            command.execute.add(onExecute)
            handlers.append(onExecute)
        except Exception as e:
            ui.messageBox(f'Error creating Increase command: {str(e)}')

class IncreaseCommandExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            change_height_param(5)  # Increase by 5 mm
        except Exception as e:
            ui.messageBox(f'Error executing Increase command: {str(e)}')

class DecreaseCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
            command = eventArgs.command
            onExecute = DecreaseCommandExecuteHandler()
            command.execute.add(onExecute)
            handlers.append(onExecute)
        except Exception as e:
            ui.messageBox(f'Error creating Decrease command: {str(e)}')

class DecreaseCommandExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            change_height_param(-5)  # Decrease by 5 mm
        except Exception as e:
            ui.messageBox(f'Error executing Decrease command: {str(e)}')

class RefreshCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            eventArgs = adsk.core.CommandCreatedEventArgs.cast(args)
            command = eventArgs.command
            onExecute = RefreshCommandExecuteHandler()
            command.execute.add(onExecute)
            handlers.append(onExecute)
        except Exception as e:
            ui.messageBox(f'Error creating Refresh command: {str(e)}')

class RefreshCommandExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args):
        try:
            update_text_with_height_param()  # Update the text element in the sketch
        except Exception as e:
            ui.messageBox(f'Error executing Refresh command: {str(e)}')

# Command creation
def create_adjustment_buttons():
    try:
        # Determine Add-In directory and form the correct path for icons
        addin_path = os.path.dirname(os.path.realpath(__file__))
        resources_path = os.path.join(addin_path, 'Resources')

        # Add Increase button
        increase_button = ui.commandDefinitions.itemById('increaseHeightCommand')
        if not increase_button:
            increase_button = ui.commandDefinitions.addButtonDefinition(
                'increaseHeightCommand', 'Increase Height', 'Increase Height parameter by 5 mm',
                os.path.join(resources_path, 'Plus')
            )

        # Add Decrease button
        decrease_button = ui.commandDefinitions.itemById('decreaseHeightCommand')
        if not decrease_button:
            decrease_button = ui.commandDefinitions.addButtonDefinition(
                'decreaseHeightCommand', 'Decrease Height', 'Decrease Height parameter by 5 mm',
                os.path.join(resources_path, 'Minus')
            )

        # Add Refresh button
        refresh_button = ui.commandDefinitions.itemById('refreshHeightCommand')
        if not refresh_button:
            refresh_button = ui.commandDefinitions.addButtonDefinition(
                'refreshHeightCommand', 'Refresh', 'Update text element based on parameter',
                os.path.join(resources_path, 'Refresh')
            )

        # Register Increase command
        onIncreaseCreated = IncreaseCommandCreatedHandler()
        increase_button.commandCreated.add(onIncreaseCreated)
        handlers.append(onIncreaseCreated)

        # Register Decrease command
        onDecreaseCreated = DecreaseCommandCreatedHandler()
        decrease_button.commandCreated.add(onDecreaseCreated)
        handlers.append(onDecreaseCreated)

        # Register Refresh command
        onRefreshCreated = RefreshCommandCreatedHandler()
        refresh_button.commandCreated.add(onRefreshCreated)
        handlers.append(onRefreshCreated)

        # Add buttons to the Modify panel and promote them
        workspace = ui.workspaces.itemById('FusionSolidEnvironment')
        toolbar_tab = workspace.toolbarTabs.itemById('SolidTab')
        modify_panel = toolbar_tab.toolbarPanels.itemById('SolidModifyPanel')

        if modify_panel:
            increase_control = modify_panel.controls.itemById('increaseHeightCommand')
            if not increase_control:
                increase_control = modify_panel.controls.addCommand(increase_button)
            increase_control.isPromoted = True

            decrease_control = modify_panel.controls.itemById('decreaseHeightCommand')
            if not decrease_control:
                decrease_control = modify_panel.controls.addCommand(decrease_button)
            decrease_control.isPromoted = True

            refresh_control = modify_panel.controls.itemById('refreshHeightCommand')
            if not refresh_control:
                refresh_control = modify_panel.controls.addCommand(refresh_button)
            refresh_control.isPromoted = True

    except Exception as e:
        ui.messageBox(f'Error creating command: {str(e)}')

# Command start
def run(context):
    try:
        create_adjustment_buttons()  # Create Increase, Decrease, and Refresh buttons in the UI
    except Exception as e:
        ui.messageBox(f'Error in run function: {str(e)}')

# Command stop
def stop(context):
    try:
        # Remove all commands and event handlers
        cmd_definitions = ui.commandDefinitions

        # Remove Increase button
        increase_button = cmd_definitions.itemById('increaseHeightCommand')
        if increase_button:
            increase_button.deleteMe()

        # Remove Decrease button
        decrease_button = cmd_definitions.itemById('decreaseHeightCommand')
        if decrease_button:
            decrease_button.deleteMe()

        # Remove Refresh button
        refresh_button = cmd_definitions.itemById('refreshHeightCommand')
        if refresh_button:
            refresh_button.deleteMe()

        workspace = ui.workspaces.itemById('FusionSolidEnvironment')
        toolbar_tab = workspace.toolbarTabs.itemById('SolidTab')
        modify_panel = toolbar_tab.toolbarPanels.itemById('SolidModifyPanel')

        if modify_panel:
            increase_control = modify_panel.controls.itemById('increaseHeightCommand')
            if increase_control:
                increase_control.deleteMe()

            decrease_control = modify_panel.controls.itemById('decreaseHeightCommand')
            if decrease_control:
                decrease_control.deleteMe()

            refresh_control = modify_panel.controls.itemById('refreshHeightCommand')
            if refresh_control:
                refresh_control.deleteMe()

        global handlers
        handlers = []
    except Exception as e:
        ui.messageBox(f'Error in stop function: {str(e)}')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 18:15:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101207#M1616</guid>
      <dc:creator>juha2008</dc:creator>
      <dc:date>2024-10-22T18:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101226#M1617</link>
      <description>&lt;P&gt;Buttons on the Toolbar:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="juha2008_0-1729621011177.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1424630iF1FA55C687087113/image-size/medium?v=v2&amp;amp;px=400" role="button" title="juha2008_0-1729621011177.png" alt="juha2008_0-1729621011177.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resources folder structure and files (Command folder were just testing):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="juha2008_1-1729621137676.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1424631iB3E3AF9F996B22AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="juha2008_1-1729621137676.png" alt="juha2008_1-1729621137676.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Also 16x16-normal.png files is also extra and they are not... Well.. After quick double check. They are used in dropdown toolbar apparently. So those I need to update for better look:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="juha2008_2-1729621287858.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1424632i54CA2648E3CD654D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="juha2008_2-1729621287858.png" alt="juha2008_2-1729621287858.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 18:21:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101226#M1617</guid>
      <dc:creator>juha2008</dc:creator>
      <dc:date>2024-10-22T18:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: How add a button in the Fusion 360 "navigation toolbar"</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101427#M1618</link>
      <description>&lt;P&gt;for example, i used chatgpt to create a button,&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; adsk.core, adsk.fusion, traceback&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;app &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; adsk.core.Application.get()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ui &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; app.userInterface&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;context&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Activate the CAM (Manufacture) workspace&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; workspaces &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.workspaces&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; manufacture_workspace &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; workspaces.itemById(&lt;/SPAN&gt;&lt;SPAN&gt;'CAMEnvironment'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; manufacture_workspace.activate()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Create a command definition for the button&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd_def &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.commandDefinitions.addButtonDefinition(&lt;/SPAN&gt;&lt;SPAN&gt;'MyCAMToolButton'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Run CAM Tool'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'This button runs my custom CAM tool.'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Define the custom action that will run when the button is clicked&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; on_command_created &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; MyCommandCreatedHandler()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd_def.commandCreated.add(on_command_created)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; handlers.append(on_command_created)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Add the button to the CAMJobPanel&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cam_job_panel &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.allToolbarPanels.itemById(&lt;/SPAN&gt;&lt;SPAN&gt;'CAMJobPanel'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; cam_job_panel:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cam_job_panel.controls.addCommand(cmd_def)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;'Button added to CAMJobPanel!'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ui:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;'Failed:&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;{}&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;.format(traceback.format_exc()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;stop&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;context&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Clean up the UI elements when the add-in is stopped&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd_def &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.commandDefinitions.itemById(&lt;/SPAN&gt;&lt;SPAN&gt;'MyCAMToolButton'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; cmd_def:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd_def.deleteMe()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Remove the button from the CAMJobPanel&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cam_job_panel &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; ui.allToolbarPanels.itemById(&lt;/SPAN&gt;&lt;SPAN&gt;'CAMJobPanel'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; cam_job_panel:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cntrl &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; cam_job_panel.controls.itemById(&lt;/SPAN&gt;&lt;SPAN&gt;'MyCAMToolButton'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; cntrl:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cntrl.deleteMe()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ui:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;'Failed:&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;{}&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;.format(traceback.format_exc()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;class&lt;/SPAN&gt; &lt;SPAN&gt;MyCommandCreatedHandler&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;core&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CommandCreatedEventHandler&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;__init__&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;super&lt;/SPAN&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;__init__&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;notify&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;args&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# Run your custom script or function here&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;'Custom CAM script is running!'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# You can include your actual CAM tool script or logic here&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;# For example, accessing toolpath data, generating G-code, etc.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ui:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;'Command execution failed:&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;{}&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;.format(traceback.format_exc()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# Event handlers array to prevent garbage collection&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;handlers &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; []&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but everytime i try to add the script, dont work, how can i add a script inside the button?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 22 Oct 2024 20:11:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-add-a-button-in-the-fusion-360-quot-navigation-toolbar-quot/m-p/13101427#M1618</guid>
      <dc:creator>nubrandao</dc:creator>
      <dc:date>2024-10-22T20:11:47Z</dc:date>
    </item>
  </channel>
</rss>

