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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can the Fusion 360 API create a fixed ID for each edge and face?

Message 1 of 5
203 Views, 4 Replies

Can the Fusion 360 API create a fixed ID for each edge and face?

The face.tempId of the Fusion 360 API allows to go past the Id of a BRep entity, but this Id seems to be affected by the traversal method. To be precise this tempId is more like a order number to get the tempId. For example, for the same part, I get the tempId of an edge first, edge_Id = edge.tempId, at this time id=0 is an edge, but for the same geometry, if I get the tempId of a face first next time, face_Id = face.tempId, at this time id=0 is a face. Is there a way so that I can set (get) the Id of each face (edge) entity, and the acquired face (edge) entity Id is fixed regardless of the method used to parse the geometry.

Message 2 of 5
in reply to: 2544173825

Hi @2544173825 .


I think tempId is outdated and entityToken should be used now. 


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)
        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:

        selectEntity = sel.entity

        msgList = []
        selectEntity_token = selectEntity.entityToken

        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')

        if ui:

def selectEnt(
        msg: str,
        filterStr: str) -> adsk.core.Selection:

        app: adsk.core.Application = adsk.core.Application.get()
        ui: adsk.core.UserInterface = app.userInterface
        sel = ui.selectEntity(msg, filterStr)
        return sel
        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.

Message 3 of 5
in reply to: kandennti

Thanks for your prompt reply, I'll go try what you said!

Message 4 of 5
in reply to: 2544173825

Entity tokens and temp ID's are both valid ways of uniquely identifying a B-Rep entity but they each have their own advantages and disadvantages and one is typically more appropriate than the other for a specific use case. The more generally useful of the two is entity tokens because they will continue to work across sessions and when the model changes. The downside of entity tokens is they are expensive for Fusion to generate and they are much larger to store. Internally, a token is much more than a simple ID. It's more accurate to think of it as a description of how to find a particular entity. Tokens are also supported by almost everything that is saved.


The big advantage of temp ID's is that they are fast and small. Their disadvantages are that they are only supported by B-Rep objects and their lifetime is as long as the body remains unchanged in any way. There are probably a lot of unique uses for temp ID's but the one I'm more familiar with is for an internal Autodesk project. In this case, the body is exported as an SMT file and read into another system. The temp ID's are carried with the SMT file and provide a way to do geometry matching between the two models to transfer additional information. Remember, these ID's only work as long as the model is not changed, so it's not a long-term connection but is only used during the initial transfer.



Brian Ekins
Inventor and Fusion 360 API Expert
Message 5 of 5
in reply to: BrianEkins


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