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

    Quick Selection

    Scheduled Pinned Locked Moved Plugins
    15 Posts 7 Posters 799 Views 7 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.
    • P Offline
      paddyclown
      last edited by

      Hi,

      All worked for a while in 2014, but in 2015 and last updated version 2014, I get this error when trying to use the quick selection tool...

      "Starting quick selection...
      Parsing objects with option: All visible objects
      Error: #<NameError: uninitialized constant Set>
      (eval):63:in build_searchable_entities' (eval):495:in quick_selection'
      (eval):691:in qs' (eval):710:in block in <top (required)>'
      -e:1:in `call'"

      any ideas please ?

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

        @paddyclown said:

        Error: #<NameError: uninitialized constant Set>

        Sketchup removed Set it now users Sketchup::Set

        you could add

        require('set')
        

        at the top of the script...

        it may then work, otherwise it needs a proper fix...
        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
        • P Offline
          paddyclown
          last edited by

          John, Thanks for the idea... it just made SU bugsplat on start... so i undid the change in order to work; I guess we just have to hope D Bur has a moment to update this plugin which was brilliant !

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            You can replace all occurrences in the script from Set.new with Sketchup::Set.new

            Hi

            1 Reply Last reply Reply Quote 0
            • P Offline
              paddyclown
              last edited by

              Jim,
              Thankyou ! BingoBongo it works !
              best,

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                @driven said:

                would it not be better to do a search and replace changing Set to Sketchup::Set in the script...

                Yes.

                I edited my example to remove the code snippet - it's a very bad idea.

                Hi

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

                  @driven said:

                  @jim said:

                  This should work.

                  
                  > > if defined?(Sketchup;;Set)
                  > >   Set = Sketchup;;Set
                  > > end
                  > > 
                  

                  I was going to suggest that, but what happens if another ruby has already used require 'set'?

                  would it not be better to do a search and replace changing Set to Sketchup::Set in the script...
                  john

                  That shim should be done in the extension namespace - then it's all fine. It should NOT be done in the global namespace as that will clash.

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

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by

                    I edited my snippet - it was a bad example without the namespace.

                    Better to just find and replace Set.new with Sketchup::Set.new

                    Hi

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

                      @jim said:

                      This should work.

                      
                      > Edit; removed Jim's example
                      > 
                      

                      I was going to suggest that, but what happens if another ruby has already used require 'set'?

                      would it not be better to do a search and replace changing Set to Sketchup::Set in the script...
                      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
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by Dan Rathbun

                        The easiest fix for Ruby 2 and higher, is to use a refinement that only that file can "see" and use.
                        I inserted the following at the top of the file (after deleting the Set reassignment):

                        require 'set'
                        
                        # Create a refinement for the Set class:
                        module DBUR
                          module RefinedSet
                            refine ::Set do
                              alias :insert :add
                              alias :contains? :include?
                            end
                          end
                        end
                        
                        # Use the refinement:
                        using DBUR::RefinedSet
                        

                        By request from @paddyclown, here is the "fixed" file.
                        It still needs a drastic overhaul, but this will get it working (fingers crossed):

                        DBUR_QuickSelection.rb

                        @Didier-Bur ping (I do not know how to send this by PM in this new forum interface.)

                        I'm not here much anymore.

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

                        Advertisement