Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SelectEntity Causes Fusion to Crash

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Duracellman425
353 Views, 3 Replies

SelectEntity Causes Fusion to Crash

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

Tags (3)
Labels (2)
3 REPLIES 3
Message 2 of 4
BrianEkins
in reply to: Duracellman425

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
Message 3 of 4
Duracellman425
in reply to: BrianEkins

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.

Message 4 of 4

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. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report