sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    How to select without using the mouse

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 690 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.
    • M Offline
      morci429
      last edited by

      Guys, I have a model with 3 faces (face1, face2, face3)
      how do i select any of them from the ruby console

      1 Reply Last reply Reply Quote 0
      • TIGT Online
        TIG Moderator
        last edited by

        To find faces in a selection
        model=Sketchup.active_model ss=model.selection faces=[]; ss.each{|e|faces<<e if e.class==Sketchup::Face}

        If you have a reference to the 'face'
        ss.clear; ss.add(face1)
        etc...

        To find ALL of the model's [active] faces
        faces=[]; model.active_entities.each{|e|faces<<e if e.class==Sketchup::Face}

        Iterate through this array faces as desired...

        TIG

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

          You know when you select something and it highlights in blue or with dots, can i do that from the ruby console.
          What it is i have managed to make a list of faces and identify them with names and display them on a dropdown menu in a webdialog. Now what i want is when the user chooses a face i want it to be highlighted in the model with dots just as if he would click on it.
          Do i make any sense?

          1 Reply Last reply Reply Quote 0
          • TIGT Online
            TIG Moderator
            last edited by

            Reread my code ss.clear; ss.add(face1) clears the selection then adds 'face1' to the selection - this IS what you say you want to do.
            To test it in the Ruby Console, make a reference to the model, then one to the model's selection [say 'ss'] and use .clear/.add etc as desired...

            TIG

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

              Just for references: the API documentation on Selection: http://code.google.com/apis/sketchup/docs/ourdoc/selection.html
              All the stuff you can do with selection via SU Ruby API.

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

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

                MAN U R Genius πŸ˜„

                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