View Full Version : Measure Object

02 February 2009, 12:55 PM
Is there an easy way to get the Length/Width/Height of an object in world units?

I know you can't access the Utility->Measure rollout through maxscript. But do I really have to write a script looping through all the vertices and getting the maximum and minimum positions?

02 February 2009, 12:59 PM
do you want the proper length/width/height, or just the bounding box ($.max - $.min)?

02 February 2009, 01:07 PM
You can use nodeLocalBoundingBox <node> to get the same <node>.min, and <node>.max in an array of point3, or nodeGetBoundingBox <node> <matrix3> to have them in a different coordsys specified by transform matrix provided.

- Enrico

02 February 2009, 01:24 PM
Cool, cheers can do what I want to now.

If you've got 2 objects which need to be the same size in world units but have different scale setups so you can't use align scales.

--Select the object to be enlarged then the target object and run script
a = ($selection[1].max - $selection[1].min)
b = ($selection[2].max - $selection[2].min)
$selection[1].scale = b/a

Just a random script but it's useful for what I'm doing.

For example, you have one 10x10x10 box. And another box scaled up to 20x20x20 and then Xform collapsed. (so objects are different sizes but both have scale values of 100%) If you knew this enlargment then you could simple set the scale to 200% for the first box, but if you didn't know these facts then to match the scales you would have to do it by eye. Or do some calculations, (as above). Box01 will then become the same visible size as Box02, but their scale values would be different.

CGTalk Moderation
02 February 2009, 01:24 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.