Go to: Synopsis. Return value. Keywords. Flags. Python examples.

Synopsis

geomToBBox([bakeAnimation=boolean], [combineMesh=boolean], [endTime=time], [keepOriginal=boolean], [name=string], [nameSuffix=string], [sampleBy=time], [shaderColor=[float, float, float]], [single=boolean], [startTime=time])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

geomToBBox is undoable, NOT queryable, and NOT editable.

Create polygonal mesh bounding boxes for geometry. Can also create a single bounding box per hierarchy.

Return value

None

Keywords

bounding, box

Flags

bakeAnimation, combineMesh, endTime, keepOriginal, name, nameSuffix, sampleBy, shaderColor, single, startTime
Long name (short name) Argument types Properties
bakeAnimation(ba) boolean create
Bake the animation. Can be used with startTime, endTime and sampleBy flags. If used alone, the time slider will be used to specify the startTime and endTime.
combineMesh(cm) boolean create
Combine resulting bounding boxes. Mutually exclusive with -s/single option.
endTime(et) time create
Used with bakeAnimation flag. Specifies the end time of the baking process.
keepOriginal(ko) boolean create
Do not remove the selected nodes used to create the bounding boxes.
name(n) string create
Specifies the bounding box name.
nameSuffix(ns) string create
Specifies the bounding box name suffix.
sampleBy(sb) time create
Used with bakeAnimation flag. Specifies the animation evaluation time increment.
shaderColor(sc) [float, float, float] create
Set the color attribute of the Lambert material associate with the bounding box. The RGB values should be defined between 0 to 1.0. Default value is 0.5 0.5 0.5.
single(s) boolean create
Create a single bounding box per hierarchy selected.
startTime(st) time create
Used with bakeAnimation flag. Specifies the start time of the baking process.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds


# Create two poly spheres and parent them together
#
cmds.polySphere()
cmds.move(-1, 0, 3)
cmds.polySphere()
cmds.move(3, 0, -1)
cmds.parent( 'pSphere2', 'pSphere1' )

# Select the parent sphere
#
cmds.select( 'pSphere1', replace=True )

# Create a bounding box per shape in the object hierarchy selected,
# add a name and suffix for that bounding box and add a RGB color for the
# shader color.
#
cmds.geomToBBox(name='MyBBox', nameSuffix='_perShape', shaderColor=[0,1,0.043])

# Create two poly spheres and parent them together
#
cmds.polySphere()
cmds.move(-1, 5, 3)
cmds.polySphere()
cmds.move(3, 5, -1)
cmds.parent( 'pSphere2', 'pSphere1' )

# Select the parent sphere
#
cmds.select( 'pSphere1', replace=True )

# Create one bounding box for the entire hierarchy selected,
# add a name and suffix for that bounding box and add a RGB color for the
# shader color.
#
cmds.geomToBBox(single=True, name='MyBBox', nameSuffix='_hierarchy', shaderColor=[0.928,0.460,1])

# Create and simple animation and bake the animation on the bounding box for
# a specific time frame and incremental evaluation time.
cmds.polySphere(name="BouncingBall")
cmds.currentTime(1)
cmds.setKeyframe()
cmds.currentTime(5)
cmds.move( 0, 10, 0)
cmds.setKeyframe()
cmds.currentTime(9)
cmds.move( 0, 0, 0)
cmds.setKeyframe()

cmds.geomToBBox(keepOriginal=True, name="BakedAnimBBox", bakeAnimation=True, startTime=3, endTime=7, sampleBy=0.5)
cmds.currentTime(1)