sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    How to force MIN/MAX values in DC (user input) ?

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    6 Posts 3 Posters 1.4k Views
    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.
    • dereiD Offline
      derei
      last edited by

      **I try to limit the values that a user can input for a Dynamic Component, in Component Options dialog, but the only way I can do it now is a very nasty one. I have to use two attributes, like this:

      
      INPUT_val = [user_input_val] cm
      MIN_val = 10 cm
      val = IF(INPUT_val < MIN_val, MIN_val, INPUT_val)
      
      

      -so, I have to use val for my next operations, instead of INPUT_val.

      I would like to do something like this:
      (but this doesn't work, it gives me the #)

      
      INPUT_val = IF(INPUT_val < MIN_val, MIN_val, INPUT_val)
      MIN_val = 10 cm
      
      

      I agree, it looks like a circular definition, but maybe there is another way to do that.**

      DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

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

        How about SMALLEST(v1, v2, v3, ...) and LARGEST(v1, v2, v3, ...)?

        Error 404 (Not Found)!!1

        favicon

        (sketchup.google.com)

        Hi

        1 Reply Last reply Reply Quote 0
        • dereiD Offline
          derei
          last edited by

          @jim said:

          How about SMALLEST(v1, v2, v3, ...) and LARGEST(v1, v2, v3, ...)?

          Hmm, I can't figure out how to use this on an editable attribute. A little help, please? πŸ˜„
          As I could see, I can not use the attribute itself to compare. There is no such thing as self in DC-s? What I need is to compare the value that user inputs and IF the value is less than a minim (or more than a max.), to force that min/max. For that I had to use the attribute for INPUT, and the other one which doest the math and provide me with the result.

          DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

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

            self would be sort of like current("LenX")

            So something like this?

            val: =smallest(current("LenX"), 10)

            But I'm not sure you can do it with arbitrary attributes.

            Hi

            1 Reply Last reply Reply Quote 0
            • dereiD Offline
              derei
              last edited by

              @jim said:

              But I'm not sure you can do it with arbitrary attributes.

              It seems that is not possible. The editable attribute overwrites any formula with the value from input field, once the user inputs something 😞
              C'est la vie... 😒

              DESIGNER AND ARTIST [DEREI.UK](http://derei.uk/l)

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

                I don't know if this would help but the following Input uses a single attribute to set the value taken from Input_val; if less than Min then Min is used, if more than Max then Max is used, otherwise the Input_val is used - not ideal but it might help reduce your code a bit:

                =IF(Input_val<Min_val,1,0)*Min_val+IF(Input_val>Max_val,1,0)Max_val+Input_valIF(Input_val>=Min_val,1,0)*IF(Input_val<=Max_val,1,0)

                Regards, S

                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