Adverti horiz upsell
How to - Maya - add object to lattice tutorial
How to - Maya - add object to lattice tutorial
Stephen Kershaw, updated 2010-12-06 13:48:12 UTC 36,559 views  Rating:
(2 ratings)
Page 1 of 1

The following is a quick and easy tutorial that shows you how to add objects to a lattice in Maya. It is useful if you already have geometry with a lattice applied and need to add extra objects to the lattice. Also useful if you want to position geometry in a particular way in relation to the lattice before connecting the two together.

Firstly you need to create your lattice -
  • Make sure you are on the animation menu set then goto – Create Deformers > Lattice and open up the dialog box.
  • Set the number of divisions of the lattice that you require.
  • Set the behaviour of the lattice on points outside of the lattice from the drop-down box.

    Next position your object where you want it in relation to the lattice.

    Select the lattice, then the objects.

    Open up the script editor

    Type in the following -

    string $selSet[] = `ls -sl`;
    string $lattice = $selSet[0];
    string $object = $selSet[1];
    lattice -e -g $object $lattice;

    Highlight the MEL code and hit enter (the one beside the keypad, not the main one).

    [This can be repeated for as many objects as you wish]


    • gramulho

      gramulho said about 7 years ago:

      Yeah, you could either do that, or go into the Window -> Relationship Editos -> Deformers Sets, then choose your set for your lattice. Muche easier with script though.
    • ldunham1

      ldunham1 said about 7 years ago:

      //even better with a quick for loop (only 2 extra lines) //select all objects you wanna add to lattice then shift select the lattice last string $selSet[] = `ls -sl`; int $size = `size ($selSet)` ; select -d $selSet[$size-1] ; string $sel = `ls -sl` ; string $lattice = $selSet[$size-1] ; for ($s in $sel) { lattice -e -g $s $lattice ; } //should work, haven't checked, ain't got Maya on laptop but just giving you general idea
    • Toke Jepsen

      Toke Jepsen said over 5 years ago:

      and converted to python: import maya.cmds as cmds lat=sel[-1] objs=sel[0:-1] for obj in objs: cmds.lattice(lat,e=True,geometry=obj)

    Please sign up or sign in to post a comment.