Dynamic Component Value Reference Model Attribute Value

Dynamic Component Value Reference Model Attribute Value

Postby Skastafari » Mon May 13, 2019 7:29 pm

Is this something that can be done? I have found myself in a situation where having a dynamic component value reference a model attribute value would be very beneficial; though I am not sure how, or if it can be done. If this can be done, can someone provide me with a working dynamic component syntax example. If this is not possible, I suppose I could accept the sad news instead.
0

Skastafari 
 

Re: Dynamic Component Value Reference Model Attribute Value

Postby pcmoor » Tue May 14, 2019 8:02 am

You can reference any component or group by name if they are on the same level of nesting. So objects in the same file can reference attributes via the DC dialog; however you need to do a redraw for this to take effect. Redraw can be done via the DC, right click menu or a ruby script.
You can reference the parent by name or by by the generic term parent as in parent!attribute rather than just myDC!attribute, this makes generic referencing possible for inserted DCs.
Parent attributes of a file are not available on opening, so to create an environment that can have global attributes the file would retain a DC which would be opened to insert components that can update to the global data.
0

pcmoor 
 

Re: Dynamic Component Value Reference Model Attribute Value

Postby Skastafari » Tue May 14, 2019 10:07 pm

So, I get how to use parent as a variable way to reference the next level up in a component hierarchy, except it seems to fail (or I fail?) at the top component level, leaving no way to reference anything outside the component hierarchy. If I understand what you are saying correctly... to get a sort of "global" reference in a dynamic component, one must first place it in another component and work in that component. I guess I just figured the "right" way to have a hierarchy is to have a top level (being the model itself) and referencing model attributes vs component attributes at that point. This would seem to be the logical way to organize things to me. Though my attempts to produce any results in this way have all failed. Am I wrong in my understanding here?
0

Skastafari 
 

Re: Dynamic Component Value Reference Model Attribute Value

Postby pcmoor » Wed May 15, 2019 10:20 am

To update references on change of a global, one needs to do a "redraw" as per the context menu for each component, rather than do this manually, a simple ruby script can be attached to a button as per

https://forums.sketchup.com/t/redraw-al ... ents/77512

https://sketchucation.com/pluginstore?p ... lbarEditor

where else a component instance will update to the current global on insert.

Can you share the main focus of your use of DCs? as its quite likely other scripts will be useful.
0

pcmoor 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Dynamic Components

Who is online

Users browsing this forum: No registered users and 4 guests

Visit our sponsors: