Mel - Maya Embedded Launguage

<HOME>   <PREVIOUS>   <NEXT>

Commonly used Commands with Some of their attributes:

For a complete list of attributes, always refer to the MEL Command Help.
Primitives
Nurbs Polygons

sphere
-n/-name string
-r/-radius
-ssw/-startSweep angle
-esw/-endSweep angle
-s/-sections integer
-nsp/-spans integer
-hr/-heightRatio float

polySphere
-n/-name string
-r/-radius
-sx/subdivisionsX int
-sy/subdivisionsY int

nurbsCube
-n/-name string
-w/-width linear
-lr/-lengthRatio float - length to width ratio
-hr/-heightRatio float - height to width ratio
-u/-patchesU integer
-v/-patchesV integer

polyCube
-n/-name string
-w/width linear
-h/height linear
-d/depth linear
-sx/subdivisionsX int
-sy/subdivisionsY int
-sz/subdivisionsZ int

nurbsPlane
-n/-name string
-w/-width linear
-lr/-lengthRatio float
-u/-patchesU integer
-v/-patchesV integer

polyPlane
-n/-name string
-w/width linear
-h/height linear
-sx/subdivisionsX int
-sy/subdivisionsY int

cone
-n/-name string
-r/-radius linear
-ssw/-startSweep angle
-esw/-endSweep angle
-s/-sections integer
-nsp/-spans integer
-hr/-heightRatio float

polyCone
-n/-name string
-r/radius linear
-h/height linear
-sx/subdivisionsX int
-sy/subdivisionsY int
-sz/subdivisionsZ int

cylinder
-n/-name string
-r/-radius linear
-ssw/-startSweep angle
-esw/-endSweep angle
-s/-sections integer
-nsp/-spans integer
-hr/-heightRatio float

polyCylinder
-n/-name string
-r/radius linear
-h/height linear
-sx/subdivisionsX int
-sy/subdivisionsY int
-sz/subdivisionsZ int

torus
-n/-name string
-r/-radius linear
-ssw/-startSweep angle
-esw/-endSweep angle
-s/-sections integer
-nsp/-spans integer
-hr/-heightRatio float
-msw/-minorSweep angle

polyTorus
-n/-name string
-r/radius linear
-sr/sectionRadius linear
-tw/twist angle
-sx/subdivisionsX int
-sy/subdivisionsY int

Curves
curve
-p/-point distance distance distance

Example: curve -p 0 0 0 -p 3 5 6 -p 5 6 7 -p 9 9 9;

      getAttr "curve1.spans";
This returns the number of spans in the curve.

      getAttr "curve1.cv[0]";
This returns the local x,y,z of the 1st CV.

      getAttr "curve1.cv[0:2]";
This returns the local x,y,z of the 1st three CVs.

      getAttr "curve1.cv[*]";
This returns the local x,y,z of all CVs.


Lights
directionalLight
-n/-name string
-e/-edit edit the parameters of an existing light
-rgb float float float
-i/-intensity float
spotLight
-n/-name string
-e/-edit edit the parameters of an existing light
-q/-query
-ca/-coneAngle float
-do/-dropOff float
-p/-penumbra float
-rgb float float float
-i/-intensity float

pointLight
-n/-name string
-e/-edit edit the parameters of an existing light
-q/-query
-d/-decayRate int
-rgb float float float
-i/-intensity float

Selecting and Deleting

select
select objName;
select cone1;
delete
To delete selected objects use:
delete;

To delete a few specific objects like surfaceShape1, surface1 and paramCurve1 use:
delete surfaceShape1 surface1 paramCurve1;


Attributes

setAttr
float $ys = `getAttr Brawl.scaleY`;
setAttr
setAttr("Brawl.scaleY", $ys * 2);


Transformations

move
move 3 0 0; - moves the selected object

-a/-absolute
-r/-relative
-x/-moveX Move in X direction
-y/-moveY Move in Y direction
-z/-moveZ Move in Z direction
-xy/-moveXY Move in XY direction
-xz/-moveXZ Move in XZ direction
-yz/-moveYZ Move in YZ direction
-xyz/-moveXYZ Move in all directions (default)

rotate
-a/-absolute absolute operation.
-r/-relative relative to the object's current position
-p/-pivot double double double

cone -n cone1;
select cone1;
rotate -r 45deg 0 0;


scale
scale 1 1 1;
-a/-absolute absolute operation.
-r/-relative relative to the object's current position
-p/-pivot double double double


Grouping/Parenting

group
-w/-world put the new group under the world
-p/-parent string put the new group under the given parent
-em/-empty create an empty group (with no objects in it)
sphere -n sphere1;
move 3 0 0;
sphere -n sphere2;
move -3 0 0;
group -n group1 sphere1 sphere2;
parent
parent circle1 group2;
-w/-world unparent given object(s) (parent to world)
-r/-relative preserve existing local object transformations
    (relative to the parent node)
-a/-absolute preserve existing world object transformations
-add/-addObject add the object(s) under the parent.
-rm/-removeObject remove an instance of an object from
    under the parent.
    (Note: if there is a single parent then the object
    is effectively deleted from the scene)

ungroup
ungroup group1;
-w/-world put ungrouped objects under the world
-p/-parent put ungrouped objects under the given parent
-r/-relative preserve existing local object transformations
-a/-absolute preserve existing world object transformations


Others

duplicate
sphere -n sphere1;
move 3 0 0;
duplicate sphere1;

-smartTransform flag
circle -n circle1;
duplicate circle1;
move 3 0 0;
duplicate -st;
duplicate -st;

rand
rand 42;
// Result: 23.8585 //
rand -80 42;
// Result: -12.1565 //
rand <<1,1,1>>;
// Result: <<0.531557, 0.920261, 0.515431>> //
rand <<1,1,1>> <<100, 200, 300>>;
// Result: <<81.2325, 38.4956, 266.008>>

<Top>