Notifications
Clear all

[Closed] match bounding box with Box object

The problem I’m having is if the object has scale on its transform then the dummy box does not match. Which I do not want to apply scale onto the dummy object.


bb = nodeGetBoundingBox selection[1] $.transform

dumWidth = abs (bb[1][1] - bb[2][1] as float)
dumLength = abs (bb[1][2] - bb[2][2] as float)
dumHeight = abs (bb[1][3] - bb[2][3] as float)

 dumObj = box width:dumWidth length:dumLength height:dumHeight rotation:($.rotation)
 CenterPivot dumObj
 dumObj.pos = ($.center)



2 Replies

Snippet does just what I want now.


for i in selection do (
	c = snapshot i
	c.transform = matrix3 1
	bb = c.max - c.min
	b = box width:bb[1] length:bb[2] height:bb[3]
	CenterPivot b
	delete c
	b.transform = i.transform
	b.pos = i.center
	b.pivot = i.pivot
	b.name = i.name + "_box"
)

you have to reset xform of the source object before calculating the bounding box.