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: 

Bugs in controls.addSeparator method (ToolbarPanel object)

1 REPLY 1
SOLVED
Reply
Message 1 of 2
JeromeBriot
271 Views, 1 Reply

Bugs in controls.addSeparator method (ToolbarPanel object)

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'

 

1 REPLY 1
Message 2 of 2
ekinsb
in reply to: JeromeBriot

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

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report