This should give you a start. Just add a selection append command at the bottom of the loop. https://forums.cgsociety.org/showthread.php?t=933937