Hi @2544173825 .
I think tempId is outdated and entityToken should be used now.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-D9458206-A7FA-4371-94BA-636FE58F225C
The following sample shows an entityToken when a face or edge is selected.
# Fusion360API Python script
import traceback
import adsk.fusion
import adsk.core
def run(context):
ui = adsk.core.UserInterface.cast(None)
try:
app: adsk.core.Application = adsk.core.Application.get()
ui = app.userInterface
des: adsk.fusion.Design = app.activeProduct
msg: str = 'Select Face or Edge'
selFilter: str = 'Faces,Edges'
sel: adsk.core.Selection = selectEnt(msg, selFilter)
if not sel:
return
selectEntity = sel.entity
msgList = []
selectEntity_token = selectEntity.entityToken
msgList.append(f'EntityToken:{selectEntity_token}\n')
msgList.append(f'SelectEntity Type:{selectEntity.classType()}\n')
findEntities = des.findEntityByToken(selectEntity_token)
if len(findEntities) > 0:
msgList.append(f'FindEntity Type:{findEntities[0].classType()}\n')
ui.messageBox('\n'.join(msgList))
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def selectEnt(
msg: str,
filterStr: str) -> adsk.core.Selection:
try:
app: adsk.core.Application = adsk.core.Application.get()
ui: adsk.core.UserInterface = app.userInterface
sel = ui.selectEntity(msg, filterStr)
return sel
except:
return None
I haven't looked into it in detail, but moving the timeline marker should not change the entityToken for elements that are basically unchanged.
However, I am also having trouble understanding the rules by which the entityToken is changed.