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

    DC SET function not only with onClick?

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    5 Posts 2 Posters 4.3k 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.
    • halroachH Offline
      halroach
      last edited by

      Hi,

      One of the dynamic component onClick functions is called SET, where one can, with a click, change the value of another attribute.

      1. Is there an equivalent to the SET function, that would change the value of another attribute, but not necessarily with a click?
        Something like this:
        IF(something=1,SET("someOtherAttribute",17))

      2. On the same note, would there be a way to set the contents of an attribute to be a formula, rather than just a value (in this case with an onClick... or some other way...):
        onClick => SET("something",=otherValue)

      That way:
      something => =otherValue
      So if let's say 'otherValue' = 7 so, 'something' will also equal 7 eventually...

      FlexTools - Super Quick Windows, Doors, Slats...

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

        You can place formulas within the options values, this can be used as a trigger to set attributes
        Plus it makes the attribute dialog cleaner and not so cluttered


        formulas within option dropdown.skp

        1 Reply Last reply Reply Quote 0
        • halroachH Offline
          halroach
          last edited by

          @pcmoor said:

          You can place formulas within the options values, this can be used as a trigger to set attributes
          Plus it makes the attribute dialog cleaner and not so cluttered

          I didn't think of that. That could be quite helpful!

          I was thinking, that if one could set an attribute with another attribute, it could serve as a type of workaround to the issue of values/formulas being zeroed out when editing multiple DC's. So you could just reset the formula with a click or option.

          Like maybe there would be an additional solution to the one's you've pointed out here:
          http://forums.sketchup.com/t/formulas-replaced-with-values-when-changing-multiple-dynamic-component-options/20177

          I'm sure there could be many other use cases for this...

          BTW. I've been following your various posts about DC's lately... So very insightful and helpful! 😄

          Thanks!

          FlexTools - Super Quick Windows, Doors, Slats...

          1 Reply Last reply Reply Quote 0
          • halroachH Offline
            halroach
            last edited by

            @pcmoor said:

            You can place formulas within the options values, this can be used as a trigger to set attributes
            Plus it makes the attribute dialog cleaner and not so cluttered

            I'm trying to place different formulas within the options values, but I'm having trouble with it. I want the user to choose an option. A formula will be output, and I want to be able to output anotherformula that corresponds to the user's choice.

            I took the same file you uploaded, and added +5 to the first formula. When I try to check the index with "OPTIONINDEX", I get -1 instead of 1. Have you encountered this?
            Why am I getting -1!? If I remove the +5... it works fine. This happens with other variations of formulas where I add a + sign...

            File attached


            formulas within option dropdown_(minus one).skp

            FlexTools - Super Quick Windows, Doors, Slats...

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

              I believe in coding -1 is returned when a match is not made

              the use of + seems to create a bug in the ruby side to DCs

              • minus works, so a work around is to use a variable, being positive at first, then changing it to negative after the ruby script behind the scenes has accept it

              =2*current("leny")*2.54-val

              where the attribute val initially = 5, then change it to -5 after the first run

              this is probably only required if you were relying on the index for your calculations

              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