pymel.core.modeling.geomToBBox

geomToBBox(*args, **kwargs)

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

Flags:
Long name (short name) Argument Types Properties
bakeAnimation (ba) bool ../../../_images/create.gif
 
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) bool ../../../_images/create.gif
 
Combine resulting bounding boxes. Mutually exclusive with -s/single option.
endTime (et) time ../../../_images/create.gif
 
Used with bakeAnimation flag. Specifies the end time of the baking process.
keepOriginal (ko) bool ../../../_images/create.gif
 
Do not remove the selected nodes used to create the bounding boxes.
name (n) unicode ../../../_images/create.gif
 
Specifies the bounding box name.
nameSuffix (ns) unicode ../../../_images/create.gif
 
Specifies the bounding box name suffix.
sampleBy (sb) time ../../../_images/create.gif
 
Used with bakeAnimation flag. Specifies the animation evaluation time increment.
shaderColor (sc) float, float, float ../../../_images/create.gif
 
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) bool ../../../_images/create.gif
 
Create a single bounding box per hierarchy selected.
startTime (st) time ../../../_images/create.gif
 

Used with bakeAnimation flag. Specifies the start time of the baking process.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.geomToBBox

Example:

import pymel.core as pm

# Create two poly spheres and parent them together
#
pm.polySphere()
# Result: [nt.Transform(u'pSphere1'), nt.PolySphere(u'polySphere1')] #
pm.move(-1, 0, 3)
pm.polySphere()
# Result: [nt.Transform(u'pSphere2'), nt.PolySphere(u'polySphere2')] #
pm.move(3, 0, -1)
pm.parent( 'pSphere2', 'pSphere1' )
# Result: [nt.Transform(u'pSphere2')] #
# Select the parent sphere
#
pm.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.
#
pm.geomToBBox(name='MyBBox', nameSuffix='_perShape', shaderColor=[0,1,0.043])
# Result: [u'MyBBox_perShape', u'MyBBox_perShape1'] #
# Create two poly spheres and parent them together
#
pm.polySphere()
# Result: [nt.Transform(u'pSphere1'), nt.PolySphere(u'polySphere1')] #
pm.move(-1, 5, 3)
pm.polySphere()
# Result: [nt.Transform(u'pSphere2'), nt.PolySphere(u'polySphere2')] #
pm.move(3, 5, -1)
pm.parent( 'pSphere2', 'pSphere1' )
# Result: [nt.Transform(u'pSphere2')] #
# Select the parent sphere
#
pm.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.
#
pm.geomToBBox(single=True, name='MyBBox', nameSuffix='_hierarchy', shaderColor=[0.928,0.460,1])
# Result: [u'MyBBox_hierarchy'] #
# Create and simple animation and bake the animation on the bounding box for
# a specific time frame and incremental evaluation time.
pm.polySphere(name="BouncingBall")
# Result: [nt.Transform(u'BouncingBall'), nt.PolySphere(u'polySphere1')] #
pm.currentTime(1)
# Result: 1.0 #
pm.setKeyframe()
# Result: 10 #
pm.currentTime(5)
# Result: 5.0 #
pm.move( 0, 10, 0)
pm.setKeyframe()
# Result: 10 #
pm.currentTime(9)
# Result: 9.0 #
pm.move( 0, 0, 0)
pm.setKeyframe()
# Result: 10 #
pm.geomToBBox(keepOriginal=True, name="BakedAnimBBox", bakeAnimation=True, startTime=3, endTime=7, sampleBy=0.5)
# Result: [u'BakedAnimBBox1'] #
pm.currentTime(1)
# Result: 1.0 #

Previous topic

pymel.core.modeling.freeFormFillet

Next topic

pymel.core.modeling.getMetadata

Core

Core Modules

Other Modules

This Page