Fusion crashes after TextCommand in command dialog's execute method

Fusion crashes after TextCommand in command dialog's execute method

0xHexdec
Contributor Contributor
382 Views
1 Reply
Message 1 of 2

Fusion crashes after TextCommand in command dialog's execute method

0xHexdec
Contributor
Contributor

Hey all,

I encountered a very strange bug: 

app.executeTextCommand('Commands.Start IntersectionCurve')

This innocent looking line of code crashes fusion every single time it is inside a command definition but works fine if it is outside of such.

 

It is easy to reproduce:

  • Create a new Python Add-In in Fusion, name it whatever you want
  • open the commands/commandDialog/entry.py file
  • choose a line you like, I used line 105, the "Your code here" comment in the command_execute method
  • paste the above command in there
  • run the Add-In
  • click the newly added Button next to the Add-Ins Button, click OK
  • Crash

If you, on the other hand, paste the following code into your <YourCreatedAddInName>.py instead of the run method, the code gets executed as expected.

 

def run(context):
    try:
        commands.start()
        # just to make app available here
        import adsk.core
        app = adsk.core.Application.get()
        # same line as above
        app.executeTextCommand('Commands.Start IntersectionCurve')
    except:
        futil.handle_error('run')

 

Am I missing something here? I can run other textCommands successfully, but not the "intersectionCurve" one.

Is there another option to run the textCommand outside the command dialog environment? more like a Script triggered by the command dialog?

 

Best regards,

Julian

0 Likes
Accepted solutions (1)
383 Views
1 Reply
Reply (1)
Message 2 of 2

0xHexdec
Contributor
Contributor
Accepted solution

Oh well, just seconds later I found this: creating-a-custom-command-dialog-then-running-a-text-command

So it seems like the question is answered...

0 Likes