Selecting Faces inside multiple groups

First, I would suggest to open your own topic instead of posting in a multiple other topics… :wink:

Second, You can examine this how to post Ruby code: https://forums.sketchup.com/t/how-to-post-correctly-formatted-and-colorized-code-on-the-forum/46189


Beside there are some unnecessary lines in your code (line 6 and 13-15)

With the 3rd line you are targeting only one (the first) group of the selection. Then the code will find a face in it and will push-pull that one. BUT.

I assume the main issue is because of this behavior of SU:
Copying a group in SketchUp will create a group that shares the same definition. SketchUp implicitly makes group unique when edited from the GUI, and from a user point of view groups could be thought of as always being unique. I guess the groups in a quoestion, are made by just copying like that.

To honor this behavior, call this method before editing a group through the API.
Group#make_unique-instance_method
e.g. inserting this after 3rd line

target.make_unique

will make this target group unique and the push-pull will not “affect” the others