SelectEntity Causes Fusion to Crash

SelectEntity Causes Fusion to Crash

Anonymous
Not applicable
1,100 Views
3 Replies
Message 1 of 4

SelectEntity Causes Fusion to Crash

Anonymous
Not applicable

After the most recent update (Aug 5th) I am now having issues around the ui.selectEntity function in my plugin. I have been able to repeat a few strange behaviors by using a "blank" command that uses just the following. 

 

If I use this arrangement inside of a try statement I get the message box looping. Even when running through debugging it will just strait from the message box to the select entity (but not prompt a selection) and the right back to the message box. 

app = adsk.core.Application.get()
ui = app.userInterface
ui.messageBox('This is a test box')
testPoint = ui.selectEntity('Select point', 'Vertices')

 

If I try it with the message box comment out I can select my entity (still no prompt) but when I select something (I used just a point on a test box shape) it throws this error and causes fusion to crash when I click ok. 

app = adsk.core.Application.get()
ui = app.userInterface
#ui.messageBox('This is a test box')
testPoint = ui.selectEntity('Select point', 'Vertices')

Screen Shot 2020-08-05 at 9.55.50 AM.png

I know there were some additions in this most recent update (the activeSelectionEvent) and I am wondering if this had anything to do with this since I wasn't having this issue yesterday

0 Likes
Accepted solutions (1)
1,101 Views
3 Replies
Replies (3)
Message 2 of 4

BrianEkins
Mentor
Mentor

I'm not able to reproduce your problem with the latest update.  Here's my entire script that I used to test it.  Does this work for you?  If not, can you think of anything that might be different with your machine?

 

 

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        vertSel = ui.selectEntity('Select a vertex', 'Vertices')
        if vertSel:
            vert = adsk.fusion.BRepVertex.cast(vertSel.entity)
            pnt = vert.geometry
            ui.messageBox('Selected vertex at {}, {}, {}'.format(pnt.x, pnt.y, pnt.z))
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 3 of 4

Anonymous
Not applicable

Brian,

 

I'll give that a shot, but to clarify (I now realize I didn't include this in the original post) but I was only having this problem with a plugin. I tried to recreate it with just a test script and it worked just fine. But if I created a template command item and then added those lines of code the the response to that item then I got the error. But nothing has changed with my machine since yesterday when things were working besides the fusion update. 

 

I'll mess the code you posted and will see if that helps. 

 

EDIT:

Just tested that code and same behavior. If I run it as a stand alone script it works great. But if I run it as a command from a plugin it gives me the same error message as shown above.

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

Sorry for not closing this out earlier. I was able to find a work around for this, which I suspect is the proper way to have users select entities using a command box rather than an unprompted user selection.