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: 

executeTextCommand errer

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
kandennti
376 Views, 3 Replies

executeTextCommand errer

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?

 

3 REPLIES 3
Message 2 of 4
goyals
in reply to: kandennti

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
in reply to: goyals

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... 

 

Message 4 of 4
kandennti
in reply to: kandennti

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

txtCmd = u'data.property'

 

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

Post to forums  

Autodesk Design & Make Report