Toolbars - NEW UI

Toolbars - NEW UI

MichaelT_123
Advisor Advisor
1,128 Views
4 Replies
Message 1 of 5

Toolbars - NEW UI

MichaelT_123
Advisor
Advisor

Hi TF360,

 

I tried recently to use some Addin(s) I have written in the ERA of OLD interface.

To no avail…

I have searched (only) a little bit through the code, but I could not find the problem.

The next move was to look at F360 documentation, particularly related to the recent change of UI (toolbars).

I have found the relaxing statement there:

Although the commands are organized differently, the commands themselves are not changed by the toolbar update

The following step was to run F360 supplied script allowing to spool the entire user interface command set.

 (http://help.autodesk.com/cloudhelp/ENU/Fusion-360-API/files/WriteUserInterfaceToFile_Sample.htm)

It has produced this result:

#---------------------------------------------------------------------------------------------------

Failed:

Traceback (most recent call last):

  File "D:/Fusion360/API/Scripts/SpoolControls/SpoolControls.py", line 50, in run

    msg = '   ' + workspace.id + ' (' + str(workspace.toolbarPanels.count) + ')____\n'

  File "…/Autodesk/webdeploy/production/…dd09c95/Api/Python/packages\adsk\core.py", line 13624, in _get_count

    return _core.ToolbarPanels__get_count(self)

RuntimeError: 2 : InternalValidationError : tb

The above exception was the direct cause of the following exception:

SystemError: <built-in function delete_Workspaces> returned a result with an error set

#---------------------------------------------------------------------------------------------------

Could you please check/clarify the problem?

Are there any changes/refinements necessary to OLD ADDIN SCRIPTS?

 

Regards

MichaelT

 

MichaelT
0 Likes
Accepted solutions (2)
1,129 Views
4 Replies
Replies (4)
Message 2 of 5

kandennti
Mentor
Mentor
Accepted solution

Hi MichaelT_123.

 

・・・
        result += '\n\n** Workspaces  (' + str(ui.workspaces.count) + ')____\n'
        for workspace in ui.workspaces:
            if workspace.productType == '':
                continue
            try:
                msg = '   ' + workspace.id + ' (' + str(workspace.toolbarPanels.count) + ')____\n'
                result += msg
                for panel in workspace.toolbarPanels:
                    msg = '      ' + panel.id + '\n'
                    result += msg
            except:
                pass
・・・
Message 3 of 5

MichaelT_123
Advisor
Advisor

Hi Kandennti-san,

 

<try: - except:> is a brutal trick... but it works ... most of the time :).

 

So, it seems that newly introduced  workspace(s) code is missing some classes, doesn't it?

I hope that it would be quite easy to patch the gap to make the statement :

Although the commands are organized differently, the commands themselves are not changed by the toolbar update

once again truthful.

 

With Regards

MichaelT

 

 

MichaelT
Message 4 of 5

kandennti
Mentor
Mentor
Accepted solution
Excuse me. Last night I was sleepy and forgot the text.
The cause seems to be the NEST workspace.
2.png

It seems that the NEST workspace tool panel is only implemented. However,
it may not be available.(Not tried)

I tried using the len function instead of the count property.
・・・
        result += '\n\n** Workspaces  (' + str(ui.workspaces.count) + ')____\n'
        for workspace in ui.workspaces:
            if workspace.productType == '':
                continue
            msg = '   ' + workspace.id + ' (' + str(len(workspace.toolbarPanels)) + ')____\n'
            result += msg
            for panel in workspace.toolbarPanels:
                msg = '      ' + panel.id + '\n'
                result += msg
・・・
3.png
Message 5 of 5

MichaelT_123
Advisor
Advisor

Great analysis Kandennti-san,

 

... even Sherlock Holmes could not has done better!

 

With Regards

MichaelT

 

MichaelT
0 Likes