sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Can you round in 30" increments?

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    11 Posts 3 Posters 886 Views 3 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.
    • brodieB Offline
      brodie
      last edited by

      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
      • sdmitchS Offline
        sdmitch
        last edited by

        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
        • brodieB Offline
          brodie
          last edited by

          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
          • brodieB Offline
            brodie
            last edited by

            It looks like the magic code is...

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

            steelblue http://www.steelbluellc.com

            1 Reply Last reply Reply Quote 0
            • sdmitchS Offline
              sdmitch
              last edited by

              @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
              • brodieB Offline
                brodie
                last edited by

                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
                • brodieB Offline
                  brodie
                  last edited by

                  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
                  • Rich O BrienR Offline
                    Rich O Brien Moderator
                    last edited by

                    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
                    • Rich O BrienR Offline
                      Rich O Brien Moderator
                      last edited by

                      Oooops double post....

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

                      1 Reply Last reply Reply Quote 0
                      • sdmitchS Offline
                        sdmitch
                        last edited by

                        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
                        • brodieB Offline
                          brodie
                          last edited by

                          @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
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement