selection#add is not an alias for selection#toggle
Documentation bug. Since at least SU 2017, the documentation for Sketchup::Selection is no longer up-to-date about the methods #add and #remove and #toggle. The documentation says that they are all aliases for one another. However, that's not the case any more; they now behave like their name implies.
Sketchup.active_model.selection.add(Sketchup.active_model.entities.to_a)
19 # for example, if I have 19 entities in total
Sketchup.active_model.selection.add(Sketchup.active_model.entities.to_a)
0 # the 19 entities remain selected (so add != toggle)
Sketchup.active_model.selection.remove(Sketchup.active_model.entities.to_a)
19 # the 19 entities are now unselected
Sketchup.active_model.selection.remove(Sketchup.active_model.entities.to_a)
0 # all entities are already unselected (so remove != toggle)
I can find no mention of the change in behavior in the Ruby API release notes.
I do remember all 3 methods acting as aliases back ~ v7 or 8, (and no one liking it.) But I cannot remember when this changed.
Yea, I think those comments are very old. I cannot recall this being fixed while I has been working here. I'm guessing it was fixed during the Google era.
Please update the docs on this. It took me awhile to track down a bug in my code and in turned out the bug was because I had assumed that was written in the docs regarding the selection method aliases was true.