pymel.core.general.transformLimits¶
- transformLimits(*args, **kwargs)¶
The transformLimits command allows us to set, edit, or query the limits of the transformation that can be applied to objects. We can also turn any limits off which may have been previously set. When an object is first created, all the transformation limits are off by default.Transformation limits allow us to control how much an object can be transformed. This is most useful for joints, although it can be used any place we would like to limit the movement of an object.Default values are:( -1, 1) for translation, ( -1, 1) for scaling, and (-45,45) for rotation. In query mode, return type is based on queried flag.
Flags:
Long Name / Short Name Argument Types Properties enableRotationX / erx bool, bool enable/disable the lower and upper x-rotation limitsWhen queried, it returns boolean boolean enableRotationY / ery bool, bool enable/disable the lower and upper y-rotation limitsWhen queried, it returns boolean boolean enableRotationZ / erz bool, bool enable/disable the lower and upper z-rotation limitsWhen queried, it returns boolean boolean enableScaleX / esx bool, bool enable/disable the lower and upper x-scale limitsWhen queried, it returns boolean boolean enableScaleY / esy bool, bool enable/disable the lower and upper y-scale limitsWhen queried, it returns boolean boolean enableScaleZ / esz bool, bool enable/disable the lower and upper z-scale limitsWhen queried, it returns boolean boolean enableTranslationX / etx bool, bool enable/disable the ower and upper x-translation limitsWhen queried, it returns boolean boolean enableTranslationY / ety bool, bool enable/disable the lower and upper y-translation limitsWhen queried, it returns boolean boolean enableTranslationZ / etz bool, bool enable/disable the lower and upper z-translation limitsWhen queried, it returns boolean boolean remove / rm bool turn all the limits off and reset them to their default values rotationX / rx float, float set the lower and upper x-rotation limitsWhen queried, it returns angle angle rotationY / ry float, float set the lower and upper y-rotation limitsWhen queried, it returns angle angle rotationZ / rz float, float set the lower and upper z-rotation limitsWhen queried, it returns angle angle scaleX / sx float, float set the lower and upper x-scale limitsWhen queried, it returns float float scaleY / sy float, float set the lower and upper y-scale limitsWhen queried, it returns float float scaleZ / sz float, float set the lower and upper z-scale limitsWhen queried, it returns float float translationX / tx float, float set the lower and upper x-translation limitsWhen queried, it returns linear linear translationY / ty float, float set the lower and upper y-translation limitsWhen queried, it returns linear linear translationZ / tz float, float set the lower and upper z-translation limitsWhen queried, it returns linear linearFlag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.transformLimits
Example:
import pymel.core as pm # Create an object, e.g. pm.cone() # Result: [nt.Transform(u'nurbsCone1'), nt.MakeNurbCone(u'makeNurbCone1')] # # 1. To set the limits for the translation of the cone to within # a unit volume centered at the origin pm.transformLimits( tx=(-1, 1), ty=(-1, 1), tz=(-1, 1) ) # 2. To disable the lower limits pm.transformLimits( etx=(False, True), ety=(False, True), etz=(False, True ) )