executeTextCommand errer

executeTextCommand errer

kandennti
Mentor Mentor
649 Views
3 Replies
Message 1 of 4

executeTextCommand errer

kandennti
Mentor
Mentor

Hi there.

 

I am very interested in the "Application.executeTextCommand" method implemented in Ver2.0.8335.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-4DA98A57-C8E0-479E-B2FF-EB3C10BAE13F 

 

I created a script like this to test a simple process.

#Fusion360API Python script

import adsk.core, adsk.fusion, traceback

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

        txtCmd = 'data.property'
        res = app.executeTextCommand(txtCmd)

        print(res)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

Unfortunately, doing so will result in an error.

1.png

If you actually enter the text command (txt), the result will be as follows.

2.png

 

Isn't there a sample for correct processing?

 

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

goyals
Autodesk
Autodesk
Accepted solution

I tried but not able to reproduced it. Not sure if this particular text command is making some network call which failed at the time you tried it through API which results in to failure of text command. Please try with some other text command and see if you are getting the same result. Thanks.



Shyam Goyal
Sr. Software Dev. Manager
Message 3 of 4

kandennti
Mentor
Mentor

Thank you @goyals .

 

If you change the language to English, you can execute without problems.
I strongly hope that it will work in Japanese as well.

 

I happened to be interested in the command text (txt) just before Ver2.0.8335 and tried various things.
I found out that command text is so powerful that you can do things that are not possible with the API.

 

 

Append.
This was fine in Japanese as well. It's unstable.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/get-if-a-user-is-using-a-paid-version-of-f... 

 

0 Likes
Message 4 of 4

kandennti
Mentor
Mentor

It was an encoding issue.
Even in Japanese, this method worked correctly.

txtCmd = u'data.property'

 

0 Likes