Dynamic Component Parent Attributes

Running into an issue with copies of dynamic components. See attached file/screenshots for reference. Working SU 2018 with dynamic component that was created in 2018.

Dynamic Hinge Issues.skp (1.4 MB)

Initial component is the lower hinge, foreground(1.1). That component is then copied upwards(1.2, 1.3, etc.) within the dynamic component. I have a hinge angle attribute that is changed in the dynamic component options. This works perfectly for the original dynamic component(1). HOWEVER, if i make a copy of that dynamic component(1) then the new instance(2) doesn’t operate correctly. The bottom hinge(2.1) is still referencing attributes from the original instance(1). The copies(2.2, 2.3, wtc.) of that internal component DO work correctly, referencing attributes from the new instnace (2). which is even more perplexing for me. Each of the attributes is using the “parent!..” variable, but even if I try to reference it directly it still comes up with the wrong value.

Am i referencing the variables incorrectly?

Your description sounds somewhat confusing to me. Can you post your component?

I would organize this like this:

  • the parent component contains a hinge component plus attributes for the hinge rotation and, maybe, the number of copies.
  • the hinge component’s rotation attribute references the one in the parent.
  • the hinge component makes copies of itself following the copies attribute in the parent, and positions them according to copy number ( in your case using the z attribute)

Your description makes me think that you are trying to use a sibling as the parent.

Posted in 2017 format for @pcmoor.

Dynamic Hinge Issues.skp (1.4 MB)

@Anssi Originally posted in 2018, see above for 2017. What you have described is how the DC is set up.

I can see what’s happening in your model, but not sure if I know how to fix it.

You have values being passed from grandparent to child to grandchild. They are not propagating properly, which is maybe to do with the (random?) order that SketchUp calculates these values. I don’t really think that you’re doing anything wrong, just that Sketchup doesn’t let you do this.

c_HingeOpen (grandparent)
Open (child)
rotZ set from its parent (grandchild)

It never seems to work for the bottom hinge, but works for its copies.

A solution could be to remove one of the generations so you have just a parent and child. The left leaf of the hinge doesn’t move, so move it up to the top level. The child would be the right leaf of the hinge that moves. You are going to lose some of your organisation by doing this as you have a component for each hinge then the right leaf inside that.

This would be organised like @Anssi suggested with just a parent and child, no grandchild.

This GIF shows the problem with the values not being updated. The grandparent (and child) are both 90 (new, correct) but the grandchild is 30 (old value, incorrect).

I am starting to understand the whole parent, child, grandparent, second cousin twice removed thing now…

I am not opposed to simplifying the “generations” to 2 instead of 3 as it is now, but is there maybe an additional language that could be used in the formula? I.e. instead of “=parent!open” do “=sibling!open” or something along those lines? However, that still doesn’t really help me understand how the second “parent” (noted as 2.1) would be referencing the original DC…

the problem is groups that are not becoming unique on copy or after inserting, changing the second level (first nesting) to components, guarantees that the sub parts become unique.
see http://ruby.sketchup.com/Sketchup/Group.html#make_unique-instance_method gives an insight into group behaviour.

Dynamic Hinge Issues (1).skp (548.1 KB)

4 Likes

That did it. I updated the original DC by making the copied portion (1.1) a component instead of a group. I also did this for the other hidden options within the hinge. I usually work with components all of the way through to the lowest level (where applicable), but I must have exploded/grouped things at some point and lost that.

Thanks for the help @pcmoor.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.