Update Reference to Sibling aka Global Attribute

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 the first time, but when I change the value, the components using this reference don’t update by themselves. How can I achieve that?

I don’t want to put all components in one big component to reference it as parent!. This seems rather messy.

Or is there a better solution for my problem?

EDIT: I just found out that if I have a setup like above, change some value on the furniture component via Component Options and click apply, the reference to the sibling attribute updates. However, I want this to happen automatically.

Thanks in advance
Christoph

The Model level itselfs act as the highest Parent level.
Consider a component as a mini-SketchUp file…
When you have a model, you are actually in a component.
The thing is, DC won’t display the model attributes through the panels, allthough they can have them (but it is a bit cumbersome to set them, since you have to import the model in a new file, set the attributes in the DC panel, save it and open again)

Instead:
Make dummy components (I sometimes just draw a recrangle and make it a component). Set the attributes for the glob al settings, do not nest them in the existing, but put them somewhere in the model. Name it GlobalComponent or simular.
Refer to them in the existing components.
You need to redraw when you make a change in the global component, however.

Refer in the existing components to GlobalComponent!MaterialSetting etc.

Also see this thread:

Thanks for your reply Mike.
That`s basically how I do it. I realised now that I just need a way to quickly redraw all DCs.
I’m looking into it.

1 Like

OK I have a working solution. I used this code

 Sketchup.active_model.selection.grep(Sketchup::ComponentInstance).each do |s|
    $dc_observers.get_latest_class.redraw_with_undo(s)

end

and bound it to a custom toolbar button via toolbar editor.

2 Likes

You mean the one created by @Aerilius ?

Here is a link for the ones who might be interested:

https://extensions.sketchup.com/en/content/toolbar-editor

Yes, that’s the one. Works really well.

1 Like