Getting the min max of Group

Please forgive me if this has been asked before. But I am trying to get the min and max of a group so as to align the bounding box to a wall. I know there is an align tool, but I am trying to do this in batch. I am able to do this with regular objects, but not with groups.This is what I have that works for an object:

select objects

propselect = getCurrentSelection()

fn alignY =
(
pl =$dumyPlane001
sp = propSelect

sp.pos.x = 0

sp.pos.y = pl.center.y

selectObj = sp.max.y
targetObj = pl.max.y

sp.pos.y = targetObj - selectObj

sp.pos.y = sp.pos.y + pl.pos.y
)

alignY()

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

(
	select objects
 
	propSelect= getCurrentSelection()
	selObjsArr = getCurrentSelection()
-- 	--	"get the groups"
	groupsArr = for o in selObjsArr where (isGroupHead o) collect o
	nonGroupsObjs = for o in selObjsArr where (not isGroupHead o) collect o
 
	grp01 = groupsArr[1]
	format "Group Min: % \n" grp01.min
	format "Group Min: % \n" grp01.max
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.