Component in a component

General note here: Please safely namespace your extension to insulate it from other extensions.
For more info, check this out:Hello Cube! | SketchUp Developer

Dan has also created this template for such a thing:

As for your issue; in your second function “cube2”, when you set:
ents = Sketchup.active_model.entities
You are setting “ents” to include all entities that are currently in your model (including the component created in “cube1”).

1 Like