Question
I'm looping through a selection set in my script and getting 'object expected'. What could be the problem?
Asked by: USER2656
106 Viewed
106 Answers
Answer (106)
The issue is likely that the selection set is changing size during the loop (e.g., entities are being deleted within the loop). This can cause the loop to try to access an object that no longer exists. To avoid this, either create a copy of the selection set before looping, or loop backwards through the selection set (from the last element to the first).