View Full Version : API (python): getting world space bounding box

11 November 2011, 10:59 PM
this is my first attempt to maya api so please - have patience. so here's my problem. i have a mesh and i need to get its bounding box in world space coordinates. i'm getting it in object space like this:

sl = om.MSelectionList()
sl.add( mesh )
path = om.MDagPath()
sl.getDagPath( 0, path )
if (path.hasFn(om.MFn.kTransform)) :
dag = om.MFnDagNode( path )
bbox = dag.boundingBox()

'mesh' is a name of my objects transform node.

i get two points defining bounding box. i suppose i have to get some matrix and transform those points - unfortunately i have no idea how. if someone could share a piece of code, i'd be very grateful.

11 November 2011, 11:54 PM
I didn't understand your problem. You got the bounding box. What do you need now?

11 November 2011, 07:32 AM
Get the dag.inclusiveMatrix() and multiply the points by it

11 November 2011, 08:05 AM
thank you Azrail - that's exactly what i need

CGTalk Moderation
11 November 2011, 08:05 AM
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.