User input controlling sub-sub-components within a DC?
-
Hi -
Is it possible to set a user input box on a DC to control sub or sub-sub components within that DC?
I have to admit, I haven't searched extensively for a way to do this, but the answer isn't clear to me based on the little DC work I've done.
I've watched the "repeat" DC tutorial, where a fence is scaled at the sub-component (fence slat) is repeated.
I'd like to do something like that, but also control the rotating of the sub-component.
Imagine that I want to create a dynamic component, which has a fence rail, and fence slats. I want the fence slats to repeat on a set spacing, and I want the user to control the rotating of the fence slat about one of the fence rails.
Was I clear enough that someone could comment?
-
Dan,
It can be done, buy it is not as straight-forward as it could be.
One option is to assign the attribute directly to the nested component. The user would then need to open the top-level DC for editing until the target component is selected, and then open the DC Options dialog.
The other option is to assign an attribute to the top-level component, and pass the value down. The main constraint is that a component can only access direct parent and child attributes. So if you need to set an attribute in a grand-child component, you need to use a intermediate attribute in the child.
- TopLevel | + Child | + GrandChild
If you need an attribute "foo" in GrandChild, you start with a "foo" in the TopLevel:
TopLevel!foo:(get value from dialog.)
Pass it to the first Child"
Child!foo: =parent!foo
(or=TopLevel!foo
)And finally down to the GrandChild:
GrandChild!foo: =parent!foo
(or=Child!foo
)if that makes sense.
Note 1: The name of the attribute is not required to be the same - it just seems to make sense to use the same attribute name in all 3 levels.
Note 2: Not sure of the
=parent!attribute
form is documented anywhere, but using =parent can provide a small amount of abstract re-use for DC's. -
Dan,
See this, A question I've asked before:
http://forums.sketchucation.com/viewtopic.php?f=289&t=23202
........
It appears that you can't reference nested components directly (unfortunately)
.........
Hope this clears things up
Bye
Howard L' -
Thanks, all. This is exactly what I needed.
Advertisement