Can only specifically named instance of a component be made to respond to a behavior?

Background:
I have a component called Single Bed.
I also have a component called Double Bed.
Double Bed is made up of two mirrored Single Bed components.
In Double Bed, the Single Bed to the left is given the instance name Left and the right Right.
Single Bed and Double Bed components are located throughout my model.
As such, all Double Beds automatically contain Single Bed instances named Left and Right.
However, no ‘standalone’ Single Beds have instance names.

Goal:
My Double Beds can separate into two Single Beds.
As such, I’d like to OnClick the Double Bed and ANIMATE it’s two Single Beds spreading apart.

Problem:
In a behavior, is there way to specify not just a component but a specifically named instance of a component?
So that only the specifically named instances of the component respond.
And that unnamed or differently named instances of the component do not respond.
I’d imagine a Double Bed onclick attribute something like:
ANIMATE(“Single Bed:Left!Y”,0,40); ANIMATE(“Single Bed:Right!Y”,0,-40)
However, I’ve tried this and other variations and they haven’t worked.
That you for your time and consideration.

Your model would help. However a simple concept using a cuboid
double bed.skp (30.4 KB)

1 Like

I appreciate your time and effort pcmoor.
If I can’t figure out how to animate the Double Bed,
and if I can figure out how you did it,
I’ll gladly use your suggestion.
Her is my model and my best guess incase it helps.
Thank you.

Beds.skp (146.5 KB)

Beds.skp (129.2 KB)

as the sub-components share the same attributes (not unique) had to reference the parent, and then one can only change the position and rotation. The geometry remains the same unless you make one unique. You will note that any attribute you add to one it appears in the other and the reference can interfere with each other I placed the required attribute in the parent. I used the generic reference to parent as to safe guard against any future instance name uses.

2 Likes

OMG. You did it. It looks so elegant. I will have to spend a while reading your comment and the function to understand what you did but thank you!

Hi pcmoor,
I doubted your solution but it does indeed work perfectly even with multiple instances.
Thank you again.

1 Like

Hi again pcmoor.
I’d haven’t been able to figure out how you got the attribute to work.
I don’t want to bother you or tax your generosity but I wonder if you wouldn’t mind explaining how you did.
I think there might be some kind of scrip somewhere.
Regardless, I appreciate your time and consideration.
Thank you.

When adding attributes to a component where you wish to make use of the instance naming you need to saveas the original, clear and bring the DC back into the file, otherwise the attribute and option header does not update. It keeps referring to the embedded definition _name

1 Like

I’ll have to read and watch a couple times but I get the basics now.
Thank you again pcmoor.