Hide selected objects from scenes except the active one?
-
Hi,
I want to hide selected object from all scene except the one that is active.
This is the code I have so far...any ideas are welcome!
model = Sketchup.active_model pages = model.pages sel = model.selection pages.each {|page| sel.each do |e| e.hidden = true end page.update }
Cheers!
-
Perhaps something like
... pages.each {|page| next if page == pages.selected_page # to skip active scene ... }
-
Thanks TIG but there is a problem...
Lets say I have two scenes with two objects and I select the 1st object from 1st scene and do the script...it will work but...if I go to 2nd scene and select the 2nd object to do the script when I go to 1st scene the 1st object ends up hidden as well which it was not supposed to. (Hope this makes sense)
Anyhow it may be that the page.update needs to first select each page before doing update. So that means I can't use your suggestion but I did find a solution... Here is the code...
model = Sketchup.active_model pages = model.pages sel = model.selection c_page = pages.selected_page skip = [] skip << c_page.name pages.each {|page| pages.selected_page = page if page.name != skip.first sel.each do |e| e.hidden = true end page.update end } page_num = 0 pages.each {|page| if page.name == skip.first pages.selected_page = model.pages[page_num] break end page_num+=1 } skip.clear
Note: Updated the explanation a bit to fix it a little so it makes more scene hopefully.
Advertisement