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

    Custom units, can it be done?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 3 Posters 951 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.
    • L Offline
      lee3001
      last edited by

      I have a thinking challenge. I work on many traditional projects in Japan, and very often I have to draw in units based on the measure "shaku". By todays standard 1 shaku equals 303mm.

      The way I do it now I draw everything in mm and scale it afterwards, but I was wondering if there was a way to create a custom unit in Sketchup. If it is not possible in a conventional manner, a hack will do too. Just some way of drawing in custom units.

      Can anyone help me come up with a solution? Can it be done by intervening with some kind of observer? Any ideas are greatly appreciated, and I am sure other people too might want to draw in custom units.

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        Not really a way to create custom units. (And this IS one of the more popular feature requests !!)
        Problem is that the GUI does not have a way to express these custom units.

        However... you case can be simplified I think.

        Since 1 shaku is only slightly less than 6 THOUSANTHS of an inch shy of 1 foot, I would say to set the model units to Engineering Feet, or Decimal Feet (same thing.) And set your precision.

        That way you can THINK in shaku. (even though the GUI displays a tick for feet.)

        Before export you can scale the model by a factor of 303.mm/12.inch or 0.994094488188976

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          OK I just tested creating a shaku() instance method for the Numeric classes.

          It returns the correct number of inches, which should make Sketchup happy.

          However, it's worthless as an aid to the everyday modeler, because the Measurements Toolbar (aka VCB,) is still giving us fits when we type certain keys. They get interpreted as hotkeys as off ya' go into some other tool ... weeEEEEhhEeee!

          ... so until that is fixed, we cannot use custom unit functions in the VCB.. such as 2.shaku or 7.sun or 3.2.jo or 5.chi ... sorry.

          Unless... someone has made a WebDialog VCB that can pass inch values to the native VCB ???

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • L Offline
            lee3001
            last edited by

            I greatly appreciate your answer, Dan, and I suspected it might be difficult, though I am sure we agree that it seems a rather basic feature for a drafting program to have.

            Your method would be more reliable than my current workflow. However, there are complications. In Japan, as extensions and facilities are added to traditional buildings, they are normally made by the new standard, ie millimeters. And so, the drawings will sometimes contain both millimeters and shaku. And in my particular field of work, sometimes even feet and inches are used too. So sometimes there will be measures of inches, millimetres and shaku in the same single drawing. And so scaling in the end will be cumbersome as I have to keep track of which elements are drawn in what units, then scale them independently and realign them manually.

            I was wondering if there were a method to interfere with inputs in the measurements, so e.g. if you were to press CTRL-Enter rather than Enter after typing a shaku dimension in the VCB, it would automatically convert the dimension to the standard unit before passing it on to the tool? I guess it would be very difficult to implement it application wide, I suspect it might be impossible, but if so is there perhaps another way? Any crazy idea will do.

            1 Reply Last reply Reply Quote 0
            • L Offline
              lee3001
              last edited by

              We were typing replies at the same time, so I didnt see your most recent answer. I am very happy that you tried to implement a shaku feature. I think that a Webdialog that pass on values to the VCB would be great! If it can work simultaneously with the currently selected tool, I would be thrilled. Maybe someone have had a go at such a thing, I will look into it myself too.

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

                Unfortunately 'Dimensions' are barely exposed in the API at all so any clever converting of selected dimensions' text into shaku is impossible too...

                TIG

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  Success !! I spent a few hours testing.. research, writing and debugging.

                  But It DOES work.. but only on PC, AND when the model units are set to decimal Inches. (Will not work when set to feet.)

                  But that does not matter, you can switch model units on-the-fly depending on what you wish to work with.

                  So I have some more cleanup to do. I'll need to be sure the model units are set correctly (and restored afterward, if user has other units set.)

                  I also used a simple UI.inputbox for proof of concept. I set a hotkey "I" for the menu item: "Tools/Input Special..." Works OK.. as it pops up center screen, with the edit control active. Just type whatever "3.chi" (without quotes,) and hit Enter.

                  Also .. for now.. only works with 1 value, such as with the line tool. I have not yet contemplated the rectangle tool.
                  So. Bed time here. I''l continue tomarrow....

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • L Offline
                    lee3001
                    last edited by

                    Wow, that is really exciting! Looking forward to trying it! And I am sure that it will have several uses beyond shaku, I heard they use a plethora of units in India, otherworldly yet widespread units like the angula purportedly equivalent to eight barleycorns side by side.

                    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