/*
Script to create a Plane that fits an selected object from the top view (or the bounding box)
The idea was to use the bounding box information toi create a perfectly matching plane.
the exposeTM was the second idea, but it gives me stranger results than the $.max $.min approach.
create a teapot and rotate it in all 3 axis.
I want the dimensions from the "utilities - measure" tool! how can i access them or calculate them
myself?
*/
-- create a expose Transform node
expT = ExposeTM()
-- set the ExposeNode to the current selection
expT.exposeNode = $
-- get the boundingbox infos from the exposeTM
bb_width = expT.worldBoundingBoxWidth
bb_length = expT.worldBoundingBoxLength
-- get the boundingbox infos from the object itself
bb_max = $.max
bb_min = $.min
-- get the center of the object to position the plane
x_pos = (bb_max.x + bb_min.x) / 2
y_pos =(bb_max.y + bb_min.y) / 2
z_pos = bb_min.z
-- create the plane with length and width same as the bounding box
shadowPlane = Plane length:bb_width width:bb_length pos:[x_pos,y_pos,z_pos] isSelected:off lengthsegs:1 widthsegs:1
-- kill the exposeTM
delete expT
By pixhellmann · 2012-02-13
miauu · 2012-02-13