<?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: Fusion 360 API Component priority in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12996050#M878</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This are the command IDs for the selection priorities:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;CommandControl name="Select Body Priority" id="SelectBodyPriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;
    &amp;lt;CommandControl name="Select Face Priority" id="SelectFacePriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;
    &amp;lt;CommandControl name="Select Edge Priority" id="SelectEdgePriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;
    &amp;lt;CommandControl name="Select Component Priority" id="SelectComponentPriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use its ID to toggle its selection, either with&amp;nbsp;&lt;EM&gt;CommandDefinition.execute()&lt;/EM&gt;&amp;nbsp; or with a text command like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Commands.Start SelectComponentPriorityCommand&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Sep 2024 15:26:11 GMT</pubDate>
    <dc:creator>Jorge_Jaramillo</dc:creator>
    <dc:date>2024-09-02T15:26:11Z</dc:date>
    <item>
      <title>Fusion 360 API Component priority</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12995899#M877</link>
      <description>&lt;P&gt;Hello All,&lt;BR /&gt;&lt;BR /&gt;Does someone by any chance know how to enable the select component priority, by using the API?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nmichiels_0-1725286401806.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1404777iC0A01B726B3A9CDE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nmichiels_0-1725286401806.png" alt="nmichiels_0-1725286401806.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Nick&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 14:14:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12995899#M877</guid>
      <dc:creator>n.michiels</dc:creator>
      <dc:date>2024-09-02T14:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fusion 360 API Component priority</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12996050#M878</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This are the command IDs for the selection priorities:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;CommandControl name="Select Body Priority" id="SelectBodyPriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;
    &amp;lt;CommandControl name="Select Face Priority" id="SelectFacePriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;
    &amp;lt;CommandControl name="Select Edge Priority" id="SelectEdgePriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;
    &amp;lt;CommandControl name="Select Component Priority" id="SelectComponentPriorityCommand" commandType="ButtonControlDefinition" isPromoted="False" /&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use its ID to toggle its selection, either with&amp;nbsp;&lt;EM&gt;CommandDefinition.execute()&lt;/EM&gt;&amp;nbsp; or with a text command like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Commands.Start SelectComponentPriorityCommand&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 15:26:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12996050#M878</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2024-09-02T15:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Fusion 360 API Component priority</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12996931#M879</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Sorry that I still not fully understand your example. I am still a beginner.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am using Python btw.&lt;BR /&gt;&lt;BR /&gt;regards.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 06:03:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12996931#M879</guid>
      <dc:creator>n.michiels</dc:creator>
      <dc:date>2024-09-03T06:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Fusion 360 API Component priority</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12996994#M880</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The XML extract that I sent you in the last message is how the Fusion UI Menus are defined; from there I extract the commands ID for the different selection priorities you find in the menu.&lt;/P&gt;&lt;P&gt;Then you can use that Command Definition Id to look for it and execute it (as you do when you create a command dialog where you first define a command definition and the execute it): I found two option to execute it. They are equivalent, so you can can choose any of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the source code with the two options:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import adsk, adsk.core, adsk.fusion, adsk.cam, traceback

app = adsk.core.Application.get()

def option_command_definition(cmdId : str) -&amp;gt; None:
    cmd_def = app.userInterface.commandDefinitions.itemById(cmdId)
    if cmd_def:
        cmd_def.execute()
        app.log(f'{cmdId} was toggled by CommandDefinition')
    else:
        app.log(f'Command definition "{cmdId}" not found!')

def option_text_command(cmdId: str) -&amp;gt; None:
    ret = app.executeTextCommand(f'Commands.Start {cmdId}')
    app.log(f'{cmdId} toggled by Text Command with result : {ret}')

def run(context) -&amp;gt; None:
    try:
        # Option 1 : by Command Definition
        option_command_definition("SelectComponentPriorityCommand")

        # Option 2 : by Text Command
        # option_text_command("SelectComponentPriorityCommand")
    except:
        app.log('Failed:\n{}'.format(traceback.format_exc()))
    adsk.terminate()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this can help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 06:36:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/fusion-360-api-component-priority/m-p/12996994#M880</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2024-09-03T06:36:31Z</dc:date>
    </item>
  </channel>
</rss>

