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

    Changing units format via ruby

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 2.5k 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.
    • jeff hammondJ Offline
      jeff hammond
      last edited by

      is there a way to change the unit format via ruby?

      [say i'm set to architectural -> feet but i want to switch it to decimal -> inches]

      and while i'm at it, how about a way to switch the precision as well?

      thanks

      dotdotdot

      1 Reply Last reply Reply Quote 0
      • TIGT Online
        TIG Moderator
        last edited by

        Yes there is - you can control both those and the 'snapping' to.
        There's a tool to swap units - Toggle-Units...
        http://forums.sketchucation.com/viewtopic.php?p=81391#p81391

        TIG

        1 Reply Last reply Reply Quote 0
        • jeff hammondJ Offline
          jeff hammond
          last edited by

          oh right, i have that plugin.

          basically though, what i'm wondering, is if there is something i can type into the ruby console to do this..
          (apparently there is since that plugin was made but it would take me 3 days to dissect the code and figure out what to type into the console 😳 πŸ˜† )

          i've looked through the api documentation but apparently i missed the part dealing with units.
          thanks

          dotdotdot

          1 Reply Last reply Reply Quote 0
          • TIGT Online
            TIG Moderator
            last edited by

            The units part of the API is well hidden away!
            Here's a 'mm' version BUT you can see how to do in 'inches' one...
            ` Sketchup.active_model.options["UnitsOptions"]["LengthUnit"]=2

            mm`

            OR use 0=inch, 1=feet etc...
            ` Sketchup.active_model.options["UnitsOptions"]["LengthSnapEnabled"]=true

            grid snap on

            Sketchup.active_model.options["UnitsOptions"]["LengthSnapLength"]=10.mm

            or whatever

            Sketchup.active_model.options["UnitsOptions"]["LengthPrecision"]=1

            1.5mm not 2mm or 2.01mm

            Sketchup.active_model.options["UnitsOptions"]["SuppressUnitsDisplay"]=true

            don't show 'mm' etc

            Sketchup.active_model.options["UnitsOptions"]["LengthFormat"]=0

            Decimal`

            OR use =3 for fractional, =2 for Engineering, =1 for Architectural...

            TIG

            1 Reply Last reply Reply Quote 0
            • jeff hammondJ Offline
              jeff hammond
              last edited by

              sweet!

              exactly what i was looking for.

              thank you sir

              dotdotdot

              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