I have successfully created a series of similar dynamic door components, but I have noticed that the child’s link to the parent is confused when I insert both into the same model. I have made sure the Definition Name for both the parent and the children are unique in both dynamic components. I do not have any problem with either when I insert into a new model, but whenever I insert into an existing model where they are both and others are present I get an error in the Component Attributes Window.
The attached picture shows a 2 panel door and frame dynamic component (right window is in a fresh .skp), (left window is a file with other components, some dynamic).
How do I lock the children to the parent of each unique dynamic component?
An issue with definition names is that if another gets loaded with the same name as one already present in the “In Model” Components collection, then SketchUp automatically differences the name of the newly loaded definition copy, appending "#<integer>" to the name.
The DC “_name” attribute (what you set by double clicking in the Component Attributes dialog,) is just a text attribute used by the DC code. The real name property for the component definition is a separate thing set in the Component Inspector panel. (You should set this property before saving out the component’s .skp file. You’ll want these to be unique and represent the differences in the components.)
Obviously each different DC component needs a unique .skp filename. But filenames are not displayed in the Component inspector browser tab. It’s the Component name property that is displayed.
When you first start to create a DC from a “dumb” component, the name properties of the component and it’s nested objects and copied into “_name” attributes. But from then on they can be edited and diverge.
So it is the DC “_name” attribute that is used to identify DCs in formulae.
If working on DCs a lot, I suggest you get Aerilius’ Attribute Inspector extension from the EW.
Here is a simple sample model to demonstrate the ability to chain parent references.
In the sample we have a root component, a child component and a grandchild component.
Each component has an attribute called “test”. “root!test = 1”, “child!test = 2” and as you can see, “grandchild!test = parent!parent!test” would not parse.
I am looking at this Caining_Parent.skp and I do not see anything in the ‘Component Options’ view and no way to enter any different dimensions. In the ‘Component Attributes’ View, when I go down to the Grandchild level, I see this error.
Within it, the “TestRoot” component is really a child component.
I changed the "GrandChild!test" attribute to “Users can see this” and opened the Component Options dialog, and it actually does display, but displays it’s immediate parent’s "test" value, which is 2.
We want to actually see 1.
I tried this:
I added a "root" attribute in "TestChild" containing =parent!test ,
Then changed "TextGrandChild!test to be =parent!root and correctly got 1 displayed.
So it’s sort of a chain.
EDIT: We do get the same value if "TestChild!test"is=parent!test and "TextGrandChild!testis=parent!test.
I really thought that the parent! could be chained. Let’s ask Phil … @pcmoor ?
To my knowledge, DC’s have a scope of three levels:
One up, one down and equal.
All within the nested DC.
A model (level 0) can have attributes as well, though not visible in the UI.
Level 1 Components are siblings but their children (level 2) don’t see each other.
They have to ask their parents
I appreciate the discussion about different levels of DC’s, but can we get back to the original question of 'How do I lock the children’s attributes to the parent?
Yes I too, hence the like, but I guess the “proof is in the pudding”, I do hope that the powers that be, extend / improve the DC abilities rather than just pursue “the cloud”, in a coding perspective, chaining would be a reasonable assumption.
parent! is the solution to your problem provided the syntax of the formulas remain the same, otherwise you would have make the different one unique to stop the overwrite or update when placed with same
Yes @DanRathbun it is a bummer. It brings us back to question, why sketchup gurus don’t pay attention to improve functionality of DC… (I don’t want to open the discussion again as it’s already discussed)
Even parent!parent!test as you thought would do great improvement.