# how to get local bounding box values?

 12 December 2012 cgbeige Expert   portfolio Dave Girard Opinions are mine. You can't have them. Oakland, USA how to get local bounding box values? I'm making a simple pivot toolbox and have it set up for world space bbox coordinates but I'm wondering how to get these values as something that can be input into the xform -piv command: That's an arbitrarily rotated object so world space doesn't work and querying/setting object space sets the pivot in the wrong spot. I want to be able to set the pivot to any point on the local bounding box (mid, min, max). I realize Local Tools does this but I just want to know for myself __________________ blog | Twitter | www.can-con.ca | 101 Autodesk Maya Tips for Kindle, EPUB/PDF or iPad edition share quote
 12 December 2012 zaskar Expert portfolio franky****inFourFingaz - Dresden, Germany Now you have the shape node with its local bounding box information and the transformation matrix of the parent transform. With both you can calculate the world space points of the local bbox midpoints as you sketched. Either use some python api or faster, use mel: ``````{ string \$sel[] = `ls -sl`; string \$shape[] = `ls -dag -shapes \$sel[0]`; string \$mat = `createNode pointMatrixMult`; connectAttr (\$sel[0] + ".worldMatrix") (\$mat + ".inMatrix"); float \$bbOSMin[] = `getAttr (\$shape[0] + ".boundingBoxMin")`; float \$bbOSMax[] = `getAttr (\$shape[0] + ".boundingBoxMax")`; //midPoint of +z float \$zPositive[] = {((\$bbOSMin[0] + \$bbOSMax[0]) * .5),((\$bbOSMin[1] + \$bbOSMax[1]) * .5),\$bbOSMax[2]}; setAttr (\$mat + ".inPoint") \$zPositive[0] \$zPositive[1] \$zPositive[2]; float \$result[] = `getAttr (\$mat + ".output")`; print \$result; delete \$mat; }`````` share quote
 12 December 2012 cgbeige Expert   portfolio Dave Girard Opinions are mine. You can't have them. Oakland, USA thanks - it was more work than I thought it would be so this is a big help. __________________ blog | Twitter | www.can-con.ca | 101 Autodesk Maya Tips for Kindle, EPUB/PDF or iPad edition share quote
 12 December 2012 cgbeige Expert   portfolio Dave Girard Opinions are mine. You can't have them. Oakland, USA ok - I seem to be almost there but these min/max values aren't correct for some reason - the mid ones work fine. If you can figure out where I'm wrong, it would be great. This is the first time I'm dealing with matrixes for stuff like this. `````` //START LOCATION BBOX proc string \$sel[] = `ls -sl`; //do the X coords switch(\$currentXPivotMenuSelection) { case "min": for (\$n=0 ; \$n
 12 December 2012 zaskar Expert portfolio franky****inFourFingaz - Dresden, Germany Hard to explain what the failure in your code above is, english isnt my favourite language. So here is a simplified but fully working version of your code: ``````string \$sel[] = `ls -sl`; for (\$n=0 ; \$n
 12 December 2012 cgbeige Expert   portfolio Dave Girard Opinions are mine. You can't have them. Oakland, USA awesome - thanks. This works great. __________________ blog | Twitter | www.can-con.ca | 101 Autodesk Maya Tips for Kindle, EPUB/PDF or iPad edition share quote
 12 December 2012 CGTalk Moderation Expert Thread automatically closed 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. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.