Highlight each instance in a selection set
-
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!
-
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 -
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? -
@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?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement