## 090717-playing with the power of python (MAYA)

julio 17, 2009 Yesterday i started to play some hours with mel , but i remembered the recomendations of rodrigo culagovski (www.culagovski.net – http://www.parametrica.org) about the benefits and advantages of python. So, i stopped with mel and put my hands into python.  im just starting with this , so im not to excited yet with the results (im waiting for better implementation of python in rhino 5), but i was able to do some simple triangle panels on a surface. some guy told me once “show me the code”, so…

import maya.cmds as mc
srf = mc.ls(sl=True)
umin = mc.getAttr (‘arrObj.minValueU’)
umax = mc.getAttr (‘arrObj.maxValueU’)
vmin = mc.getAttr (‘arrObj.minValueV’)
vmax = mc.getAttr (‘arrObj.maxValueV’)
numlist=12
Div= 12
arrpt=[]
for i in range(numlist):
arrpt.append(*Div)
for x in range (numlist):
for y in range (Div):
arrparamU= umin + x *(umax-umin)/Div
arrparamV= vmin + y *(vmax-vmin)/Div
arrpt[x][y]= mc.pointOnSurface (srf,u=arrparamU,v=arrparamV,top=True)
for x in range (1,Div,1):
for y in range (1,Div,1):
crv1= mc.curve(d=1,p=[(arrpt[x-1][y-1]),(arrpt[x-1][(y)]),(arrpt[(x)][(y)]),(arrpt[x-1][y-1])])
crv2= mc.curve(d=1,p=[(arrpt[x-1][y-1]),(arrpt[(x)][(y)]),(arrpt[x][y-1]),(arrpt[x-1][y-1])])
mc.planarSrf( crv1,d=1 )
mc.delete (crv1)
mc.planarSrf( crv2,d=1 )
mc.delete (crv2)

after some hours learning some basic stuff  of the sintax of python, i think i´m able to work on some really cool stuff (not this basic boring stuff, hahaha)

### Una respuesta to “090717-playing with the power of python (MAYA)”

1. Rodrigo Culagovski Says:

Diego,

try pymel: