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

    Component search, select and zoom. Howto?

    Scheduled Pinned Locked Moved Plugins
    6 Posts 3 Posters 352 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.
    • P Offline
      philbx1
      last edited by

      Hi all,

      I started looking for Ruby examples on menu driven searching for components (with filters),
      then zooming to the selected component - pretty much like a scene selection.

      Failed big time...

      I don't expect any replies to this message, but thought I'd throw it out there as an idea.

      Any thoughts fine SK people?

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        @philbx1 said:

        Hi all,

        I started looking for Ruby examples on menu driven searching for components (with filters),
        then zooming to the selected component - pretty much like a scene selection.

        Failed big time...

        I don't expect any replies to this message, but thought I'd throw it out there as an idea.

        Any thoughts fine SK people?

        Here's a start

        mod = Sketchup.active_model
        ent = mod.active_entities
        sel = mod.selection
        vue = mod.active_view
        cmp_names = mod.definitions.map{|cd|cd.name}
        ctf = UI.inputbox(["Find;"],[cmp_names[0]],[cmp_names.join("|")],"Find Component Instances")
        if ctf
         mod.definitions[ctf[0]].instances.each{|ci|
          vue.zoom ci;
          break if UI.messagebox("Keep Searching?",MB_YESNO) == 7
         }
        end
        
        

        Component Search.gif

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

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

          @sdmitch said:

          Here's a start

          Hi Sam (sdmitch)

          I notice you use some sort of dialog or tool bar to execute the selected code from a dropdown. May I know its name and availability?

          Thanks
          Philip (pcmoor)

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

            Hey sdmitch,

            Thanks much for the reply. much appreciated.

            This will give me a good start as after looking at the SU Ruby API
            docs left me fairly confused.

            Similar to what pcmoor has stated, I now also need to find examples of menus etc.

            Hey, very nice web page BTW 😄

            Cheers,
            Phil.

            @sdmitch said:

            Here's a start

            mod = Sketchup.active_model
            > ent = mod.active_entities
            > sel = mod.selection
            > vue = mod.active_view
            > cmp_names = mod.definitions.map{|cd|cd.name}
            > ctf = UI.inputbox(["Find;"],[cmp_names[0]],[cmp_names.join("|")],"Find Component Instances")
            > if ctf
            >  mod.definitions[ctf[0]].instances.each{|ci|
            >   vue.zoom ci;
            >   break if UI.messagebox("Keep Searching?",MB_YESNO) == 7
            >  }
            > end
            > 
            
            1 Reply Last reply Reply Quote 0
            • P Offline
              philbx1
              last edited by

              Hey Sam,

              Just looking through your nice plugins and thought I'd get the main SDM Tools required dependancy plugin to check them out.

              Well, I failed again as I can't seem to locate the 'main' plugin as yet.

              Maybe I'm not looking hard enough...

              Thanks again,
              Phil B.

              1 Reply Last reply Reply Quote 0
              • sdmitchS Offline
                sdmitch
                last edited by

                @pcmoor said:

                @sdmitch said:

                Here's a start

                Hi Sam (sdmitch)

                I notice you use some sort of dialog or tool bar to execute the selected code from a dropdown. May I know its name and availability?

                Thanks
                Philip (pcmoor)

                The tool bar is Ruby Web Console, the original of several currently available, by Jim Foltz. It allows you to type in code snippets and execute them in the model. The code I posted was created and tested in this manner.

                Nothing is worthless, it can always be used as a bad example.

                http://sdmitch.blogspot.com/

                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