• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Highlight each instance in a selection set

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 2 Posters 543 Views
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.
  • C Offline
    confitex architure
    last edited by 2 May 2008, 09:35

    Hello!
    I'm building a selection set and would like to view every component instance, one by one, in the selection.

        ss = Sketchup.active_model.selection
    
         ss.each do |e|
         if( e.kind_of? Sketchup;;ComponentInstance )
    ...
    
    

    What can I insert in the "do" loop operation in order to visualy highlight every instance?

    Thanks for your help!

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jim
      last edited by 2 May 2008, 09:44

       
      ss = Sketchup.active_model.selection.collect
      ss.each do |e|
        if( e.kind_of? Sketchup;;ComponentInstance )
          Sketchup.active_model.selection.clear
          Sketchup.active_model.selection.add e
          UI.messagebox("Next")
        end
      end
      
      

      Hi

      1 Reply Last reply Reply Quote 0
      • C Offline
        confitex architure
        last edited by 2 May 2008, 10:03

        Thanks Jim!
        Once again, you hit the mark.
        First, I missed the ".collect" and get a bug on sketchup.

        Have you got any idea what scan order is prefered in the 'do' loop?
        Any way to sort the collection?

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by 2 May 2008, 10:10

          @unknownuser said:

          Thanks Jim!
          Once again, you hit the mark.
          First, I missed the ".collect" and get a bug on sketchup.

          Have you got any idea what scan order is prefered in the 'do' loop?
          Any way to sort the collection?

          Collect is a Ruby method that just makes a copy of the selections in an Array.

          There isn't any order to the entities returned (that I am aware of.) You'll need to sort them manually, possibly by building another array of only the instances. Then, you'll need to decide what to sort on: definition name, color, position, size?

          Hi

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

          Advertisement