090717-playing with the power of python (MAYA)

julio 17, 2009

python

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.

py

py2

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.

py4

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([0]*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[0],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)

Anuncios

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


Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: