Hi Guys,
As the Subject describes i'm trying to check if the selected object is a group or not. If it is then show a messagebox warning, if not then do something else. In the attached snippet I have simply shown another messagebox to warn "not a group". I have tried many variations and google searches but I cant seem to find the right answer, although I dont think I'm far away.
My test involved creating two boxes and grouping one of them, then select one at a time and run the script.
Any help would be very much appreciated. I have inlcuded my snippet of where I got too but getting stuck.
Thanks!
for obj in selection do
(
if (not isGroupHead obj == false) or isGroupMember == true then
(
messagebox("You selected a group")
)
else
(
messagebox("Not a group")
)
)
Comments (3)
Comment policy
`
Hi,
If you want to check if there is any group object in multi selection, try this:
Best,
Pixamoon
.
You can add a check for the open group head. :)
Pixamoon, Thank you very much for the code snippet! Worked great.
and thanks also Miauu for the tip about checking if the group is open. I have ammended the for loop so it now reads tmpArr = for o in selection where isGroupHead o or isGroupMember o collect o which seams to work great. Unless you can see anything I have done wrong?
Thank you both very much!