• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Changing units format via ruby

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 2 Posters 2.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.
  • J Offline
    jeff hammond
    last edited by 22 Dec 2011, 17:14

    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
    • T Online
      TIG Moderator
      last edited by 22 Dec 2011, 17:36

      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
      • J Offline
        jeff hammond
        last edited by 22 Dec 2011, 17:49

        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
        • T Online
          TIG Moderator
          last edited by 22 Dec 2011, 18:29

          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
          • J Offline
            jeff hammond
            last edited by 22 Dec 2011, 18:43

            sweet!

            exactly what i was looking for.

            thank you sir

            dotdotdot

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

            Advertisement