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

    Invert Selection - No Shortcut Key

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 5 Posters 2.5k Views 5 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      Or to put it the other way round...

      Select something, so that the right-click context-menu item would be available.
      Open Preferences
      Shortcut section
      Filter for 'invert'
      Set short-cut key
      Close Preferences

      You should now have a key set as required...

      TIG

      1 Reply Last reply Reply Quote 0
      • free agentF Offline
        free agent
        last edited by

        why doesnt this work for projections?

        http:i167.photobucket.comalbumsu143FreeAgent84bug.gif

        1 Reply Last reply Reply Quote 0
        • CadFatherC Offline
          CadFather
          last edited by

          thanks thanks thanks - this is what's happening though:

          suppose i have a cube and a sphere and they are not selected, when i click on the invert selection icon the cube and the sphere get both selected (works like select all), when i click again the they deselect (works like select none).

          now suppose the cube is selected, when i click on the icon the sphere gets selected (invert selection), click again and the cube gets selected (invert selection)

          when the same command is given a shortcut key: if no selection, then pressing the key has no effect - but it works from the icon.

          how/can i fix it?


          yes why not for projections? if you download the individual scripts from Didier's - you can then assign a key.

          1 Reply Last reply Reply Quote 0
          • M Offline
            Matt666
            last edited by

            Did you write a script ? Can we see it ? Or else we can write smt for you ? πŸ˜‰

            Frenglish at its best !
            My scripts

            1 Reply Last reply Reply Quote 0
            • CadFatherC Offline
              CadFather
              last edited by

              @matt666 said:

              Did you write a script ? Can we see it ? Or else we can write smt for you ? πŸ˜‰

              Hi Matt, first i can barely deal with menus and that working through the night πŸ˜›

              thing is the script is already there but it has this strange behaviour which differs when run from icon and when run from shortcut key.. if you can sort something out.. from past experience, would i say no to monsieur Rubyn? πŸ˜„

              1 Reply Last reply Reply Quote 0
              • M Offline
                Matt666
                last edited by

                πŸ˜„
                Can you show the script and the icon code please? We can do smt into the icon code.
                For example, to look for a selevtion before starting the script...

                Frenglish at its best !
                My scripts

                1 Reply Last reply Reply Quote 0
                • CadFatherC Offline
                  CadFather
                  last edited by

                  thanks Matt - this is the menu code:

                  cmd03 = UI;;Command.new("Inverts Selection") {InvertSelection_.toggle} #if InvertSelection_.validate
                  cmd03.small_icon = "CD_ICONS/SELECT/invertselection_16.png"
                  cmd03.large_icon = "CD_ICONS/SELECT/invertselection_24.png"
                  cmd03.tooltip = "Inverts Selection"
                  cmd03.status_bar_text = "Inverts Selection"
                  cmd03.menu_text = "Inverts Selection"
                  gp_cd_zelect_tb.add_item(cmd03)
                  

                  this is TIG's code to which the menu refers

                  # Copyright 2005-8, TIG
                  # Permission to use, copy, modify, and distribute this software for 
                  # any purpose and without fee is hereby granted, provided that the above
                  # copyright notice appear in all copies.
                  # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
                  # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                  # Name ;          invertselection.rb
                  # Date ;          v1.0 8/7/5
                  #				  v1.1 10/2/8 Edges of selected faces are respected.                             
                  #-----------------------------------------------------------------------------
                  # This script will invert the current selection from the context menu.
                  # It will respect the nesting level if you are editing a group / component.
                  ### 
                  require 'sketchup.rb'
                  ###
                  class InvertSelection_
                   def InvertSelection_;;validate ###
                    model=Sketchup.active_model
                    ss=model.selection 
                    return nil if (ss.empty?)
                    return true
                   end
                  #
                   def InvertSelection_;;toggle 
                    model=Sketchup.active_model
                    ss=model.selection
                    ### add hidden smoothed edges to faces in selections ###
                    edges=[]
                    ss.each{|e|fedges=[]
                      fedges=e.edges if e.typename=="Face"
                  	fedges.each{|ee|edges.push(ee)} if not fedges.empty?
                    }
                    edges.each{|e|ss.add(e)} if not edges.empty?
                    ###
                    ### Find everything in the current edit level. 
                    model.active_entities.each {|e|ss.toggle(e)}###Flip selection
                   end
                  end # Class 
                  ###
                  
                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Matt666
                    last edited by

                    That's strange!
                    It works fine here!
                    Here is the code I've used, with an icon...
                    Try this and tell me if it's ok for you...
                    In case you have a pb in your code...


                    invertselection.zip

                    Frenglish at its best !
                    My scripts

                    1 Reply Last reply Reply Quote 0
                    • CadFatherC Offline
                      CadFather
                      last edited by

                      nope, doesn't work - but that means the conflict comes from other scripts present in cd_zelect.rb

                      will give it a look by elimination - Thanks Matt! πŸ‘

                      1 Reply Last reply Reply Quote 0
                      • CadFatherC Offline
                        CadFather
                        last edited by

                        solved - i needed to add a plugin menu item - with icon and context menu only i get that registering bug.

                        Thanks for all the help though! πŸ‘

                        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