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.
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.
