sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    DC child component

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    6 Posts 2 Posters 4.5k 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.
    • J Offline
      Jorgensen
      last edited by

      hi

      i have just started experimenting with dc, and i have a quick question.

      i have a group - "char", that contains two groups "seat", "legs".

      i have added a onClick behavior that i would like to hide / show the legs (just for testing).

      i thought i could do something like legs.SET("hidden", 0, 1), but that gives an error.

      i can ad the onclick behavior direct at the "legs", but when they are hidden, i can't click to show them again - so i thought the solution could be to add the behavior to the parent.

      is it possible to access childs from the main group?

      thanks
      jorgensen

      sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

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

        create an attribute say called hide in the parent and give it a value 0, toggle this via the onClick with SET("hide", 0, 1).

        Then for hidden attribute value within the children(legs)
        hidden = parent!hide (or char!hide)


        example

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

          can use SET("legs!Hidden", 0, 1) as direct reference as well


          example 2

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jorgensen
            last edited by

            hi pcmoor

            thank you very much for your fast reply.

            i have opened your file and it works just fine!

            i have tried to replicate the same behavior to my own model, but i can't get it to work - though it seems that i have done exactly the same.

            could i ask you to test the file? it might just be a typeping error


            save.skp

            sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

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

              hav't an explanation to why example 2 does not work, however able to fix using example 1

              will look into it tomorrow


              save.skp

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

                the difference between my examples (hide.skp) and your model (save.skp) is the parent is a component in mine whereas yours is a group. It appears groups can't pass down a value, but rather they need to reference the parent.

                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