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

Can you round in 30" increments?

Scheduled Pinned Locked Moved Dynamic Components
sketchup
11 Posts 3 Posters 825 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.
  • B Offline
    brodie
    last edited by 7 Aug 2012, 16:23

    I've got a component that I want snap in 30" increments when I scale it. Right now I've got

    =NEAREST(CURRENT("LenX"),60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,600,630,660,690)

    ...but that's pretty messy and limits the sizes. Is there some way I can use the ROUND function perhaps (or something else) to just tell SU to snap in 30" increments?

    -Brodie

    steelblue http://www.steelbluellc.com

    1 Reply Last reply Reply Quote 0
    • S Offline
      sdmitch
      last edited by 7 Aug 2012, 16:57

      How about

      lenx=((lenx/30.0+0.5).floor * 30.0)
      lenx=30.0 if lenx==0.0
      

      Nothing is worthless, it can always be used as a bad example.

      http://sdmitch.blogspot.com/

      1 Reply Last reply Reply Quote 0
      • B Offline
        brodie
        last edited by 7 Aug 2012, 19:06

        I'm not quite sure how to use that. The ".floor" isn't valid, right? Is that a mistake or are you describing something?

        -Brodie

        steelblue http://www.steelbluellc.com

        1 Reply Last reply Reply Quote 0
        • B Offline
          brodie
          last edited by 7 Aug 2012, 19:18

          It looks like the magic code is...

          =round(current("LenX")/30)*30
          

          steelblue http://www.steelbluellc.com

          1 Reply Last reply Reply Quote 0
          • S Offline
            sdmitch
            last edited by 7 Aug 2012, 19:49

            @unknownuser said:

            I'm not quite sure how to use that. The ".floor" isn't valid, right? Is that a mistake or are you describing something?

            -Brodie

            ".floor" is most definitely valid. It is equivalent to ".to_i" in this case.

            Nothing is worthless, it can always be used as a bad example.

            http://sdmitch.blogspot.com/

            1 Reply Last reply Reply Quote 0
            • B Offline
              brodie
              last edited by 7 Aug 2012, 20:29

              You're bringing me further down the rabbit hole, ".to_i"? What's that?

              If, as a test, I input...

              =100.floor
              

              ...into the LenX box, it gives me an error (not really an error but it doesn't seem to know what to do as it reports back "#=100.floor". Likewise, when I input your code it also doesn't seem to work.

              -Brodie

              steelblue http://www.steelbluellc.com

              1 Reply Last reply Reply Quote 0
              • B Offline
                brodie
                last edited by 7 Aug 2012, 20:30

                Are we both talking dynamic components or are you referring to ruby scripting?

                -Brodie

                steelblue http://www.steelbluellc.com

                1 Reply Last reply Reply Quote 0
                • R Offline
                  Rich O Brien Moderator
                  last edited by 7 Aug 2012, 20:31

                  I'm wondering if Sam is speaking in Ruby? I'm not a DC aficionado but it does look alot like ruby πŸ˜•

                  Download the free D'oh Book for SketchUp πŸ“–

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    Rich O Brien Moderator
                    last edited by 7 Aug 2012, 20:32

                    Oooops double post....

                    Download the free D'oh Book for SketchUp πŸ“–

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdmitch
                      last edited by 7 Aug 2012, 21:34

                      DOH!!!!!!!!!

                      Yes, the .floor and .to_i are Ruby elements. Sorry I didn't realize we were discussing Dynamic Components.

                      Never mind.

                      Nothing is worthless, it can always be used as a bad example.

                      http://sdmitch.blogspot.com/

                      1 Reply Last reply Reply Quote 0
                      • B Offline
                        brodie
                        last edited by 7 Aug 2012, 21:48

                        @sdmitch said:

                        DOH!!!!!!!!!

                        Yes, the .floor and .to_i are Ruby elements. Sorry I didn't realize we were discussing Dynamic Components.

                        Never mind.

                        ah ha, no worries πŸ˜„ I was hoping I'd missed out on some DC secrets.

                        -Brodie

                        steelblue http://www.steelbluellc.com

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

                        Advertisement