ScriptSpot home

Forum topic · Scripts Wanted

Move selected group to 0,0,0

By EPXLSD · 2016-09-16

Description

Everybody hellow!Pleaze,help, how can i select a group of objects?
1. I select objects
2. Push MAKE GROUP from SELECTION
3. Need a command to select this group or any other group to do SELECTION.POS=[0,0,0]

s = selection
s.pos=[0,0,0]

But it work for each object in a group.

How can i do it for whole GROUP, no for each obj in group?
Thanx for advance)

Comments (7)
Tedodd

Reader

Selection group and working for the selection group is better. I want to choose uk best essays but i want to study about it. Because i have not more information about it which were not mention in the give page so hope you come and start your work.

fajar

little bit


a=group selection name:"temp_group"
b=point pos:[(a.min.x+a.max.x)/2,(a.min.y+a.max.y)/2,a.min.z]
setGroupHead b true
a.pos= [0,0,a.min.z]--change a.min.z to 0 to perfectly put it 0 
ungroup a

--select something first and run the script....you can make it a function tooo

Reply to fajar
EPXLSD

Hellow, fajar) Thank u, i've already tried this way. Group selection, move group to 0,0,0, and then ungroup. But UNDO function doesnt work! Max crashes((

miauu

.


(
	function FindTopMostGroupHead obj = if isgroupMember obj do
	(
		while obj != undefined and (not isGroupHead obj or isGroupMember obj) do
			(obj = obj.parent)
		obj
	)
		
	selObjsArr = selection as array
	if selObjsArr.count != 0 do
	(
		for o in selObjsArr do
		(
			grpHead = FindTopMostGroupHead o
			if isValidNode grpHead do
				grpHead.pos = [0,0,0]
		)
	)
)