Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Bug Report: arguments in MarkingMenuEventHandler are missing (NoneType) for sub components

OceanHydroAU
Collaborator

Bug Report: arguments in MarkingMenuEventHandler are missing (NoneType) for sub components

OceanHydroAU
Collaborator
Collaborator

This is a followup to my post in the other forum:  https://forums.autodesk.com/t5/fusion-api-and-scripts/bug-report-how-to-select-which-right-click-lin...

 

When users right-click on elements in the browser (e.g. on the "Bodies" of the root component), our MarkingMenuHandler receives a callback with an argument indicating what they right-clicked on (e.g. adsk::fusion::BRepBodies )

 

This works fine for the root component in the browser, however, for all submenus of any additional components in the browser, our MarkingMenuHandler receives a callback with only a single "NoneType" argument and no way to determine what the user right-clicked on.  (which might be "Bodies" or "Sketches" or "Flat Pattern" or "Origin" or "Construction" etc - always "NoneType" for those.)

 

You can reproduce and observe the bug with this sample code:-

 

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-c90ce6a2-c282-11e6-a365-3417ebc87622

 

find this line in the above:

setLinearMarkingMenu(args)

and insert this code after it:

 

try:
    if args.selectedEntities.size:
        print(args.selectedEntities.front().__class__.__name__)
except:
    pass

 

 

then create a new design, create a body inside that design, create a new component in the design, and create a body inside this new component, and the right-click on both of the "Bodies" items in the browser menu to see the bug on the second one

 

You will see this working:

pic_2024-04-02_16.04.46_409.png

says: adsk::fusion::BRepBodies

 

And this not working:-

pic_2024-04-02_16.05.16_410.png

says: NoneType

 

I hope you like my bug report!  Good luck!

 

0 Likes
Reply
197 Views
1 Reply
Reply (1)

OceanHydroAU
Collaborator
Collaborator

Additional information (possibly the same bug) - the selected entity is not exposed to the commands either for sub components only (root is OK)

 

Running the commands we added to the right-click menu result in adsk.core.Application.get().userInterface.activeSelections.entity being "None" (for subcomponents - the top-level root components work OK)

 

example code:-

 

        class CommandCreatedEventHandlerPanel(adsk.core.CommandCreatedEventHandler):
            def __init__(self, pnlid):
                super().__init__() 
            def notify(self, args):
                try:
                    app = adsk.core.Application.get()
                    ui = app.userInterface
                    print(ui.activeSelections[0].activeSelections.entity.objectType) # works for root, is None for components

 

0 Likes