-- Selection-Switch -- Switches quickly between two selections (objects or sets) -- Dani Rosen 3/2005 -- v1.1 - Jul 17, 2006 - fixed cancelling bug -- v1.2 - Jul 1, 2009 - small syntax fix to work with new maxscript macroScript SelectionSwitch category:"DaniTools" internalcategory:"DaniTools" tooltip:"Selection-Switch" buttontext:"Selection-Switch" Icon:#("SubObjectIcons",20) ( global sswitch = 0 global selection_switch_rol() global S1 = undefined -- clearing old assignments global S2 = undefined -- clearing old assignments function Select1 = ( global S1=selectByName title:"Select one or multiple objects - SELECTION 1" single:FALSE if S1 == undefined then ( selection_switch_rol.s1Lab.text = "" return 0 ) if S1.count > 1 then ( selection_switch_rol.s1Lab.text = "Multiple Selections" ) else ( selection_switch_rol.s1Lab.text = S1[1].name ) ) function Select2 = ( global S2=selectByName title:"Select one or multiple objects - SELECTION 2" single:FALSE if S2 == undefined then ( selection_switch_rol.s2Lab.text = "" return 0 ) if S2.count > 1 then ( selection_switch_rol.s2Lab.text = "Multiple Selections" ) else ( selection_switch_rol.s2Lab.text = S2[1].name ) ) rollout selection_switch_rol "Selection-Switch v1.2" ( label selLabl "For each selection pick an object or a set of objects" button selection1 "Selection 1" pos:[40,30] button selection2 "Selection 2" pos:[180,30] label s1Lab "" pos:[70,60] label s2Lab "" pos:[210,60] label sLab "" height:20 button switchButton "Switch" align:#center width:88 height:30 on selection1 pressed do Select1() on selection2 pressed do Select2() on switchButton pressed do ( if (S1 == undefined) or (S2 == undefined) then ( messagebox "no selection made" ) else ( if sswitch==1 then ( select S2 if S2.count > 1 then ( sLab.text = "Selection 2" ) else ( sLab.text = S2[1].name ) sswitch = 0 ) else ( select S1 if S1.count > 1 then ( sLab.text = "Selection 1" ) else ( sLab.text = S1[1].name ) sswitch = 1 ) ) ) ) createdialog selection_switch_rol 300 150 )