This works for me:

import random
import maya.cmds as cmds

obj = cmds.polySphere()
bbox = cmds.exactWorldBoundingBox( obj )
random.uniform(bbox[0], bbox[1])
# Result: -1.00000016183 #

RyanT
Technical Artist
www.rtrowbridge.com/blog
NaughtyDog Inc.

On Mar 9, 9:34 am, Tucker <[email protected]> wrote:
> This is probably a very simple problem but i'm having problems getting
> random Bounding box values of an object. In MEL, the command is quite
> simple, it's just -
>
> rand ($bBox[0], $bBox[1]);
>
> Although in Python i import the random module and uni a uniform
> random. Which is -
>
> random.uniform(bBox[0], bBox[1])
>
> This how ever doesn't work because of the multiple values. I tried
> just using the random command on a single bounding box values but it
> tells me i need three variables instead of two.
>
> There's probably a really simple solution to this but at the moment
> i'm just a bit stumped.
>
> Thanks for any help.
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to