sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Dynamic Component Value Reference Model Attribute Value

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    4 Posts 2 Posters 6.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Skastafari
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • P Offline
        pcmoor
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • S Offline
          Skastafari
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • P Offline
            pcmoor
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement