In the end the combination of your code managed to purge all unused components in one go without crashing.
model = Sketchup.active_model
model.start_operation('compos_togo', true) # for possible undo
defns = model.definitions
togos = []
defns.each{|e| togos << e if (e.name =~ /^*/ && e.count_used_instances == 0)}
# there are many pattern matching possibilities...
togos.each{|e| defns.remove(e) }
model.commit_operation # allowing an undo
Not sure why the native purge feature crashes on this model, but I am grateful for your ruby script knowledge and will keep this code handy the next time I run into this glitch. I was finally able to clear out old components bringing my model from 93MB to 76MB. ![]()
Note after the Ruby Script Purge Components, the native Window → Model Info → Statistics → Purge Unused works without crashing!
Thanks again!
Chris