Multiple changes to utils/utils.py to support exporting multiple copies of components:
moved renaming old components to outside of copy_body, after all copies complete (otherwise you're renaming a copy of a component before you're finished, which affects all copies of that component)
removed all the same_occs code (not necessary, and I think that's the reason that the method was creating X^2 old_components when there were multiple copies)
renamed old_occs parameter to occs to avoid confusion with oldOccs array.
Before this change, running the script would result in 16 copies of occuranced_link, and the four new components occuranced_link_1-4 would be overlaid over each other in the first position (among other things).
After this change, only one copy of each occuranced_link_1-4 is created, and each component is correctly positioned and exported even if it is one of multiple copies.
I've only tested out this change on two designs. I'd suggest testing it out yourself on a few different models, but the logic looks good, and it's working great for me.
Multiple changes to utils/utils.py to support exporting multiple copies of components:
simple test design uploaded here: https://drive.google.com/open?id=1AGhEM4f63KbEJ8FhI6pkWpO6sjfRcVbK
Before this change, running the script would result in 16 copies of occuranced_link, and the four new components occuranced_link_1-4 would be overlaid over each other in the first position (among other things).
After this change, only one copy of each occuranced_link_1-4 is created, and each component is correctly positioned and exported even if it is one of multiple copies.
I've only tested out this change on two designs. I'd suggest testing it out yourself on a few different models, but the logic looks good, and it's working great for me.
Thanks!
Alan