Hi JBenghiat,
After a long hiatus, I am finally getting back to this. To answer your question of how I am traversing objects, I have a symbol definition consisting of symbols from a resource folder. So rather than replacing a symbol in my drawing, I am actually trying to replace a symbol in a symbol definition. For my current purposes, I am ignoring the actual replacement of the symbol and reduced the task to simply removing the symbol of a given name from anywhere that it occurs in the symbol definition. Once this is done, I attempt to delete the symbol from my resources folder and receive the message that it is still referenced (even though I don't believe it is). I am attaching my code to hopefully make clearer my traversal method. My symbol definition can contain both symbols and groups of symbols.
The reason I wrote this script in the first place is because the team I'm writing the script for doesn't want to necessarily replace a symbol in every symbol definition that references it. So I allow them to select the symbol definitions where they wish to replace the symbol. It is in the fringe case where they do replace the symbol in all the symbol definitions that reference it where they encounter the warning message. Obviously in this case, they could use the built in VW Delete/Replace function, but it seems they want to access this function from a single place. I'm ready to tell them to just live with it! 🙂
Best,
Scott
Delete Symbol.txt