# Repositioning automatically - Siblings DC issue

**URL:** <https://forums.sketchup.com/t/repositioning-automatically-siblings-dc-issue/192925>\
**Category:** Ruby API\
**Tags:** dynamiccomponents\
**Created:** [March 16, 2022, 2:49pm UTC](https://forums.sketchup.com/t/repositioning-automatically-siblings-dc-issue/192925 "2022-03-16T14:49:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leandroh00](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/leandroh00/32/136539_2.png) [@leandroh00](https://forums.sketchup.com/u/leandroh00)\
**Post date:** [March 16, 2022, 2:49pm UTC](https://forums.sketchup.com/t/repositioning-automatically-siblings-dc-issue/192925/1 "2022-03-16T14:49:40Z")

</div>

Hello masters!

I’m looking for a solution from a old problem in DC. I read some topics about this, but I can’t fix this issue in my project. I’m using Sketchup 2020, and trying programming in Ruby Console + of @Aerilius.

**The problem is:** when I modify the **FREE** position (by click and drag with mouse) of shelf bellow and the position of shelf above is **parametric** (calculating the height (H) remaining space and dividing for the quantity of shelves), the shelf above (3 for ex) looses the info about position of shelf 2 and dont assume the new parametric place.

**I’m looking for Ruby solution** beacause I understand that is the way to force this arrangement. The position is realocated correctly when I move the shelves with mouse, but this becomes impractical when having to change positions multiple times (and having to move all shelves to recalculate).

Actually, in my project, each shelf, have the follow attributes:

**Z =** Parametic (height / Shelf Quantity) or Free (without formula, to be possible drag with mouse)  
**space=** (Space between base and roof - shelfbellow! position Z ) **this is why I’m using siblings reference and this is why is no working well, because the ref is not getting attribute from parent! - I made in this method to be possible the drag with mouse instead put values in parent!, trying make a more intuitive way to designers**

Is possible a solution to this? I saw some old topics, but I don’t know if have new solutions from this issue.

thanks a lot

 ![0 exemplo forum - free and parametric](https://global.discourse-cdn.com/sketchup/original/3X/d/e/de730567ee0e6f6d70e369033235fdf2e6a30187.jpeg)

some topics visited:

> [@DC refresh/redraw/rebuild](https://forums.sketchup.com/t/dc-refresh-redraw-rebuild/24890):
>
> Is there a metod to refresh,redraw/rebuild DC after put into model? I have model observer onPlaceComponent in witch I change some DC variables. Variables are chanded but another dependent variables did not change. Do you have any sugestions?

> [@Method to ask a dynamic component instance to recalc itself?](https://forums.sketchup.com/t/method-to-ask-a-dynamic-component-instance-to-recalc-itself/13905/6):
>
> Yes, true, you are correct. (1) It still exists. (2) It itself is poor practice, and could have been a class variable reference (implemented in a singleton manner.) It could have been exposed via a class constant or a class getter method. (3) As I said above, It might not exist in future versions, if they re-implement it’s reference per (2). So, you’ll need to do a object search and hold a local reference inside your module, to the same singleton object that $dc\_observers is also referenci…

> [@Redraw all dynamic components?](https://forums.sketchup.com/t/redraw-all-dynamic-components/77512/11):
>
> @KScher & @mozarov Here is a revised edition that will work on multiple selection … # Redraw all selected (and siblings) UI.add\_context\_menu\_handler do |context\_menu| ss = Sketchup.active\_model.selection if defined?($dc\_observers) && !ss.empty? insts = ss.grep(Sketchup::ComponentInstance) if !insts.empty? dynatts = 'dynamic\_attributes' insts.select! {|i| i.definition.attribute\_dictionary(dynatts) } if !insts.empty? cdefs = insts.map(&:definition).uniq …

> [@Update Reference to Sibling aka Global Attribute](https://forums.sketchup.com/t/update-reference-to-sibling-aka-global-attribute/94257):
>
> Hi Folks, this is my first post. I’ve been reading along for some time now, but didn’t find a solution to my current problem. So I hope you can help me. I’ve been searching for a way to make some kind of global attributes which can be referenced by multiple DCs. For example, I want to change the Material or thickness of furniture parts in one place. One solution I found is to make a component on the sibling level and reference its values via SiblingComponent!attribute. This works fine for …

> [@Refresh Model Info Dialog in Ruby](https://forums.sketchup.com/t/refresh-model-info-dialog-in-ruby/135479):
>
> Okay, I’m new to Ruby and am toying around with adding a toolbar. So far, I’m able to create my toolbar, add the buttons I want which trigger an event when clicked. That event contains code to change the values to what I’ve selected. What I am unable to figure out is how to refresh the Model Info dialog so it displays the changes I’ve just made. For example, I created a button to toggle the units format to decimal. It works perfectly, except that the Model Info dialog does not reflect the c…
