17 Replies Latest reply on Oct 18, 2016 10:53 AM by John Stoltzfus

    Hotkey for dimension decimal places

    Peter Bergendahl

      Hey all,

       

      Is there anyway to make a hotkey for changing a drawing's dimension's decimal place?

      Say you click a dimension and then "u" to add decimal place or "i" to remove one.

       

      Maybe I would be the only one to use it...

       

       

      Peter

        • Re: Hotkey for dimension decimal places
          Glenn Schroeder

          Someone (not me) might be able to write a macro that you could link to a hotkey, but I'm pretty sure that's the only way.

          • Re: Hotkey for dimension decimal places
            Nathan Rollins

            I would use it as well.  In Pro/E I have mapkeys for setting a dim to 2,3,4 and 0 decimal places to a selected dimension(s) and I use them frequently when creating drawings.

             

            One of the handful of things that PTC has over SWX is the mapkey creation tool.  It is a simple record and assign a keystroke - I have yet to take the time to teach myself VBA and macros in SWX.  I have actually looked for a tutorial, but never found anything that suits a complete newbie like myself.

             

            Glenn Schroeder is a respected, long-time user and he also has not made the effort to learn.  That makes me think that it is neither easy nor simple to learn and implement.

             

            For a software product that prides itself as Easy to Learn and more productive than any other, I would think that they would put some effort into making this more intuitive.

             

            Let us know if you find anything!

             

            -Nate

            • Re: Hotkey for dimension decimal places
              Peter Bergendahl

              Ok, here is what I have determined.

               

              I figure there are two ways to do this with VBA

              .

              1) You can make individual hot keys to change to whatever precision you want, so you will have to have like 7 keys...or 3 or 4 for the common ones. This should be easy to program, but not very elegant.

              All you need to do is change this number (and Boolean to false) in bold to what ever precision you want in the macro file(s). Done.

              boolstatus = Part.EditDimensionProperties2(0, 0, 0, "", "", False, 3, 2, True, 1, 1, "", "", True, "", "", False)

               

              2) You could make a macro that tests the active dimension for what decimal place it has and then go up or down. You will need 2 hot keys for this (up and down duh). The problem is SW VBA is a big baby and I don't think you can test for an individual argument in the EditDimensionProperties operator. I have a call in to ask about it since no one probably knows the answer to that except for the guys who programmed it.

               

              So, yes it's possible. I just want the better VBA program. But if you just want a button to change a clicked on dimension to be a 4 place decimal, it's really really simple. I would just record the macro, save the file, associate to an hotkey.

               

              Peter

                • Re: Hotkey for dimension decimal places
                  Mike Helsinger

                  Of course!  I have never thought to do this but I change between 2 & 3 place decimals frequently.  Since I see some folks are hesitant to conquer the macro hurdle, I'll add my novice level macro skills for whomever is interested.  These macros set a chosen dimension or group to 2 or 3 places.  To use these macros as I have set them up, first select the dimension(s) you wish to change.  You will then have to move your mouse a little until the Dimension Palette disappears, it's getting in the way of this macro functioning.  Man I hate that thing.

                  Then activate the macro (add button or hotkey as you prefer).

                    • Re: Hotkey for dimension decimal places
                      Peter Bergendahl

                      Wow that is super funny. You are 100% right on the Dimension Palette deal. I created macros and it seemed buggy, but it was the Dimension Palette that was screwing it up. Can you stop the Dimension Palette...I won't need it if I get all these macros to work.

                       

                      Nice catch figuring that out. Now only if we can make the better method work.

                      This zip file has 2, 4, 5 places.

                       

                      P.S. Solidworks fix that issue...

                       

                      Peter

                        • Re: Hotkey for dimension decimal places
                          Mike Helsinger

                          I agree, the up / down selection idea would be pretty slick.  I would need to do some learning to conquer that one.

                           

                          Dimension Palette - that little box has been on my mind for a while, and I just searched / found the solution on this thread.  The thread is big so I'll cut to the chase.  Uncheck this box.

                           

                           

                          You will lose some other pop up functionality (mate toolbar for example) but in my case I use keyboard everything so I won't miss those either.  In that thread they explain possible solutions dealing with the registry editor, I made a small attempt, didn't work for me so I'm passing on all that.

                            • Re: Hotkey for dimension decimal places
                              Peter Bergendahl

                              Ok, for anyone that cares....I have solved this one. I had to call up for some tech support and they pointed me in the right direction, but didn't really tell me what to do...

                               

                              This is the link to the help topic. From there I was able to figure it out.

                              2015 SOLIDWORKS API Help - Get Precisions for a Dimension Example (VBA) http://help.solidworks.com/2015/english/api/sldworksapi/get_precisions_for_a_dimension_example_vb.htm

                               

                              The zip file contains 2 macros. One to add decimal places and one to subtract decimal places. You can hotkey these to buttons like "U" and "I" and be able to toggle places up and down so easily. Try it, it's great.

                              You just need to click your dimension first and then press your hot keys. If the dimension is set to "use document" the macro will change that to 3 places. If your dimension has a 3 place document default you will not see a change. You need to press your hotkey again.  (you can edit the macro and change the 3 to whatever you would like)

                               

                              Notes:

                              1) You still need to stop using the "Dimensions Palette" or move your mouse to make it disappear for these macros to work.

                              2) As long as your dimension is active/highlighted, you can press the buttons as much as you like. i.e. keep adding or removing places.

                              3) These macros should keep any Prefix or Suffix notes.

                              BUT....if your leaders are different they will revert back to default. I did not make the macro to test every aspect of the dimensions settings.

                              4) If you activate 2 or more dimensions, they will all adjust together. Nice.

                              5) In modeling mode, if you show your parts dimensions, you can activate dimension(s) and use these macros as well.

                              6) Lastly, I did not make the macro automatically click the green check mark, this would stop the ability to multi add/subtract places.

                               

                              I think that is it. Feel free to edit to fit your needs.

                              Peter