[Maya Python] Mirroring lattice ( problem with lattice points )



Hello, everybody. I am looking for some help in scripting - rigging. I want to make tool which will mirror Lattice.
I start with duplicating ,putting in group and putting scale x -1 and etc. Here is some code example to understand faster:

geo = 'pSphere1'

his = cmds.listHistory( geo )
ffd = cmds.ls(his,typ='ffd')[0]

lttc = cmds.ls(his,typ='lattice')[0]
lttcTrs = cmds.listRelatives(lttc,p=True,ni=True,pa=True)[0]
baseTrs = cmds.listRelatives( cmds.ls(his,typ='baseLattice')[0],p=True, ni=True, pa=True )[0]
gp = cmds.createNode('transform')

mrrs = cmds.duplicate(gp,n='%s_mirror'%gp,rc=True)

cmds.parent( mrrs[1], w=True )
cmds.makeIdentity( mrrs[1], t=False, r=False, s=True, n=False, pn=True )

dvs = cmds.lattice(lttc,q=True,dv=True)
mrrLttc = cmds.lattice( mrrs[1], dv=dvs, oc=True )
lttcScl = cmds.getAttr('%s.s'%lttcTrs)[0]
baseScl = cmds.getAttr('%s.s'%baseTrs)[0]

Then I try some pymel (where I can’t succeed):

cmds.select(mrrs[2], r=True)
lattice = pm.selected()[0]

for point in lattice.pt:
    latticePointSplit = point.split('.')
    p1 = pm.pointPosition(point)[0]
    p2 = pm.pointPosition(point)[1]
    p3 = pm.pointPosition(point)[2]
    pm.move(mrrLttc+'Shape', (p1, p2, p3) , r=True)

What is left to do here , snapping newly made lattice point to old one. I can’t do it with now , because number of lattice point is different on those lattices, since old one was scaled -1 , that points are reversed. So I would be really grateful if somebody can give me idea , how to snap that newly made lattice points to old one.

Best regards,


I’m not totally clear on what you want – do you need to reproduce the original lattice while removing the -1 scale?