Notifications
Clear all

[Closed] simplified access to GROUPS

Hi,

the way we work on groups in the scene is handled differently in maxscript.
for ex – If I have to change the wirecolor of my group in max scene I select group and just change the color. but to do that with maxscript I didn’t find any simplest way to deal.

lets say I have selected 3 groups and 2 single objects in my scene and I have to change the wirecolor of all of them (each group and everything inside will have single color) then how you guys will approach? how the maxscript code will be.

Thanks

8 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

selection.wirecolor = yellow -- or whatever you want

But how do you select the groups? If you have some groups and some individual objects in scene how do you select all of them in maxscript? and then how you work on them in for loop without ignoring the group structure?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

you said you have them selected…

what is your scene?
what objects do you want to change wirecolor?

(
	function SelectAndPaint =
	(
		max select all	--	select all objects in the scene
		selection.wirecolor = red	--	change the wirecolor of the objects
	)
	case selection.count of
	(
		1:
		(
			if subobjectlevel != 0 then
			(
				subobjectlevel = 0
				SelectAndPaint()
			)
			else
			(
				SelectAndPaint()
			)
		)
		default:
		(
			SelectAndPaint()
		)
	)
)

Very confusing…
Can you explain properly as yo what you want to do?
If you want to select only groups, u can use
–> theSel = for o in Objects where (isGroupHead o == true) collect o

if you want to select all the objects in the group;
–> theSel = for o in Objects where (isGroupMember o == true) collect o

and then do it for the objects in the Group or Group or if you can explain in a better way!!!

Regards,

Videep

sorry my question was not clear.

what I wanted to know is if there is a group in my scene then how do I select all objects inside that group?

also is there anyway to know if the given object belongs to any group or not?

1 Reply
(@panayot)
Joined: 10 months ago

Posts: 0

IF the group is Closed, saying:
Select $GroupName
will select all (the head and children).
ELSE
On Open group saying:
Select $GroupName/*
–or:
Select $GroupName.children
will select 1st level children.


AND if there’s hierarchy:
for each in $GroupName do selectMore each.children

isGroupMember $obj

to find out if there are any groups in the Scene
–> theSel = for o in obejcts where (isGroupHead o == true) collect o
this will help you to create an Array named theSel which has all the groupRubberBandNames stored in them.

then use this code –>

groupMembers = #()
for varX = 1 to theSel.count do
(
groupMembers[varX] = for o in theSel[varX] where isGroupHead o == false collect o
)

Create an empty array then cycle through the old array we just made and make a new array called “groupMembers” which contains the objects in each group.

then if you say
select groupMembers[1]
max will select the Objects in the 1st Group according to the array theSel.

Hope this helps!!!

Regards,

Videep