sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Using + and - to scale regardless of tool selected

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 6 Posters 305 Views 6 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.
    • D Offline
      descoteaux
      last edited by

      Hi,

      I'm creating a simplified toolbar for my users and I'd like for them to be able to press + or - to adjust the scale of an object regardless of their selected tool.

      I've figured out the code to scale using +/-, but I can't figure out how to make it apply to all tools (custom and default SU) like a global script. I know this is generally a no-no, but all of my users use SU in a very specific way.

      Is there an easy way to do this?

      Thank you.

      1 Reply Last reply Reply Quote 0
      • A Offline
        Aerilius
        last edited by

        (nono), because only the currently selected tool gets keyboard events.

        But your users could set up keyboard shortcuts for the + and - key (I don't know if those are available) and set them to two menu entries that you define: One will zoom in by a certain amount and one will zoom out.

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          You would need to have the users assign the plus and minus keys as shortcut keys that trigger your scale method. I don't know if there is some trickery you can do to somehow write those shortcut keys into their system somehow. That might not be advisable though, if you happen to be overwriting a shortcut they had already setup. You might just tell them to assign your scale +10% and scale -10% methods to whatever keys they want. Typically most people prefer to choose that kind of thing for themselves anyhow.

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            Another thought, if you are planning to use the + and - keys on a regular English keyboard, you have to hold down shift for the + key (otherwise its an = sign) and you do not hold down shift for the minus key. So that's a bit awkward if really have to -/shift+

            The numpad +/- work a little more smoothly. But some keyboards don't have numpads (especially laptops).

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • D Offline
              descoteaux
              last edited by

              Thanks guys. I hadn't thought of simply using SU's built-in shortcuts. 😳

              Are shortcuts saved to a file I can distribute with each installation? My users aren't very comfortable with computers so it would be best if each person had the exact same setup. Overwriting user settings won't be an issue thankfully.

              Also thank you for pointing out issues with laptop keyboards. That's definitely going to be a problem I'll have to work around.

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

                @descoteaux said:

                Are shortcuts saved to a file I can distribute with each installation?

                YES you CAN save the shortcuts out to a file. (BUT you must then explain to users how to import the custom shortcut file.)

                You use the "Import..." and "Export..." buttons, on the "Shortcuts" panel of the "Preferences" dialog.

                UI.show_preferences( "Shortcuts" )

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Problem is, you'll conflict with other tools that require VCB input - often one need to enter a negative number.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • Chris FullmerC Offline
                    Chris Fullmer
                    last edited by

                    and the period and comma keys.

                    PageUp and PageDown might be good choice, though they are already assigned to something. Maybe that would be an ok pair to overwrite.

                    Lately you've been tan, suspicious for the winter.
                    All my Plugins I've written

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      descoteaux
                      last edited by

                      Thanks again guys for steering me in the right direction. I think I've got it sorted out. πŸ‘

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

                        What about the up and down arrow keys instead?

                        I'm not here much anymore.

                        1 Reply Last reply Reply Quote 0
                        • Chris FullmerC Offline
                          Chris Fullmer
                          last edited by

                          up and down (well, up for sure) are used in inference locks. Up forces inferencing to the blue axis. Maybe add a ctrl to it? So ctrl-up ctrl-down? That could be nice.

                          Lately you've been tan, suspicious for the winter.
                          All my Plugins I've written

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            driven
                            last edited by

                            @chris fullmer said:

                            up and down (well, up for sure) are used in inference locks. Up forces inferencing to the blue axis...

                            on mac they have been re-allocated to create new pages, annoyingly when you want to lock the blue axis...
                            john

                            learn from the mistakes of others, you may not live long enough to make them all yourself...

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              @driven said:

                              on mac they have been re-allocated to create new pages, annoyingly when you want to lock the blue axis...

                              This doesn't sound right... Sure it's not on your system?

                              Thomas Thomassen β€” SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                driven
                                last edited by

                                @thomthom said:

                                This doesn't sound right...

                                it's not right, but possibly since M3, it's been driving me nuts..

                                @unknownuser said:

                                Sure it's not on your system?

                                I certainly haven't added it anywhere and it happens with
                                Plugins on or off,
                                Developer Tools on or off,
                                Advanced Camera tools on or off,
                                Dynamic Components on or off,
                                All off or All on...

                                open a drawing new or old...
                                click up-arrow result new scene
                                click down-arrow result delete scene

                                open a drawing new or old...
                                draw a rectangle select move tool grad a corner, start a move
                                click up-arrow result new scene
                                click down-arrow result delete scene

                                john

                                learn from the mistakes of others, you may not live long enough to make them all yourself...

                                1 Reply Last reply Reply Quote 0
                                • D Offline
                                  driven
                                  last edited by

                                  @unknownuser said:

                                  Sure it's not on your system?

                                  @unknownuser said:

                                  I certainly haven't added it anywhere and it happens with
                                  john

                                  but, It was and I found it,
                                  View/Animations/Update Scene
                                  View/Animations/Delete Scene
                                  View/Animations/Add Scene
                                  View/Animations/Previous Scene
                                  View/Animations/Next Scene

                                  All had Shortcuts I've never assigned, using the arrow keys, must be a plugin I tested?

                                  so cheers TT, I just got pissed off and didn't look, as I have never changed those...
                                  john

                                  learn from the mistakes of others, you may not live long enough to make them all yourself...

                                  1 Reply Last reply Reply Quote 0
                                  • thomthomT Offline
                                    thomthom
                                    last edited by

                                    Could be an animation plugin or scene manager... If it is, then it's bad manners from the developer.

                                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                    List of my plugins and link to the CookieWare fund

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      driven
                                      last edited by

                                      I test all 'Custom Toolbar' type rubies I find, to see if they work fully on mac and one of them probably set shortcut keys for some reason... I only dig deeper in ones that show promise...

                                      So my advice to the OP is please inform you users if you assign/re-assign 'shortcut' keys for them.

                                      john

                                      learn from the mistakes of others, you may not live long enough to make them all yourself...

                                      1 Reply Last reply Reply Quote 0
                                      • thomthomT Offline
                                        thomthom
                                        last edited by

                                        @driven said:

                                        So my advice to the OP is please inform you users if you assign/re-assign 'shortcut' keys for them.

                                        Or rather, give them the option to decline such change.

                                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                        List of my plugins and link to the CookieWare fund

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

                                          @thomthom said:

                                          @driven said:

                                          So my advice to the OP is please inform you users if you assign/re-assign 'shortcut' keys for them.

                                          Or rather, give them the option to decline such change.

                                          Violating this rule should be grounds for quarantine, IMHO.

                                          I'm not here much anymore.

                                          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