<?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: Bug Report? - How to select which right-click linearMarkingMenu context menus to add my Add-in command into ? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12681038#M1719</link>
    <description>&lt;P&gt;See also my bug report in the correct forum which has more details (same bug affects commands as well as menu creation):&amp;nbsp;&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-support/bug-report-arguments-in-markingmenueventhandler-are-missing/td-p/12680383" target="_blank"&gt;https://forums.autodesk.com/t5/fusion-support/bug-report-arguments-in-markingmenueventhandler-are-missing/td-p/12680383&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2024 11:15:09 GMT</pubDate>
    <dc:creator>OceanHydroAU</dc:creator>
    <dc:date>2024-04-02T11:15:09Z</dc:date>
    <item>
      <title>Bug Report? - How to select which right-click linearMarkingMenu context menus to add my Add-in command into ?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12677771#M1718</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;The "Bodies" and "Sketches" control-containers which appear inside components (other than the root one) inside the Browser are not populating the "args" in the&amp;nbsp;MarkingMenuEventHandler&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I've written an add-in with a "nesting" command (for laying out parts to CNC/laser cut) which makes sense to invoke when the user right-clicks on assorted different things, including:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;The root component in the browser (&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;adsk::fusion::Component )&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;DIV&gt;&lt;SPAN&gt;The "bodies" root entry inside the browser root ( &lt;/SPAN&gt;&lt;SPAN&gt;adsk::fusion::BRepBodies&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;The "sketches" root entry inside a component (&amp;nbsp;adsk::fusion::Sketches&amp;nbsp;)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;A sub component in the browser (&amp;nbsp;adsk::fusion::Occurrence&amp;nbsp;)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;STRONG&gt;The "bodies" root entry inside a component ( NoneType )&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;The "sketches" root entry inside a component ( NoneType )&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;An actual body or face in the browser [or the body/face&amp;nbsp; itself] ( adsk::fusion::BRepBody /&amp;nbsp;adsk::fusion::BRepFace&amp;nbsp;)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;The root in a flatpattern (&amp;nbsp;adsk::fusion::FlatPatternComponent ) or the "bodies" entry inside it (&amp;nbsp;BRepBodies - adsk::fusion::BRepBodies ) or a body in that&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Any sketch profile (&amp;nbsp;adsk::fusion::Profile )&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The point of the right-click is to give them rapid access (preselect + preview) to lay out copies of the shape(s) they've indicated &lt;EM&gt;by&lt;/EM&gt; the right-click.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a workaround to identify the "NoneType" browser elements I've highlighted above which they've clicked on and what bodies/profiles they're wanting to nest from there?&amp;nbsp; Can I "work backwards" from the "NoneType" passed in to me to find the component they clicked in?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code so far (simply prints out what they right-clicked on, to help me work out how to identify the context):-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        class MyMarkingMenuHandler(adsk.core.MarkingMenuEventHandler):
            global uiel, handlers, userdata
            def __init__(self, pnlid):
                super().__init__()
                self.pnlid=pnlid 
            def notify(self, args):
                try:

                    if 1:
                        if args.selectedEntities.size:
                            myt=args.selectedEntities.front().__class__.__name__
                        if myt != 'NoneType':
                            try:
                                t=args.selectedEntities.front()
                                myt = f"{myt} - {t.classType()}"
                                myt = f"{myt} '{getattr(t,'name')}'"
                                myt = f"{myt} 'id={getattr(t,'id')}'"
                            except: pass
                            try:
                                myt = f"{myt}: {args.front()._get_name()}"
                            except: pass
                        elif getattr(args,'linearMarkingMenu'):
                            try:
                                mnu=args.linearMarkingMenu
                                ctrl=mnu.controls
                                for m in ctrl:
                                    if m.isVisible:
                                        eprint(f"\t{m.id}")
                            except: pass

                        eprint(myt)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 23:29:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12677771#M1718</guid>
      <dc:creator>OceanHydroAU</dc:creator>
      <dc:date>2024-03-31T23:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report? - How to select which right-click linearMarkingMenu context menus to add my Add-in command into ?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12681038#M1719</link>
      <description>&lt;P&gt;See also my bug report in the correct forum which has more details (same bug affects commands as well as menu creation):&amp;nbsp;&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-support/bug-report-arguments-in-markingmenueventhandler-are-missing/td-p/12680383" target="_blank"&gt;https://forums.autodesk.com/t5/fusion-support/bug-report-arguments-in-markingmenueventhandler-are-missing/td-p/12680383&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 11:15:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12681038#M1719</guid>
      <dc:creator>OceanHydroAU</dc:creator>
      <dc:date>2024-04-02T11:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report? - How to select which right-click linearMarkingMenu context menus to add my Add-in command into ?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12681762#M1720</link>
      <description>&lt;P&gt;When NoneType is returned, in this case, something is selected for which the API doesn't have an object that represents the selection. What's selected only exists in the browser as a convenience to group a set of entities. The API will need to expose some kind of browser-related functionality before something useful can be returned. Right now, I can't think of a feasible workaround.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 16:41:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12681762#M1720</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2024-04-02T16:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report? - How to select which right-click linearMarkingMenu context menus to add my Add-in command into ?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12685368#M1721</link>
      <description>&lt;P&gt;The closest I could get to a "workaround" was to look through the entries within the menu they've clicked on, to guess what kind of thing it was.&amp;nbsp; Kindof works, but if there's 2+ components in the design, you still can't find *which* of those components the click happened on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also experimented with&amp;nbsp;SelectionCommandInput - this works fine for individual things (Bodies, sketch profiles, etc):-&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic_2024-04-04_09.19.40_429.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1345466iD6AEEB06510B5F74/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic_2024-04-04_09.19.40_429.png" alt="pic_2024-04-04_09.19.40_429.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and happily lets me know what they clicked on&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic_2024-04-04_09.13.31_428.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1345467iC2B276C744DC8112/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic_2024-04-04_09.13.31_428.png" alt="pic_2024-04-04_09.13.31_428.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but frustratingly, even with every possible criteria enabled (&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-03033DE6-AD8E-46B3-B4E6-DADA8D389E4E" target="_blank" rel="noopener"&gt;*all* of these&lt;/A&gt;), while it lets me click on what I want:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic_2024-04-04_09.21.06_430.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1345469i461D59D3373DA37B/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic_2024-04-04_09.21.06_430.png" alt="pic_2024-04-04_09.21.06_430.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and tricks me into thinking that worked:-&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic_2024-04-04_09.21.42_431.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1345470i86D0BE6DD57CD64B/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic_2024-04-04_09.21.42_431.png" alt="pic_2024-04-04_09.21.42_431.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in reality, it only gives me the design root component (if "RootComponents" was in my selection criteria, otherwise I get the component's Occurrence with "Occurrences" my criteria) every time:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic_2024-04-04_09.27.05_433.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1345473i9036D5AB76D0D9E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pic_2024-04-04_09.27.05_433.png" alt="pic_2024-04-04_09.27.05_433.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic_2024-04-04_09.22.21_432.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1345472iCDDF4FF454EC62AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic_2024-04-04_09.22.21_432.png" alt="pic_2024-04-04_09.22.21_432.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Neither of which was the group of bodies I clicked on and wanted to select all-at-once (and without&amp;nbsp; 'RootComponents' /'Occurrences' selectable, nothing in the browser can be selected)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh well... could be worse... at least users can shift-click on things to manually select them all I suppose...&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 23:34:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-report-how-to-select-which-right-click-linearmarkingmenu/m-p/12685368#M1721</guid>
      <dc:creator>OceanHydroAU</dc:creator>
      <dc:date>2024-04-03T23:34:38Z</dc:date>
    </item>
  </channel>
</rss>

