Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone.
We wanted to get the active user name, so we created a test code like this.
# Fusion360API Python script
import adsk.core, adsk.fusion, traceback
def run(context):
ui :adsk.core.UserInterface = None
try:
app :adsk.core.Application = adsk.core.Application.get()
ui = app.userInterface
user = app.currentUser
info = [
f'displayName : {user.displayName}',
f'userName :{user.userName}',
f'userId :{user.userId}',
f'email :{user.email}',
]
ui.messageBox('\n'.join(info))
except:
if ui:
print('Failed:\n{}'.format(traceback.format_exc()))
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Looking at the description of the displayName property, I thought I could get it with displayName.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-2CD5E1DC-A891-4893-AFC0-17224F2B765B
The result is shown in the upper left of the image.
What is retrieved by displayName is the user name displayed in "My Profile".
Does anyone know how to get the user name displayed in the Fusion360 user interface?
Thank you in advance.
Solved! Go to Solution.