how to select teams hub from python API

how to select teams hub from python API

MortenGuldager
Participant Participant
690 Views
3 Replies
Message 1 of 4

how to select teams hub from python API

MortenGuldager
Participant
Participant

I am making a script that will traverse all my designs across all team hubs. Open them one by one and do various operations. (I am on two teams and then have a bunch of personal files as well)

I'm having trouble opening designs on another team hub than the one currently the active one.

 

Python throws this at me:

RuntimeError: 3 : Design is located in another team.
You may not be able to save changes you make to this design.

 

I can catch this fine but while the design actually loaded I cant do anything with it since I didn't get the document handle.

Questions:

  • Can I  switch active teams hub using the python API?
  • Other ways around this?
0 Likes
Accepted solutions (1)
691 Views
3 Replies
Replies (3)
Message 2 of 4

BrianEkins
Mentor
Mentor

The API doesn't support activating a hub and you can only work with the contents of a hub in Fusion when that hub is active.  I'm not aware of any workaround.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 4

MortenGuldager
Participant
Participant

Hmm, ok. Is there any API way to tell which hub is actively selected?
hen I can work my way around by instructing the user to do the switch manually if needed.

 

/mogul

0 Likes
Message 4 of 4

kandennti
Mentor
Mentor
Accepted solution

Hi @MortenGuldager .

 

Displays the current team name.

import traceback
import adsk.fusion
import adsk.core

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

        ui.messageBox(f'Team Name:{app.data.activeHub.name}')
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

Displays the current team name. 

0 Likes