macroScript Select_Instance_By tooltip:"Select Instances . /+SHIFT: Instance By Material. /+CTRL: Instance By Modifier. /+ALT: Instance WireColor." category:"_My Scripts_" Icon:#("LayerToolbar",2) ( local checkHF_state = false fn OpenGroup_recursively array = ( temp_array = for i in array where isValidNode i and isGroupHead i collect i with redraw off (for i in temp_array do (setGroupOpen i true)) select temp_array ; redrawViews() ) fn check_HiddenFrozen array = ( for i in array do ( try(if getproperty i #isHidden == true do setproperty i #ishidden false)catch() try(if getproperty i #isFrozen == true do setproperty i #isFrozen false)catch() ) array ) fn Select_objs array = ( if array != undefined and array.count != 0 do ( array = for i in array where (try(i.name != undefined)catch(false)) collect i if checkHF_state then array = check_HiddenFrozen array else ( array = for i in array where (try(getproperty i #isHidden == false)catch()) and \ (try(getproperty i #isFrozen == false)catch()) collect i ) clearSelection(); try(select array)catch() temp_array = for i in selection collect i OpenGroup_recursively temp_array; try(select array)catch() ) ) fn search_instances n = ( local objs if selection.count == 0 then (messageBox "Select Objects First to Find Instances") else ( array2select = #() objs = for i in selection collect i for i in objs do ( case n of ( 1:(InstanceMgr.GetInstances i &array2select) 2:( local mt = try(i.material)catch(undefined) if mt != undefined then for obj in objects where obj.material == mt do append array2select obj ) 3:( if selection.count == 1 then ( local mods = try(modPanel.getCurrentObject())catch(undefined) max create mode if mods != undefined and superclassof mods == modifier then for obj in objects where obj.modifiers.count != 0 do ( for m = 1 to obj.modifiers.count where obj.modifiers[m] == mods do append array2select obj ) ) else ( max create mode if i.modifiers.count != 0 then for n = 1 to i.modifiers.count do ( local mods = try(i.modifiers[n])catch(undefined) if mods != undefined then for obj in objects where obj.modifiers.count != 0 do ( for m = 1 to obj.modifiers.count where obj.modifiers[m] == mods do append array2select obj ) ) ) ) 4:( local wl = try(i.wirecolor)catch() if wl != undefined then for obj in objects where obj.wirecolor == wl do append array2select obj ) ) ) if array2select.count > objs.count then Select_objs array2select ) ) on isEnabled return selection.count != 0 on execute do ( if keyboard.shiftPressed then (search_instances 2) else ( if keyboard.controlpressed then (search_instances 3) else ( if keyboard.altpressed then (search_instances 4) else ( search_instances 1 ) ) ) ) )