entityToken not unique in one design ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working on a script which is traversing all occurrences of the current design in order to save the current state. (isLightBulbOn and so one) I used Occurence.fullPathName to match my saved state and the current state in the past. Which didn't work well for that matter. So now I try to use entityToken to do this but stumbled upon an oddity when I used the script on one of my designs and found out that it is possible to have the same entityToken in one design.
Here is what I do:
1. Create a design (Let's call it TEST_ENTITY)
2. Save design AS (Let's save the copy to TEST_ENTITY_COPY)
3. Insert TEST_ENTITY_COPY as referenced component into TEST_ENTITY
4. Traverse all occurences and save entity tokens
Now when I traverse my saved entity tokens I expected the that the entityToken saved with occurence.entityToken of the inserted component will return that occurence (I know in an array) running Design.findEntityByToken(entity_token_of_occ_ref_object)
But it returns the root component. So essentially the root component and the occurence of the referenced component now have the same entity token! Which somehow makes sense because I created the referenced component by saving the Design with "Save As" in the first place. But I nevertheless expected the tokens to be different.
Now I know it sounds like a very rare situation. But I often use this workflow when I'm working on a new version of a design. Just to have a visual representation of the changes in the same design. I then make the copied and referenced component unselectable and set the opacity down. It is a nice way to have the current version and past version and compare the changes. Later on I can simply delete the referenced version out of the timeline.
So I was wondering if this is the intended behaviour?