Component instance is not a instance when nested

I would like to add an Attribute Dictionary to all instance components.
This dictionary will contain all instance parameters / data of the object.
But now I notice something…

When a ComponentInstance is nested in another component, the instance is no longer an instance it seems.
All data that is then assigned to the nested component is taken over in every nested instance.
Also the the SU_InstanceSet data.

This is not what I expected.
If you copy a nested component 2 times, I expect all objects to be separate instances of that definition.

What I’m wondering now:

  • Is this SketchUp’s “normal” behavior?
  • Is this a bug?
  • Or is there a way / workaround to assign unique data to all instances?

I believe it is a “normal” behaviour. No bug.
I’ll try to explain how I think. (Perhaps someone with better knowledge of English/Ruby API will correct me… It is even possible that I completely misunderstood the task. :blush: )

The “Woning 12” definition is holding a reference to the instance of “GO_Woning 12”. If you inserting an additional instance of “Woning 12” in that instance should contains the same reference to the instance of “GO_Woning 12”. In other words the nested instance should be the same otherwise the container around will not be the same definition.
Actually you have unique data to all instances assigned but in a wrapper definition you must heve to refer to the same instance.

Thank you for your clear explanation :smiley:.
I hadn’t looked at it that way, but it does make sense.

My idea of ​​assigning unique data to instances only works as long as the instances are not nested.

Therefore, the unique data was continuously overwritten.

1 Like

Yea, I guess so.
Here is an example how I solved it to avoid that:
(The definition of the actual instance is collected to array and only processes that definitions entities that already not in that collection…)