PDA

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


tomekp
11-27-2011, 09: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)) :
path.extendToShape()
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.

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

Azrail
11-28-2011, 06:32 AM
Get the dag.inclusiveMatrix() and multiply the points by it

tomekp
11-28-2011, 07:05 AM
thank you Azrail - that's exactly what i need

CGTalk Moderation
11-28-2011, 07: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.