Getting Drawing Elements of a Group

A group, select the group…

object = selection.first
elements = object.entities.grep( Sketchup::Drawingelement )

will return the geometry within the group.

But if I’m in the group and want to get the geometry without selecting the geometry, what do I need to look at to get the geometry?

object = model.active_path

seems to return the group identifier when I’m in the group…

elements = model.active_entities.grep( Sketchup::Drawingelement )

The Model#active_entities doc says …

Returns an Entities object which contains the entities in the open group or component instance.

To perform actions upon the current set of entities the user is working with then this is the method to use.

4 Likes