Persistent (across sessions) object ids

Persistent (across sessions) object ids

quality5B59E
Contributor Contributor
1,682 Views
4 Replies
Message 1 of 5

Persistent (across sessions) object ids

quality5B59E
Contributor
Contributor

In my addin I would like the user to be able to select curves, points etc and then the addin creates a little program.  I would then like to save the program into a file (or preferably into the fusion document itself as an attribute perhaps).

 

The main problem is that I need some sort of identifier associated with the selected entities that persists across sessions.  When the file is opened again in the future and the addin starts up, I would like to recreate the program and to do so I need to find the entities the user selected previously.

 

There does not seem to be a way to name SketchCurves so I can find them again and there does not seem to be a persistent uniqueID I could use instead?

 

One great method might be to change Fusion so that *all* attributes (even those associated with entities) get saved to the fusion document and recreated when the document is opened again.  It would be easy then to search through the design and entity attributes and recreate my program!  

 

Addins could save their configurations to design level attributes too ...

 

Persistent unique IDs would do the job too albeit with less kewl factor?  Maybe the Base class has a uniqueID property that is persistent across sessions?

 

Thanks!

0 Likes
Accepted solutions (1)
1,683 Views
4 Replies
Replies (4)
Message 2 of 5

BrianEkins
Mentor
Mentor

What you can do today is to add an attribute to the entity you want to find later.  You're essentially using attributes as a way to name an entity.  Attributes also have the advantage that you can query for them instead of having to search every entity to see if it has an attribute you're looking for.

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

quality5B59E
Contributor
Contributor

Do attributes get saved into the fusion document across sessions?  In otherwords, if I save my design and exit from fusion and another day start fusion again and open the document, the attributes are still there?

 

If so, that’s great!  The doc doesn’t mention that they persist!

 Thanks!

0 Likes
Message 4 of 5

BrianEkins
Mentor
Mentor
Accepted solution

Yes, they certainly persist.  They would be fairly useless otherwise. 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 5 of 5

quality5B59E
Contributor
Contributor

Great! Thanks!

0 Likes