Bugs in controls.addSeparator method (ToolbarPanel object)

JeromeBriot
Mentor Mentor
410 Views
1 Reply
Message 1 of 2

Bugs in controls.addSeparator method (ToolbarPanel object)

JeromeBriot
Mentor
Mentor

Hello,

import adsk.core, adsk.fusion, adsk.cam, traceback

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

        panel = ui.allToolbarPanels.itemById('SolidCreatePanel')
        
        separator_one = panel.controls.addSeparator('a_unique_id', 'PrimitivePipe', True)
        print(separator_one.id)
        
        separator_two = panel.controls.addSeparator('another_unique_id', 'PrimitivePipe', False)
        print(separator_two.id)


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


            
The code should add two separators next to the "Pipe" entry under the "Create" menu, but fails on two points.

1) The second separator is not created because there is already another separator below the "Pipe" entry.

2) The specified ids are not set correctly as the print statement returns (for example) 5d2cae42-c725-4269-b82e-b60c31d4ba50 and 83f39f92-0ef6-4afb-999a-2f9369402684 instead of 'a_unique_id' and 'another_unique_id'

 

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

ekinsb
Alumni
Alumni
Accepted solution

Thanks for reporting this.  I am able to reproduce the problem with the ID and have logged a bug.  However, for the other problem of it not being created because there's already one there, it is being created but apparently if there's nothing in between them, separators display on top of each other.  So there are actually two there but you just can't tell.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
1 Like