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

I don't understand dynamic component scaling

Scheduled Pinned Locked Moved Dynamic Components
sketchup
15 Posts 6 Posters 4.0k 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.
  • Q Offline
    quantj
    last edited by 23 Oct 2014, 19:34

    I couldn't get the "x" in, so I made mine refer to another value which I then put in x. I also used INT to force round the numbers. If want fractions, maybe there's another formula for that...


    Scale-test.skp


    Screenshot 2014-10-23 15.39.37.jpg

    1 Reply Last reply Reply Quote 0
    • Q Offline
      quantj
      last edited by 23 Oct 2014, 19:35

      I have noticed sometimes sketchup adds the 0.000000000random little number, and yea, never figured it out

      1 Reply Last reply Reply Quote 0
      • M Offline
        Msketcher
        last edited by 23 Oct 2014, 19:57

        @quantj said:

        I couldn't get the "x" in, so I made mine refer to another value which I then put in x. I also used INT to force round the numbers. If want fractions, maybe there's another formula for that...

        I think you just need to put quotes around the x when using Concatenate so it treats it as a string. Yeah, I could use INT to clean it up too. The whole redraw thing is what I find really frustrating. Why doesn't it read the LenX property when typing in an absolute value? Why do you have to redraw?

        I mean, it seems like this was done on purpose *(why else would there be an option in the context menu to redraw?)*but I don't understand WHY?? When would you ever NOT want a dynamic component to redraw? Shouldn't it do it automatically every time?

        1 Reply Last reply Reply Quote 0
        • Q Offline
          quantj
          last edited by 23 Oct 2014, 20:49

          Yea I tried adding quotes and it just didn't work.
          I don't why it won't redraw automatically. I have same problem with my models.

          I have a dynamic table with option for amount of chairs to appear (Copy function), however if I scaled/change the the table height, the main chair height will scaled proportionally, but all the copy chairs won't. Very frustrating, my only way is to choose table height first before choosing chairs amount.

          1 Reply Last reply Reply Quote 0
          • P Offline
            pcmoor
            last edited by 23 Oct 2014, 20:50

            use two variables

            length =current("LenY")
            wide =current("LenX")

            Summary =length & " x " & wide

            this should force the redraw

            1 Reply Last reply Reply Quote 0
            • M Offline
              Msketcher
              last edited by 30 Oct 2014, 13:46

              @pcmoor said:

              use two variables

              length =current("LenY")
              wide =current("LenX")

              Summary =length & " x " & wide

              this should force the redraw

              So you're saying that by referencing the LenX and LenY values indirectly using custom variables, it forces a redraw? I'll have to try that. I noticed that's what the SketchUp team did in their dynamic windows, but I just assumed it was overly organized or something.

              1 Reply Last reply Reply Quote 0
              • T Offline
                Trogluddite
                last edited by 30 Oct 2014, 16:30

                IIRC, it's not so much using a proxy variable that makes it work - it's the use of the 'current()' function.

                As an example, consider you made a DC where the equations only allowed a component to be an exact number of feet long - very common for models of kitchen units, building supplies etc. When you resize it, things happen something like this...

                • You resize your component by whatever method - which changes, say, LenX. We didn't bother snapping to anything because we know the component only allows valid sizes.
                • The calculations are done by sub-components inside the DC to calculate their sizes - this causes a new value of LenX to be calculated, conforming to the 'whole units' constraint.
                • But if LenX just got calculated to a new value, different than the one supplied by the scale tool, that means that the DC just got resized again.
                • If SU were allowed to see that change as another re-scaling, it could set all the calculations running again - and with a very complex DC, this might just go on and on forever, with every calculation triggering yet another re-scale.

                The 'current()' function is used to resolve this problem - it's guaranteed to read the value either before the calculations start, or after they have all finished (which one, or both, I can't quite remember). It ensures that you receive a nice stable value, and that the maths has a proper beginning, middle and end, with each resize only calculated once.

                PS) Technically, that's probably nothing like what really happens! But I found that keeping that idea in my mind really helped me get my first few DCs working.

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Msketcher
                  last edited by 13 Nov 2014, 13:13

                  I just tried using the =current() function, and it still doesn't redraw when I use the Scale tool then type in a precise measurement.

                  • Scale the component an arbitrary distance = shows correct size after scaling

                  -Scale the component an arbitrary distance, then type in a precise distance/ENTER = size shows the original dimensions, not the new dimensions.

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    pcmoor
                    last edited by 13 Nov 2014, 22:01

                    try this,

                    note in metric 2.54 is required for conversion when using "current"


                    scale update.skp

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      Msketcher
                      last edited by 14 Nov 2014, 00:23

                      I downloaded your file. Same problem. If I scale the rectangle, then immediately type 200cm ENTER, the summary display is wrong. I just don't understand why it would behave this way.

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        pcmoor
                        last edited by 14 Nov 2014, 07:37

                        You have a misunderstanding of the scale tool, the scale is changed by the factor you enter, if you move with scale tool then enter 2, the result would be 2 times the previous size, or 0.5 would be half.

                        if you made a unit size, say 1 inch, then entering 25.75 then it would be 25.75 inches,

                        or say 1000mm then entering 3.45 makes the side 3450mm

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          Jim
                          last edited by 14 Nov 2014, 08:08

                          @pcmoor said:

                          You have a misunderstanding of the scale tool, the scale is changed by the factor you enter, if you move with scale tool then enter 2, the result would be 2 times the previous size, or 0.5 would be half.

                          if you made a unit size, say 1 inch, then entering 25.75 then it would be 25.75 inches,

                          or say 1000mm then entering 3.45 makes the side 3450mm

                          The Scale tool has always allowed scaling to dimensional values in the Measurements box. In your example, you could also enter 2" which would result in the object being "scaled" to exactly 2"

                          It's a bug in DC's that they are not redrawn when using the Measurements box.

                          Attention Required! | Cloudflare

                          favicon

                          (help.sketchup.com)

                          Hi

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            pcmoor
                            last edited by 14 Nov 2014, 08:32

                            thanks Jim, I learnt another thing about this amazing program, hopefully 2015-16 will bring about a revamp of DCs

                            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