• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

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 27 Apr 2011, 09:42

    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
    • T Offline
      TIG Moderator
      last edited by 27 Apr 2011, 10:08

      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 27 Apr 2011, 10:21

        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
        • T Offline
          TIG Moderator
          last edited by 27 Apr 2011, 10:30

          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
          • T Offline
            thomthom
            last edited by 27 Apr 2011, 10:33

            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 27 Apr 2011, 10:52

              MAN U R Genius 😄

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

              Advertisement