How to access attribute component for instance model?

hi . suppose to we make a component that have materials attribute.
i can access name of this material by this code:

sele = Sketchup.active_model.selection[0]
dyn_att = sele.definition.attribute_dictionaries['dynamic_attributes']
p dyn_att["material"]

when i clone this component and change material, its apply in model and component attribute but my code return same result for each component !

how can i solve this problem :pray:

Perhaps the attribute of the instance should be examined, not it’s definition.

dyn_att = sele.attribute_dictionaries['dynamic_attributes']
2 Likes

Agree. If it is a dynamic component, always check the instance dictionary 1st, then the definition dictionary.

If it is a dynamic group, all attributes will be in the group’s dictionary.

1 Like