Dynamic Component Value Reference Model Attribute Value
-
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.
-
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. -
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?
-
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-all-dynamic-components/77512
https://sketchucation.com/pluginstore?pln=ae_ToolbarEditor
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.
Advertisement